Tip:
Highlight text to annotate it
X
OK
Introduction
to Arduino
given for the atlanta hobby robotics club
by Ted Sommers in Dec.
2012
topics i'll be covering
are powering the Arduino
connecting devices to the Arduino
installing the integrated development environment
IDE
and an introduction to coding in the IDE
and using libraries
powering Arduino
OK, here is our
standard Arduino, the UNO
this is the power jack
2.1 mm jack
use a STD 2.1 9-12V wall-wart
and this is the power header
missus comes in the end of the power hitter and we're looking at uh... v ten
and
dispute and can take anywhere from six to twelve volts
excuse me
six to twenty volts
and regret your conditions
and
that's not gonna be found on a robot
irobot
you're really kind of one shoot for
nine
and a half twelve volts
closer to twelve
is better
because on a robust
uh...
if you go below
nine point five volts you're really
running in a danger of browning out
hw were
microcontroller to go over twelve alts
here hinting jer of
overheating
power converter on the arduino
kehta five old pin jews and count
in this condition propelling it from the end
than the five office in out
and putting power to do and that is exactly the same as using that
two point one millimeter
uh...
barrel connector
kenneth three point three vol ten
his also an out
now though
bible and has a maximum of two hundred milligrams
of current
coming out of g_e_'s anymore than that you were endangering
the power supply on you're going to
and the three point three has much worse
current available you can only
put an aspirin with fifty million units
out of three point three
out
now the mega territory no matter which is a different version of the arduino
than an hour
it's a much bigger
beef year arduino
it has four five or ten std each one of those pants
can
uh... support two hundred
million to get a maximum of
eight hundred million appts
uh... issues all four
uh... parents
uh... five opens on hum agar
okay now if you want to power the arduino for through the five o_ ten
report
when we were talking about here we were using the n_
the five all doesn't count
but you can use the final pan has an in on the path to power
but in this case your finals
must be regulated
and another words
that five bolts has got to be
dairy
very steady near you wanting revel in it he don't want to go down you want to cut
up
community variation or you want him very very content very steady five adults
which means it's coming from some sort of regulator
well i a good example of that quick easy if you have a motor controller that
happens
a battery eliminator certifiable battery eliminator circuit that's at five oh and
it's very regulated out so that would be a good way to
put your batteries to you or
motor controller and then use motor controller to give a regulated five old
town
to your
in this case should still be able to use
but the three point revolt out
has an out homely you cannot use three point three essendon
and you still have a two millionth
maxwell now put on that
uh... three point three
report ten
now
summer plans have a name
crowed
there in our campaign and that you might see an odd when you know pro or pro or
do we know
the we have this
five or ten they did not have the fee and ten
they don't have onboard regulator
and that's why they're perot's because you get into your to know what you hear
from understand
what it takes to give a regulated five all
uh... power to the smoker control
and wanting to get a remember about and this five oh
penance man
is this is telling the microcontroller almost directly their spirit little
filtering hair
so if you do revolt
uh... you completely damaged my car control
okay tracking devices too
p
hardware
okay this
group of parents here
is
the digital header
his both input and amp
and how you can figure these pens and software
and here's your typical device that you might want to
give a difficult n
to know that we know it's a
itself aside came detector
toned will measure of distance using
senate
it sends out a sound polls and then
here's their fortunes hound polls that measures the time difference
well you can actually measure the kind of janet reno
and that gives you
the time-of-flight for that sound which gives you the distance
um...
and this
pictures actually picked recap right off of her life this website
and there's something wrong with this and i have to see this quite a bit
when you connect an external doors here or do we know access from here
getting a five oh out
to power in the center
you want to put it
point one mike referred capacitor
uh... ceramic
across those
tends
this
keeps
any
uh... mores any
the sensor from going back into your banker patrol
and remember that
circuit is power in your
the microchip
on your microcontroller
so any sort of reports for example
when that pain
centered generates that
that samples
that could create a small brown out modifiable rail
and that could cause a burning out project
so
definitely whenever you can't anything you want to isolate it and there's many
articles out there about how tight properly actually components from one
another and i'll definitely recommend you google
isolating
electrical components from hardly know or
shin shinto
apply get information about that and there's lots to learn
um...
okay
we're now in it
lookit connecting analog devices this is
the analog in
and that's all use these pens for remember
these pins
were both end handout traditional
for analog n that's all these pens do they do not do any longer
but i can also functions digital pens
if you can figure in that way most of the pens can be reconfigured as digital
pens but
to hear your catalog cuts
and here's more divisive he would typically
tractor nor do we know
p
uh... char by or it censored is the same thing the pensacola since her disability
uses infrared light instead of sound
uh...
it's a little more accurate
and it's a little fast recon you can get more
data from this
uh... more reading spur second with the stories
uh... and
if you'll note and this is another diagram i got off the internet
chilean unexpected ending
just like the king center diagram and i got off tenet
and it's missing something
the spins
we're you're getting the power from
really need
appoint one micro for the past arron isolate
sharp iris answer from the air cleaner
and then it's that's really important which i prefer priore
that kelly deal it's a very bright l_e_d_ that is pulsing as turning on and
off
rapidly and it creates it tremendous amount
of noise on
the five or three oh and i have had the sensors reset my microcontroller because
of it
and if you read
the manufacturer specs for this requires three actually tells you to put
capacitor fine
okay
connecting devices
a key to the digital pens in the four allele
catalog is hidden inside and we've covered a lot
yahoo account
that's on the digital pens
he sees little squiggly
next to the number
on each of these tents
that denotes that that pin can be used has command along
out
get addition to being used as digital input output
and
that's hope that they didn't offer in your setup routine
when you write your program you can figure uh... twenty-year stipend
so these are
digital and did it go up
and their analog
there's more
these ditional pants down here
call so you're a squirt sea lions
these pants down here
creeper serialize
so
that's a lot of doubleday lookit ten number three
puts additional in
disallowed
analog out
and and i squared sees line
symbolize going on telling when it's really a
it's not
truong qt it's a simulated in a long cold
polls mantra lady bandwidth
uh...
which basically means
det
the here sonya actually a square wave out
and your modulating how much time you spend
uh... versus how much time you step down what's gonna complicated how it works
but for most of us is will see it as an analytical
uh... look up your viewing and if you want to know more
um...
and style your can use text how many of each pen type you have another words if
you need thirty digital parents
you won't have anything left over for analog
you know anything left over four serial horace great city
um... you really mona texas into town you're buying
microcontroller because it might say it has civilians can attend somebody that
can attend
but it might make it really apparent that some these kinds of black you can
use in the same time you can't
you can't have thirty neutral pins
and all the elephants lions by her country
once once you dedicated ip and said digital n
he can't also use it as an analog out
hit you know once you've
use it as a once for a purpose you you're stuck with that
uh...
okay
destroying your are doing
you can never do any of these
connect ido
the u_n_ five volt
or the three point three four
tends to record a gram
had ripped the wires u
he described wire stray from one of those pins to grant it
if you do that
you'll get too much current
you'll go past that
the current limit
uh... and two you will overheat component and you let smoke out
first you put a comma meaning resistor in there
um... never connect and high okay then
directly to reach other for example if one tennis high and the other pencil o
effectively connected hike to a ground
and and again you're going to
silk too much current
saying you're going to destroy
the pens are best for the microphone world together
uh... you've never overvoltage
uh... any of the i opened the score
the five oh four three point revolt pins if u
had to do you
will destroy ten more of the entire mike controller
uh...
reverse polarity on the bien
five olp poor three points people pens believe they are not territory now is
not reverse voltage protected
so
be very careful
the key controversial
uh... and like thirty said we have a two hundred
million current
limit for the five o_ randall
and make sure you never hear over that
uh... never draw more than forty millions from any kind of put penned in
which the digital out of the embargo
never went over
uh... twenty it's recommended through it and went over twenty
hum
now and researching all these
never dues
came across this hard we know clone
called the road adriana
which is that predator catster com
and did actually protects hw from every single one of these
if has reverse
voltage protection
has overvoltage protection
uh... and it does all of us with fuses
and not with um...
um...
full-page protection circuitry
diodes
uh...
okay installing the i_d_
uh...
first you wanna download the haiti's moved the ideas stricken the integrated
development that's where you were in order to it
its tactics that are cyclic
and you're going to download that from arduino cc has great website
great website
uh...
copies of
file structure
you're going to send him like a zip file and you know when unzip that-and put the
file structure junior programs directory
and of course i'm talking windows
uh...
can accurately no to a usb port
and wonders why she for the driver
point the wind power windows to the driver
uh...
that's in the driver's folder in that
uh... structure folder structure that you copy to the programs for
there's a driver folder and
sits in the driver for your art we know is in there
when you're done
well my point
and you need to run the arduino
haiti
which is
they're going to be xy
um...
this will create territory no folder in my documents
and that's world who is going to go
know you need to create a folder called libraries and it is case sensitive it's
lower payscale
unique reside in that art we know for that
they are doing a environment is created
dunno why doesn't create newer versions might use one point no
uh... a newer version maybe it creates that
uh...
but when i did not
and that's where all but why burris give this to you act
becomes a lot of our trip part libraries are installed of those her in the
program folder
the ones that you
gallatin at all in work creature self-fulfilling that libraries for
torch will end up with honor my documents
is hardware folder
the heard we know
pagey
world create
and for you in the annual create that libraries folder
and your code cousin the fullerton folders underneath are going to cure
temperature could directly in the yard were helpful here you'll create a folder
with two project name
project name needs have no spaces spasm and cancer or the number
so yeah played a very
almost dos family name
for your heart we know
application folder and then in that for you if that's where yoko
and like this it's libraries that you're a torrent organized labor's or
and now
once you open the i_d_
do you
when you have to
there's justice ever changing i have to have one is this an interesting
and this is where your sector gets things like
telling the arduino weather report is going to be additional port or
an analog porter whether it's communion quitter in output
uh... wetzel so we might
uh... initialize
uh... objects
and libraries like for example during serial communication you need to
initialize serial object n
set moderate
and then the other stewert uh... switching that you must have is the loop
and this is where your main code to try to go this loop runs repeatedly every
cycle this runs
he must have these functions assist met their minimum no
these two functions
uh... before these two functions is where you put your library includes
annual global variables
and
act for the two front runners is where you could turn toward
downgraded to a simple blind follower
uh...
example
and we're going to use here doing omega
we're going to use the pool
uh...
king right
the motor controller
which controls small motors using cereal
um...
and we're going to use
tail wind sensor
too
and so on
so our corrode we would want to and including
for the motor controller because
pose nice enough to publish a library
allows you to he's really control here control
and we're going to
and include
for at the library that pollute
has written
align center
spend
if we do
too
the arduino dot cc webpage stairs
whole lotta of peaceful libraries there and we're going to download
and
preference the
uh... kennedy library
okay im gonna
but those at the very beginning at work uh...
and they were in a creator or
uh... global variables
uh... first which is setpoint
and the input
and the chocolate
tendencies are going to be global variables that we use
n
para p_h_d_ routine which is going to actually follow that line
and this is dark object
from the library this is k_d_ object
which we're gonna name my p i_d_
and here you can see this quote very able see input variable that very once
upon a variable
and you can see there's an ampersand in front of them and that sort of a c_-plus
pluses and that allows us to
directly access those memory locations
when we
call those when when we've set those variables we will sefton
bubbling
uh... the
five zero and two horror the initial p high-end d
uh... parameters
okay so that goes
their and we also need to
to find some global constants
uh... number sensors
uh...
timeout for
looking at the center is
twenty-five hundred
uh... with its microseconds
and
the emitter ten which is
pen that turns
the sensor on and off
is gonna be difficult ten fifty two
here we're going to create
comfy
object four
blood center
and
the first parameter is
uh...
katie
unsigned car
heredity
and that is the array where ranch where the pin numbers for teacher dissenters
three seven three fifty one
and then we have constants the
number centers the time out in the american
okay and now we're going to create the motor controller object
and those parameters power of the
pins
for the market
for the voters
well
uh...
zero and one har
the uh...
the serial port
okay and we're gonna set a global variable
uh... for speed
okay now are separate team
we're going to be a serial begin
this initializes this the serial library
and sector to a poetry
of uh...
and fifteen k
and then we're gonna and nisha lies
our goal where variable called set point
and this is justices
for the p_h_d_ routine and the sect point is
value where we want the p i_d_
too
try to retain farm align center another words
when we're it
thirty four hundred
align center his the lies in the center of the sensor
and then we want to turn the key i_d_ on
so we're going to call semi-automatic which just turn steady on
an organ initialize motor object
and
now here's your
main blueprint
where we are going too
call
the wind sensor object to get from that position really load
the position on the line
at the beginning of each iteration into
the position variable
and then we're going to love
moved that
position into the global variable input
and the sense now that he's fed and person that means
as soon as we do that the kiddie routine sees it we don't have to call tidy
routine
to get to use that end
but we do need to call compute
we need to come column method upon that p_r_d_ routine the kiddie object
to computer
the output value
of the kennedy routine
and
then we need to use that output value
to control motors so now we're gonna contra call the motor object
and set the speed of each motor
forgot offset the speed given the output
coming from the kiddie pretty
and then we have a delay of twenty she's twenty miles-an-hour
which makes this loop land fifty times per second
and that's all we really need
um...
course we cannot for one more thing sp
to this program but this is the basics for example we could put a button on the
robot throughout its shortstop
i
the way it is now u
this letter to her about audit what do you know i started falling alignment
he have to grab the robot and turn it off to get stuff going on
uh...
so
uh... you never think you might want to use you might want to had some sort of a
lap counter so that you
remarked knows how many laughs that's gone it could even
time itself and store how many having sex pro it's getting prolapse
uh...
you could to some sort of auto tune in for the p_r_d_ routine there's actually
an entire library from back home they are doing ok
apart so things we can
but this is the basics really wasn't trying to teach c cost plus programming
here
and just try to give people feel
for what it's like program inside to divert the environment
and
uh... the power of using libraries yard and that's really one of our twins
biggest selling point is that there's this huge community out there which
means
tons and tons of
libraries health care
if hugh go to any electronics website and you see
uh... electrical component
an integrated circuit
there's probably already a library written for that type the part number
for that into dual and tape purdue you know
anti library
and you'll find it library for that digital compartment
sendmail
once you get them build a robot
this happens to be irobot by entered in the robot kelly
through a building
thanks for uh... watching