Professional Documents
Culture Documents
Senzori Arduino PDF
Senzori Arduino PDF
and
Actuators
with
Arduino
h4p://arduino.cc
Hans-‐Pe4er
Halvorsen,
M.Sc.
• Arduino
is
an
open-‐source
physical
compu?ng
plaAorm
designed
to
make
experimen?ng
with
electronics
and
programming
more
fun
and
intui?ve.
• Arduino
has
its
own
unique,
simplified
programming
language
and
a
lots
of
premade
examles
and
tutorials
exists.
• With
Arduino
you
can
easily
explore
lots
of
small-‐
scale
sensors
and
actuators
like
motors,
temperature
sensors,
etc.
• The
possibili?es
with
Arduino
are
endeless.
2
Lab
Topics
• Overview
of
the
Arduino
PlaAorm
• Sensors
and
Actuators
Overview
• Overview
of
Temperature
Sensors
-‐ Pt-‐100,
Thermistor,
Thermocouple
• Basic
Data
Acquisi?on
(DAQ),
Data
Logging
• Calibra?on,
Uncertainty,
Resolu?on,
Accuracy,
Range,
etc.
• Lowpass
Filter
implementa?on
in
SoWware
• Network
Communica?on
• Reading
Data
sheets
Breadboard
Hardware
Arduino
UNO
Device
Tools
Mul?meter
Arduino
SoWware
Programming
with
Arduino
is
simple
and
intui?ve!
Arduino
Sketch
IDE
Example:
// include the TinkerKit library
#include <TinkerKit.h>
// creating the object 'led' that belongs to
the 'TKLed' class
TKLed led(O0);
void setup()
{
//do something here
}
void loop()
{
led.on(); // set the LED on
delay(1000); // wait for a second
led.off(); // set the LED off
delay(1000); // wait for a second
}
The syntax is similiar to C programming This program makes a LED blink
h4p://en.wikipedia.org/wiki/Sensor
h4p://en.wikipedia.org/wiki/Actuator
Sensors
CalibraDon:
A
comparison
between
measurements.
One
of
known
magnitude
or
correctness
made
or
set
with
Theory
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,
Accuracy:
How
close
the
or
any
of
several
other
names
for
the
device
being
measured
value
is
the
the
calibrated.
actual/real
value,
eg.,
±0.1
%
In
the
assignment
you
need
to
deal
with
these
parameters.
You
find
informa?on
about
these
parameters
in
the
Data
sheet
for
your
device
h4p://en.wikipedia.org/wiki/Calibra?on
h4p://en.wikipedia.org/wiki/Measurement_uncertainty
h4p://en.wikipedia.org/wiki/Accuracy_and_precision
Part
1
Arduino Basics
These
books
gives
you
an
introduc?on
to
Arduino.
These
books
are
availible
on
the
lab.
Selected
eBooks
from
Safari
Online
available
for
free
for
Students
and
Teachers
at
TUC
h4p://proquest.safaribooksonline.com/book/
hardware/arduino/9781118446430
h4p://proquest.safaribooksonline.com/
h4p://proquest.safaribooksonline.com/book/ book/hardware-‐and-‐gadgets/
hardware/arduino/9780133764147
9781449314668
Arduino
Uno
Board
Arduino
Basics
Breadboard
12
The
Arduino
Kit
Arduino
Uno
Board
14
Geeng
Started:
Explore
some
of
the
the
following
sensors/actuators;
• Arduino
with
Breadboard
– LED,
Push
Bu4on
– DC
Motor
– Temperature
– PWM/Servo-‐motor
and
DC-‐motor
– etc.
• Tinkerkit:
– LED
– Temperature
– Poten?ometer
– etc.
Part
2
Pt-‐100 Measurements
Internal
RTDwhite
Ground
Output
RTDred
RTDred
terminal
block
+24
V
L N
<<<<<<<
Cable
clamp
Pt100 element
0 V + 24 V
red
RTD
Pt100
transducer
red
24
V
PSU
Output +
Output
–
white
↓
4-‐20
mA
Output
terminals
+
1-‐5
V
output
~250
Ω
terminals
–
Important!
Test
the
output
of
your
circuit
BEFORE
connec?ng
it
to
the
Arduino
Analog
Input
with
a
Mul?meter
to
make
sure
the
voltage
is
not
higher
than
5V,
else
the
Arduino
will
be
damaged!
Create
you
own
Pt-‐100
Sensor
with
Transmi4er
Test
the
Device
using
Arduino
Temperature
TransmiSer
(0-‐100deg.
C)
Pt-‐100
h4ps://www.elfa.se/elfa3~eu_en/elfa/init.do?
item=76-‐690-‐51&toc=0&q=76-‐690-‐51
h4ps://www.elfa.se/elfa3~eu_en/elfa/init.do?
24VDC/0.25A
Power
Supply
item=76-‐895-‐74&toc=0&q=76-‐895-‐74
Breadboard
h4ps://www.elfa.se/elfa3~eu_en/elfa/init.do?item=69-‐061-‐79&toc=0&q=69-‐061-‐79
19
L N
0
V +
24
V
Important!!!
red
RTD
Pt100
transducer
red
white
↓
4-‐20
mA
+
1-‐5
V
output
~250
Ω
terminals
–
h4ps://www.sparkfun.com/products/10988
h4ps://www.elfa.se/elfa3~eu_en/elfa/init.do?item=73-‐889-‐29&toc=0&q=73-‐889-‐29
NTC Thermistor
h4ps://www.elfa.se/elfa3~eu_en/elfa/init.do?item=60-‐260-‐41&toc=0&q=60-‐260-‐41
Tutorial:
h4p://garagelab.com/profiles/blogs/tutorial-‐using-‐ntc-‐thermistors-‐with-‐arduino
21
Voltage-‐based
Sensors
According
to
the
TMP36
datasheet,
the
rela?on
of
the
output
voltage
to
the
actual
temperature
uses
this
equa?on:
TMP36
temp
in
Celsius
=
(voltage
-‐
500)
/
10
mV
Where
the
voltage
value
is
specified
in
millivolts.
However,
before
you
use
that
equa?on,
you
must
convert
the
integer
value
that
the
analogRead
func?on
returns
into
a
millivolt
value.
You
know
that
for
a
5000mV
(5V)
value
span
the
analogRead
func?on
will
return
1024
possible
values:
output
=
analogRead(aichannel)
0-‐1023
A0-‐A5
Datasheet
Calcula?ons
Theory
Linear rela?onship:
This gives:
23
TMP36
Temperature
Sensor
Example
// We'll use analog input 0 to read Temperature Data
void setup()
{
Serial.begin(9600);
}
void loop()
{
float voltage, degreesC, degreesF;
voltage = getVoltage(temperaturePin);
void setup()
{
Serial.begin(9600);
}
void loop()
{
int temperature = getTemp();
Serial.print("Temperature Value: ");
Serial.print(temperature);
Serial.println("*C");
delay(1000);
}
double getTemp()
{ Serial
Monitor
// Inputs ADC Value from Thermistor and outputs Temperature in Celsius
Temp = log(Resistance);
}
26
Part
3
With
the
Arduino
Wi-‐Fi/Ethernet
Shield,
this
library
allows
an
Arduino
board
to
connect
to
the
internet.
It
can
serve
as
either
a
server
accep?ng
incoming
connec?ons
or
a
client
making
outgoing
ones.
This
gives:
We
use
the
Euler
Backward
method:
www.temboo.com
www.temboo.com/arduino
32
Hans-‐PeSer
Halvorsen,
M.Sc.
Telemark
University
College
Faculty
of
Technology
Department
of
Electrical
Engineering,
InformaDon
Technology
and
CyberneDcs
E-‐mail:
hans.p.halvorsen@hit.no
Blog:
hSp://home.hit.no/~hansha/
33