Arduino
Arduino
and Actuators
with Arduino
Hans-Petter Halvorsen, M.Sc.
System Overview
NTC Thermistor
Arduino
Download Code
Computer
TMP36
Pt-100
Sensors (Input)
Actuators (Output)
Examples:
Push Button
Programming
Cloud
LED
Sound
Data Logging
Lab Topics
Get Overview of the Arduino Platform
Sensors and Actuators Overview in general
Overview of Temperature Sensors, such as
- Pt-100, Thermistor, Thermocouple
Assignment Overview
1. Arduino Basics: Explore the different Sensors and Actuators
available with the Arduino Kit
2. Temperature Sensors
3. Pt-100: Create your own Pt-100 sensor with Transmitter from
scratch and Read Temperature values using Arduino
4. Create a Temperature Data Logger/Embedded DAQ System.
Select one of the following alternatives:
a) Save Data using SD Card available on Arduino Shields
b) Use an online web-based Data Logging Service like Temboo/Xively
c) Use Wireless Communication to your PC using XBee Modules
Arduino
Arduino Sketch IDE
Software
Software
Example:
// include the TinkerKit library
#include <TinkerKit.h>
// creating the object 'led' that belongs to the 'TKLed' class
TKLed led(O0);
void setup()
{
}
void loop()
{
led.on();
delay(1000);
led.off();
delay(1000);
}
//
//
//
//
Hardware
Hardware
Breadboard
Pt-100
Tools
Sensors and Actuators
Pt-100 Transmitter
Multimeter
Theory
http://en.wikipedia.org/wiki/Actuator
Sensors
Calibration: A comparison between measurements. One of
known magnitude or correctness made or set with one device
and another measurement made in as similar a way as possible
with a second device. The device with the known or assigned
correctness is called the standard. The second device is the unit
under test, test instrument, or any of several other names for
the device being calibrated.
Theory
In the assignment you need to deal with these parameters. You find information about these parameters in the Data
sheet for your device
http://en.wikipedia.org/wiki/Calibration
http://en.wikipedia.org/wiki/Measurement_uncertainty
http://en.wikipedia.org/wiki/Accuracy_and_precision
Arduino Basics
Getting Started with Arduino
10
Arduino UNO
https://www.arduino.cc/en/Guide/HomePage
http://www.arduino.cc
https://www.arduino.cc/en/Guide/HomePage
12
Books
These books gives you an introduction to Arduino. These books are available on the lab. Lots of
Arduino books are also available on Safari Books Online
Arduino Basics
Breadboard
15
https://www.youtube.com/playlist?feature=edit_ok&list=PLT6
rF_I5kknPf2qlVFlvH47qHvqvzkknd
17
Getting Started
Arduino with Breadboard Sensors/Actuators:
LED
Push Button
Potentiometer
Different Temperature Sensors
etc.
19
Temperature Sensors
Temperature Measurements
Theory
Infrared
Thermometers
21
Temperature Sensors
Make the following Temperature Sensors work with Arduino:
NTC Thermistor
TMP36
NTC Thermistor
https://www.elfa.se/elfa3~eu_en/elfa/init.do?item=60-260-41&toc=0&q=60-260-41
Tutorial: http://garagelab.com/profiles/blogs/tutorial-using-ntc-thermistors-with-arduino
23
TMP36
Theory
https://learn.adafruit.com/tmp36-temperature-sensor
24
Datasheet Calculations
Theory
y[C] = (1/10)*x[mv]-50
25
Voltage-based Sensors
According to the TMP36 datasheet, the relation of the output voltage
to the actual temperature uses this equation:
y[C] = (1/10)*x[mv]-50
TMP36
output = analogRead(aichannel)
0-1023
A0-A5
Serial Monitor
27
28
Resistance-based Sensors
Theory
Serial Monitor
double getTemp()
{
// Inputs ADC Value from Thermistor and outputs Temperature in Celsius
int RawADC = analogRead(temperature Pin) ;
long Resistance;
double Temp;
// Assuming a 10k Thermistor.
Calculation is actually: Resistance = (1024/ADC)
Resistance=((10240000/R awAD C) - 10000);
// Utilizes the Steinhart-Hart Thermistor Equation:
// Temperature in Kelvin = 1 / {A + B[ln(R)] + C[ln(R)]^3}
// where A = 0.001129148, B = 0.000234125 and C = 8.76741E-08
Temp =
Temp =
Temp =
return
}
log(Resistance);
1 / (0.001129148 + (0.000234125 * Temp) + (0.0000000876741
Temp - 273.15; // Convert Kelvin to Celsius
Temp; // Return the Temperature
Steinhart-Hart Equation:
31
Pt-100 Measurements
Temperature Measurements
Pt100: Create your own temporary Pt-100 sensor with
Transmitter (create the circuit on a breadboard) and
then Read Temperature values using Arduino.
Suggested Tasks:
Compare with Temperature Sensors available within the
Arduino Kit (TMP36, Thermistor,...)
Compare and Discuss the following Temperature
Measurements; Pt-100, Thermocouple, Thermistor
(Measurement principles, etc.)
33
Cable clamp
Ground
Output
+24 V
RTDred
RTDwhite
Internal
terminal block
Pt100
transducer
RTDred
Pt-100 Wiring
<<<<<<<
Pt100 element
+ 24 V
transducer
red
red
white
4-20 mA
R ~250
Pt100
+
1-5 V output
terminals
24 V PSU
Output terminals
Important! Test the output of your circuit BEFORE connecting it to the Arduino Analog Input with a
Multimeter to make sure the voltage is not higher than 5V, else the Arduino will be damaged!
Output
RTD
Output +
0 V
Pt-100
https://www.elfa.se/elfa3~eu_en/elfa/init.do?item=76-69051&toc=0&q=76-690-51
https://www.elfa.se/elfa3~eu_en/elfa/init.do?item=76-89574&toc=0&q=76-895-74
24VDC/0.25A Power Supply
Breadboard
https://www.elfa.se/elfa3~eu_en/elfa/init.do?item=69-061-79&toc=0&q=69-061-79
35
Important!!!
0 V
+ 24 V
RTD
transducer
red
red
white
4-20 mA
R ~250
Pt100
+
1-5 V output
terminals
37
NTC Thermistor
Use e.g., Arduino Wi- Fi/Ethernet Shield for Communication over a network - or
use the microSD card on these Shields
Save the data to a microSD card located on the Wi- Fi/Ethernet Shield - or
connect e.g., to xively.com or temboo.com - which are free datalogging sites.
Log Temperature Data for e.g., 24 hours and import Data into Excel, LabVIEW or
MATLAB for Analysis and Visualization
Use e.g. a 9V battery or an external power source to make it portable and small
41
This gives:
This gives:
Filter output
Arduino Libraries
The Arduino environment can be extended through the use of libraries, just like most
programming platforms.
Libraries provide extra functionality for use in sketches, e.g. working with hardware
or manipulating data. A number of libraries come installed with the IDE, but you can
also download or create your own.
You could say an Arduino Library is like a Class with Methods/Functions. It is a good
way to structure your code
Examples:
Ethernet Library for the Arduino Ethernet Shield
SD Library: The SD library allows for reading from and writing to SD cards, e.g. on the
Arduino Ethernet Shield or Arduino Wi-Fi Shield
Wi-Fi library for the Arduino Wi-Fi Shield
43
Ethernet
Arduino Ethernet Shield
http://www.twilio.com/
www.temboo.com
45
stored in the
Cloud
Wi-Fi/Ethernet
Cloud
Presentation of Data
Computer
MS Excel or similar
www.digi.com/xbee/
XBee Example
XBee 802.15.4 Module 1
XBee 802.15.4 Module 2
Wireless Communication
XBee SIP Adapter Board
or
XBee 5V/3.3V
Adapter Board
Arduino
USB Cable
PC
Breadboard
48
49
Fritzing
A open source tool for making simple wiring
diagram for your hardware wiring
https://en.wikipedia.org/wiki/Fritzing
http://fritzing.org
Wiring made with Fritzing
Congratulations! - You are finished with all the Tasks in the Assignment!