You are on page 1of 40

How to make your first

Robot
By Frits fritsl Lyneborg
http://letsmakerobots.com/user/
!"F by #$ster
Fin% out more on:
http://letsmakerobots.com/
2
&ontents !age
'.
(.
). *ntro%uction
. Before you start
+. How to start
,. *tems nee%e% - !*&#./
0. *tems nee%e% - 1otor "ri2er
3. *tems nee%e% - 4er2o
5. *tems nee%e% - 4ensor
'6. *tems nee%e% - 1otors
''. *tems nee%e% - 7ther *tems
'(. 8etting 4tarte%
'). 4ticking 9ogether
'. 9he Brains
'+. !ro$ect Boar%
',. !ro$ect Boar% (
'0. 1otors
'3. 4er2o
'5. 4ensor
(6. Let there be Life
('. 4etting the 4ensor
((. Fully Built
(). 4tarting to !rogram
(. !rogramming
(+. 4ample &o%e
(,. 4ample &o%e - continue%
(0. #%% some /:tras
(3. How to fin% !ica:e manuals
(5. (3 pin !ro$ect Boar% ;#./6(6<= !ica:e for %ummies
)6. 8roun%>
)'. ?
)(. ?' @ ?(
)). !ower on the boar%
). !eripherals
)+. #= B= &
),. "= /= F
)0. 8= H
)3. 4omething ;slightly< interesting...
)5. How to connect 4RF6+ to pica:e (3 pin pro$ect boar%
6. 4RF6+ &o%e
3
*ntro%uction
9ime to buil%: ( hours
ARL to more information:
http://2i%eo.google.com/googleplayer.swfB%oc*...
&ost to buil%: C3+
#ctuators / output %e2ices: ( geare% motors
&!A: !ica:e
!ower source: ## batteries
!rogramming language: !ica:e basic
4ensors / input %e2ices: 4harp *R
9arget en2ironment: in%oor
This project requires no knowledge of electronics, and it will not get much into that, it will
only start you up with a robot really fast.
It is based on a system called Picaxe that is really simple yet powerful.
If you know that you want to get more into the electronics part of building, spend more time
on learning, and use the system called Arduino, you should
check out this irst robot!project that uses Arduino and a breadboard.
4
Before you 4tart
Welcome. before we get started, here are some things you should know:
For your own sake= rea% this before you go any further
*f you are looking for an e2en cheaper an% faster pro$ect= this one might ha2e your
interest: http://letsmakerobots.com/no%e/30
*f you ha2e ne2er buil% a robot before= the 2i%eo here might inspire to how easy it is
to construct= you %o not nee% special materials to buil% robots:
http://letsmakerobots.com/no%e/)+
9o inspire to where you can go from here= * ha2e ma%e a part **
7D E Fow letGs get starte% :<
5
How to start
How to start a cool* robot for approx $8
9his is coolH because:

9he electronics use% are real parts ;not little homeEma%e things that wont
really work unless you spen% hours of tweaking= an% not a kit that you $ust
assemble an% thatGs it<.

*t is /#4I to %o the basics= you ha2e a robot within one hour>

Iou can e2ol2e from here= e2en with the same parts ;if you can bare to take
your robot apart<.

*t is cheap.

9his is serious= but fun. 9his is the coolest RobotEbeginnersEpro$ect in any


way= en% of story> :<
6
*tems Fee%e%
"inks are just where I happened to find the items from a world wide web
perspecti#e. $ou can use any %web& shop you'd like, of course.
Please see this page for (where to get Picaxe(
!rices are appro:. #s far as possible= try to get it all from the same shop= an% from a
shop locate% in your own countryJ to get the best %eals an% faster %eli2erance etc.
': !*&#./E(3.' 4tarter !ack
9he (3 pin pro$ect boar% in this package is like a game of 1ario BrosJ Fun an% full of e:tras
an% hi%%en features= making you want to play o2er an% again. 9his inclu%es the main brain=
the !*&#./E(3.'.
9his is a little e:pansi2e= but it is only the first time * recommen% you to get this= it inclu%es
a lot of nice basic stuff= you get a &"ER71 with lots of manuals= cables= a boar%= the
1icroprocessor etc. #ctually it is /.9R/1/LI cheap. 4imilar packages cost up to '6
times this price>
Be sure to get the A4BE2ersion= images in the shops may not match= an% show a serialE
cable when you are or%ering a A4B. Khen buying the A4BE2ersion= it is not necessary to
get the A4BEcable as an e:tra item= e2en though it is also sol% separately.
Iou can get it here
7nce you ha2e bought this one time= $ust buy a new boar% an% accomplishing 1icroE
controller for future pro$ects= much cheaper= you are a RobotEbuil%er with all the basics
%one.
7
*tems Fee%e% (
9o connect things smooth= you may also want to in2est in a lot of
female to female $umpers like these. * recommen% getting a lot= an% * recommen% it
strongly. Howe2er it is not necessary to buil% this. But they are so nice to ha2e.
!x "#$%& 'otor &ri(er
9he name says it all= more about this chip later :< Iou can get it here
8
*tems Fee%e% )
!x )*+,-. /er(o 0pgrade )ack
#n easy way to get a ser2o toppe% with some small parts nee%e% for this pro$ect.
Iou can also get any stan%ar% ser2o= the pins shown on the image= an% a single
))6 7hm resistor instea% of the yellow chip= if you shoul% wish.
Iou can get the full package here
What is a Servo?
A )er#o is a cornerstone in most robotic appliances. To put it short it is a little box
with wires to it, and an axle that can turn some *++ degrees. on this axle you can
mount a disc or some other peripheral that comes with the ser#o. The , wires are-
* for power, and one for signal. The signal!wire goes to something that controls a
ser#o, in this case that is the micro!controller .esult is that the micro!controller
can decide to where the axle should turn, and this is pretty handy/ $ou can program
something to physically mo#e to a certain position.
9
*tems Fee%e%
!x /harp 1)#&!#2 *3 /ensor 4 !!.5 6 ,nalogue
''.+L or another range will %o. 7nly %o not buy the L"igital 2ersionL of the 4harp
sensors for this kin% of pro$ect= they %o not measure %istance as the analogue ones
%oes.
Iou can get it here
Be sure to get the re%/black/white wires for it. 9his is not always inclu%e%= an% it is a
nonEstan%ar% socket>
9his is actually not a fa2ourite of mine= * usually use ultrasonic sensors= such as
the 4RF6+ ;they also sell it at the pica:eEstore where they call it 4RF66+ an% ha2e
a picture of the back of an 4RF6 in the shop> But it is the right one= an% * %i% tell
them but..<. #nywayJ 9he 4RF6+ is much more reliable an% precise. *t is also faster=
but costs a little more= is a little more complicate% to write co%e to= an% a little more
comple: to install E so it is not use% here= but if you are fresh= buy one of these
instea% J<
*f you go for the 4RF6+=
* ha2e ma%e a small walkthrough to connecting the 4RF6+ here
10
*tems Fee%e% +
#x 1ear 'otors with wheels
9he higher the ratio= the stronger robot= the lower= the faster robot. * recommen%
ratio somewhere between '(6:' to ('6:' for this kin% of pro$ect. 9he reason the
robot on the 2i%eo is so slow= is that is has a high ratio. 4lower is easier or
beginners= as it it easier to un%erstan% an% follow what happens.
!rice= total for (M(: '+ A4" Iou can get some here
11
*tems Fee%e% ,
7ou will also need:

"ouble si%e% a%hesi2e tape ;for mounting= the foamy sort is best<

4ome wire

7r%inary a%hesi2e tape ;to isolate a cable perhaps<

4imple sol%ering eNuipment ;#ny cheap kit will %o fine<

#n or%inary small nipper or scissor to cut things

# screw%ri2er
7ou could also get, while you8re at it:

4ome L/"Os if you want your robot to be able to signal to the worl% or make
cool flashingEeffects.

1ore ser2os to make your robot mo2e more..erh..armsB 7r ser2os with ser2os
on etc.

# tiny speaker if you woul% like your robot to pro%uce soun%Eeffects an%
communicate to you.

4ome sort of beltEtrack system. Robots with belt tracks are way cool as well=
an% the controller an% the rest will be the same.
Here is an e:ample to what you coul% take it to with belt tracks 9#1I*#
makes cool beltEtrackEsystems= an% this one is also a fa2orite of mine
Here is more info on beltEtracks.

#ny kin% of lineEsensorEkit= to turn your robot into a 4umo= a LineEfollower=


stop it from %ri2ing off tables= an% e2erything else that nee%s La look %ownL.
How to fin% 1anuals for the !ica:e pro%ucts
12
8etting 4tarte%
9:; 7ou ha(e ordered the stuff, recei(ed your package<s=, you want to build :=
well.. "et>s get started;
First mount the wheels to your geare% motors. #n% a%% tires ;rubber ban%s in this
case<.
#n easy way to mount stuff for fast ;an% amaPingly soli% an% lasting< robots is
%ouble a%hesi2e tape.
13
4ticking 9ogether
*nsert the batteries= so you ha2e a realistic i%ea of weight an% balance. #%% some
%ouble a%hesi2e tape to the button of the ser2er as well..
&hose your own %esign= you can also a%% e:tra materials if my %esign is too
simple.
1ain thing is that we ha2e it all glue% together: Batteries= 4er2o an% wheels. #n%
wheels an% ser2o can turn freely= an% it can stan% on itGs wheels somehow=
balancing or not.
14
9he Brains
9ake out the batteries= to a2oi% burning something uninten%e%>
#n% now for the brains. Iou shoul% ha2e a pro$ect boar% similar to this.
;an% so this may be of interest to you: http://letsmakerobots.com/no%e/0+<
Fotice that it has a chip in it. 9ake it out. 9he chip is a "arlingtonE%ri2er that is Nuite
han%y place% there on the boar%= but we will not nee% it for this pro$ect= an% we
nee% itGs space= so away with that chip> *t is easiest to get chips out of the socket
by inserting a normal flat screw%ri2er $ust below it= mo2e it in= an% tip up the chip
carefully.
15
!ro$ect Boar%
# chip fresh= bran% new chip usually %o not fit into a socket right away. Iou will
ha2e to press it si%eways %own on a table= to ben% all the legs in an angle so it will
fit. ;Legs go %own= into the sockets<.
1ake sure all the legs are in the sockets. *f you bought the 4er2o upgra%e from
!ica:e= you ha2e a yellow chip. !ut it in place of the "arlington. Fote that not all
holes in the pro$ect boar% are fille% out with the yellow chip. Ke only nee% the eight
to the right in the picture= as this is $ust simple resistors= we %o not nee% to fee%
them e:tra.
9his yellow chip is actually $ust 3 H ))6 7hmOs resistors in a neat package. #n%
so= if you shoul% ha2e a resistor= you can $ust insert it instea% in slot numbere%
6= as this is the only one we will use= when we only use one ser2o.
#lso insert the large chip= the brains= the microE
controller= the !ica:e (3;2ersion number< into
the pro$ect boar%.
*mportant to turn this the right way. Fote that
there is a little mark in one en%= an% so on the
boar%. 9hese must go together.
9his chip will get power from the boar% 2ia ( of
its legs.
#ll the remaining (, legs are connecte% aroun%
on the boar%= an% they will be programmable for
you= so you can sen% current in an% out to %etect
things an% control things with the programs you
uploa% into this microEcontroller
16
!ro$ect Boar% (
Fow insert the L(5)" motorEcontroller.
9his will take of the outputs from the microEcontroller= an% turn them into (.
4oun%s sillyB Kell.. #ny or%inary output from the microEcontroller can only be on
or off. 4o $ust using these woul% ;e:ample< only make your robot able to %ri2e
forwar% or stop. Fot re2erse> 9hat may come in unhan%y when facing a wall.
9he boar% is ma%e so smart that the ( ;now re2ersible< outputs get their own space=
marke% ;#< an% ;B< $ust ne:t to the motorEcontroller ;Bottom right on the picture<.
1ore about this later.
7n the backsi%e of the boar% you may fin% some strange plastic. 9his has no
use= it is $ust a lefto2er from manufacturing. ;9hey %ip the boar% in warm tin=
an% parts they %o not want so get tinne% is seale% with this stuff< Qust peal it off
when you nee% the holes they seal.
17
1otors
9ake pieces of wire= an% sol%er them to the # @ B E holes. ;or use some other
means of connecting cables to the stan%ar% siPe% holes= one can buy all sorts of
stan%ar% sockets an% pins etc.<
*f you ha2e some of that heatEshrinking plastic or some tape= it may be a goo%
i%ea to support the wires with this.
9he ( # goes to one motor= an% the ( B to the other. *t %oes not matter which
is which= as long as # is connecte% to one motor= an% B to the two poles of the
other.
18
4er2o
Fow letGs hook up the ser2o.
*f you shoul% rea% the !ica:e %ocumentation= you will rea% that you shoul% use (
%ifferent powerEsources if you a%% ser2os. 9o put it shortJ Ke %onGt min% here= this is
a simple robot= an% to my e:perience this works $ust fine.
Iou will nee% so sol%er an e:tra pin to output 6= if you want to use the stan%ar%
ser2o connection. 4uch a pin comes with the !ica:e upgra%e pack ;a whole row=
actually<= but you only nee% one for one ser2o= an% they can be bought in any
electronics store.
*f your ser2os cable is ;Black= Re%= Khite< or ;Black= Re%= Iellow<= the Black shoul%
be to the e%ge of the boar%. 1ine was ;Brown= Re%= 7range<= an% so the brown
goes to the e%ge.
9he hint is usually the Re%J *t is what is referre% to as ?= or any of these= use% in
ran%om: ;?= ?M= M= '<. 9his is where current comes from.
9he black ;or brown in my case< is 8= or ;8= 6 or E<. 9his is also known as
8roun%= an% is where current goes to. ;the ( poles= remember your physicsE
lessonsB<
9he last colour is then the signal ;Khite= Iellow or 7range<
# ser2o nee%s both LM @ EL or L? @ 8L= an% a signal.
4ome other %e2ices may only nee% L8roun%L an% L4ignalL ;8 @ ?<= an% some may
both nee% ?= 8= *nput an% output. &an be confusing in the beginning= an% e2erything
is always name% %ifferent ;like * $ust %i% here<= but after a while you will get the logic=
an% it is actually e:tremely simple E /2en * get it now J<
19
4ensor
Fow letGs hook up the hea%= the 4harp *REsensor.
;*f you bought an 4RF66+ or similar instea%= you shoul%
look here on how to hook this up= it is %ifferent from this><
9here are a million ways to %o this= but here are clues:

Re% nee%s to be connecte% to ?'= that is ;in this setup< anything marke% ?=
or is connecte% to this.

Black goes to 8= anywhere on the boar%.

Khite is to be connecte% to #nalogue input '.


*f you rea% the %ocumentation that comes with the pro$ectEboar%= you can rea% how
to attach the accompanying ribbonEcable= an% use this.
Khat * ha2e %one on the picture= is to cut off a cable from an ol% burne% out ser2o=
sol%ere% in a pin= an% connecte% the whole thing $ust as a ser2o. Iou can use it to
see which colours of the 4harp goes to which row on the boar%.
Keather you use the ribbons or my metho% of connecting the 4harp *R= you
shoul% also connect the ) remaining analogue input to ?. * ha% some $umpers
laying= an% you can see that all ) connections left are short cut. ;9he last pair= not
touche%= are $ust two 8roun%= no nee% to short cut these<. *f you use the ribbon=
you can $ust connect the inputs to ? ;or groun% for that matter< by connecting the
wires in pairs.
9he reason it is important to shortcut the unuse% analogue inputs here is that the
are left floating. 9his means that you will get all sorts of weir% rea%ings where you
try to rea% if these are not connecte%. ;to put it short= this is a fast pace%
walkthrough J<
20
Let there be Life
Fow for some fun> ;7r LLet there be lifeL<
4omehow you shoul% get the Re% wire from your batteries ;M< hooke% up to the re%
wire on the pro$ect boar% ;?<. #n% the black ;E< to ;8<. How you %o this %epen%s on
your eNuipment. *f there is a batteryEclip on both batteries an% boar% you shoul% still
make sure that the LML from the batteries en%s up to the L?L on the boar%.
4ometimes ;though not often< the clips can be re2erse% to each other= an% $ust
putting two matching clips together is no guarantee that M gets to ? an% E gets to 8>
1ake sure= or you will se melting things an% smoke> "o not fee% the boar% with
more than ,? ;no 5? batteries= e2en though the clip fits<
As a note/ 0e are only working with one power!supply here. "ater you will want to
use same 1round, but both 23 and 2*. That way your chips can get one source,
and the motors etc. another %stronger& #oltage.
21
4etting the 4ensor
*nstall the !ica:e !rogramming /%itor on a !&= follow the manuals to get your
Qack / A4B / 4erial hooke% up= *nsert the batteries in your ;still hea%less< robot=
insert the $ack stick in your robot.. enter the programming e%itor= an% write ser(o 2,
!2 wait #
press F+= wait for the program to transfer= an% your ser2o gi2es a little yank ;or
spins= %epen%ing on which way it was<.
9his co%e ;ser(o 2, !2 wait #= is actually L( linesL. 4ome people ;an% some
e%itors< fin% it more correct to write it like
ser(o 2, !2 wait #
because it is actually ( comman%s. *= howe2er= like to keep same Lor%ersL in one
line= an% the !ica:e e%itor allows for this way of e%iting.
9he LKait (L is not really nee%e%= only it is :" Reason is that normally you let your
program run aroun% in loops= an% the pica:e Lstays ali2eL. Howe2er here= in the
testing phase= your program reaches the en%= an% stops.
9his makes the !ica:e e:ecute an Len%L comman%= an% this makes the ser2oE
comman% stop before it really got to %o much= as it happens $ust after the ser2oE
comman%. #n% the ser2o nee%s continuously to be fe% the pulse from the !ica:e= or
else it will %o nothing= it has no brains.
9herefore= $ust for now= you nee% to tell the !ica:e to wait in ( secon%s.. or
something.. so it will sen% out signals to the ser2o B/F7R/ it shuts itself %own :<
All this "wait 2" is actually added later to this post, as there has been some
changes in the Picaxe's that made it necessary
Something else that has happened since ! originally wrote this tutorial is, that
a new command has been introduced, and you should read the manual and
loo" #or the command "servopos" $ it solves many problems that you might
bump into
*f something goes wrong here= you nee% to mess with the manuals an% ports= power
supply etc.= until no errors are reporte%= an% all seems to work= 9o test= try to write
ser(o 2, #22 wait #
an% press F+ 9he ser2os %isc shoul% spin a little an% stop. 9o get back= write:
ser(o 2, !2 wait # an% press F+ Fow your robotOs neck is facing forwar%. 4tick
on the hea% E the 4harp *R
22
Fully Built
Hello worl%= * am a robot= rea%y to take your comman%s an% e:plore the worl% :<
IouOre %one buil%ing the basics>
9he %esign may wary= you may ha2e use% other parts etc.. But if you ha2e
connecte% as %escribe%= on the ne:t page are some tips to get starte%
programming your robot.
23
4tarting to !rogram
/nter ;copyEpaste< this co%e into your e%itor= an% press F+ while the robot is
connecte%:
MMM
main: readadc !, b! 8 takes the (oltage returned to analogue pin !, and puts it
into (ariable b! debug 8 this draws out all (ariables to the editor.
goto main
MMM
Fow take your han% in front of the robotGs hea% an% notice how the 2ariable b'
changes 2alue. Iou can use the knowle%ge gaine% to %eci%e what shoul% happen
when ;how close things shoul% get before..<
Fow * a%2ise you to put your robot up on a matchbo: or similar= as the wheels will
start turning.
/nter ;copyEpaste< this co%e into your e%itor= an% press F+ while the robot is
connecte%:
MMM
high ?
low
MMM
7ne of the wheels shoul% turn in one %irection. "oes your wheels turn forwar%B *f
so= this is the instruction for that wheel to turn forwar%.
*f the wheel is turning backwar%s= you can try this:
MMM
low ?
high
MMM
24
!rogramming...
9o turn the other wheel= you nee% to enter:
MMM
high @
low A
MMM
;or the other way aroun% for opposite %irection.<
9he ser2o you ha2e alrea%y trie%.
#ll the way to one si%e is:
ser(o 2, A wait #
the other si%e is:
ser(o !, ## wait #
E an% centre:
ser(o !, !2 wait #
7n the ne:t page is a small program that will ;shoul%= if all is well= an% you insert the
right parameters for high/low to suit your wiring to the motors< make the robot %ri2e
aroun%= stop in front of things= look to each si%e to %eci%e which is the best= turn that
way= an% %ri2e towar%s new a%2entures.
25
MMM
/ymbol dangerle(el B A2 ' how far away should thing be, before we react4
symbol turn B %22 ' this sets how much should be turned
symbol ser(oCturn B A22 ' This sets for how long time we should wait for the ser#o to
turn %depending on it5s speed& before we measure distance
main: ' the main loop
readadc !, b! ' read how much distance ahead
if b! D dangerle(el then
gosub nodanger ' if nothing ahead, dri#e forward
else
gosub whichway ' if obstacle ahead then decide which way is better
end if
goto main ' this ends the loop, the rest are only sub!routines
nodanger:' this should be your combination to make the robot dri#e forward, these you
most likely need to adjust to fit the way you ha#e wired your robots motors
high : high @ : low ? : low A
return
whichway:
gosub totalhalt ' first stop6
' "ook one way-
gosub lturn ' look to one side
pause ser(oCturn ' wait for the ser#o to be finished turning
readadc !, b!
gosub totalhalt
' "ook the other way-
gosub rturn ' look to another side
pause ser(oCturn ' wait for the ser#o to be finished turning
readadc !, b#
gosub totalhalt
' 7ecide which is the better way-
if b!Db# then
gosub bodyClturn
else
gosub bodyCrturn
end if
return
' 8 next page
26
' 8 continued
bodyClturn:
high @ : low : low A : high ? ' this should be your combination that turns the
robot one way
pause turn : gosub totalhalt
return
bodyCrturn:
high : low @ : low ? : high A ' this should be your combination that turns the robot
the other way
pause turn : gosub totalhalt
return
rturn:
ser(o 2, !22 ' look to one side
return
lturn:
ser(o 2, #22 ' look to the other side
return
totalhalt:
low ? : low : low @ : low A ' low on all 9 halts the robot6
ser(o 2,!2 ' face forward
wait ! ' free:e all for one second
return
MMM
Kith some cle2er programming an% tweaking= you can make the robot %ri2e= turn its
hea%= make %ecisions= make small a%$ustments= turn towar%s interesting holes
such as %oorways= all working at the same time= while %ri2ing. *t looks pretty cool if
you make the robot spin while the hea% is turning J<
Look in part ** for co%e on this.
27
#%% some /:tras
4oun%:
Iou can also a%% a small speaker to e:ample pin ' @ groun%= an% write
/ound !, <!22, =
E or within the e:ample program abo2e make it
/ound !, <b!,=
- to get funny soun%s %epen%ing on the %istance to ob$ects ahea%.
Iou coul% also attach a lamp or L/" to pin ( @ groun%= an% write ;remember L/"Gs
nee% to turn the right way aroun%<
High #
to turn on the lamp= an%
"ow #
to turn it off J<
E How about a LaserEpen= mounte% on an e:tra ser2oB 9hen you coul% make the
robot turn the laser aroun%= an% turn it on an% off= pointing out places.. you can %o
anything now :<
Welcome to a (ery funny world of home4made robots, there are thousands of
sensors and actuators Eust waiting for you to hook them up and make robots
out of them :=
Remember to share with us what you ha2e ma%e= or perhaps is struggling to make=
what you learn etc. :<
Iou can also take a look here: !art ** if you ha2e e2en rea% this far J<
28
How to find )icaxe 'anuals
* think !ica:e is a great pro%uct.
But somebo%y shoul% kick their web %epartment. 4ometimes people buy a !ica:e
pro%uct in another shop= an% %o not get the manual on print. LFin% it on the webL..
yes= but whereB 9hey ha2e a really crap web at !ica:e= a mi: of info= links an%
ARLOs not really well ma%e at all
* 7F9/F get Nuestions about the manuals= so something is wrong>
Fhis is the way * go about it, it could be done simpler with more direct links,
but here is how * tend to do it, because * can remember this, * Eust ha(e to
remember step !, and the rest comes naturally to me after many (isits:
pica:e.co.uk ER 9op menu= L"#9#4H//94L
1ain thing isJ *t is all 2ery well %ocumente%= it is sometimes 2ery har% to fin%= but it
is there= from the page pica:e.co.uk :<
#nyhow E that is the manuals for the boar%s= chips etc. 4omething else that you
want E this is 2ery important:
)icaxe main manuals:
/ection ! 4 1etting /tarted
/ection # 4 G,/*+ +ommands
/ection % 4 *nterfacing circuits
4pecially 4ection ( E that is your frien% in the e2ery%ay work with !ica:e.
29
#8 pin )roEect Goard <,-.2#2=, )icaxe for dummies
30
8roun%>
9ften you get something that you want to connect, and the documentation
says connect this to 51round5, or any other name often used in random. *t
has many names, that are the same thing:

8roun%

Asually Lthe black wireL if there is a re% an% a black

8F"

?ee

?ss

Fegati2e 4upply
E #ll the same>
9his is simply where current goes to when it comes from the other pole on the
battery ;the positi2e= M<.
Khen something can be connecte% to your boar% using L$ust a single wireL= it
always also has to ha2e a secon% wire= connecte% to this groun%.
*f you want to hook up to groun%= you can use any of these connections on the
boar%:
31
?
#lso referre% to in ran%om as :

!ositi2e supply

Lthe re% wireL

&urrent

!ower

?&&

?M

BM

?""
#ctually the reason for ha2ing a 1icroEcontroller on a boar% is= that you shoul% let
the microEcontroller control when you sen% current to something ;turn it on or off<.
Howe2er= Nuite often= you will nee% to fee% peripherals with current ;an% groun%= this
goes unsai%<= on top of what you sen% to it 2ia the microEcontroller
!erhaps you are connecting a 4harp *R range fin%er= it has ) wires: Black= Khite
an% Re%. 9he black is 8roun%. 9he Re% then will be ?= to power the mo%ule= an%
the white will be a signal returning from the 4harp mo%ule to the microEcontroller on
your boar%.
!erhaps you want to control a 4er2o. 9hat will also nee% a 8 an% a ? to power itGs
circuit an% its motor. #n% on top of this= it nee%s a pulseEsignal from the microE
controller= the last wire E what colour it may be on the particular mo%el.
9he stan%ar% setup of the boar% looks like this= all these areas are ?:
32
?' @ ?(
/o 4 what>s with the H! 6 H#I
Kell= e2erything returns to groun%. But it can come from %ifferent sources. #n% they
can ha2e %ifferent 2oltage.
9his way you can power a ser2o with ?(= while the pulses that signals to the ser2o
where it shoul% turn to= is from the 1icroEcontroller that runs on ?'. #ll to the same
8.
9his (3 pin !ro$ect Boar% has ( options:
/tandard: 4ee illustration abo2e. ?' @ ?( are connecte%= result: 9here is only one
?. #s you may ha2e rea% from the %ocumentation: *t is the little $umper in the corner
that connects ?' @ ?(= an% when it is on= there is only ? @ 8 on the boar%.
# power supplies: 4ee illustration below. 9ake off the $umper= an% connect a
separate powerEsupply to ?( ;an% that power supplies 8 to groun%= goes unsai%
from now J< E an% the boar% will ha2e ?' to the circuits an% inputs= ?( to power
e:ternal stuff= an% 8 for all of it.
9hat way you can fee% the chips with +?= an% the motors with '(? that woul%
otherwise kill the chips.
33
!ower on the Boar%
/o if you hook up a board with # power4supplies, this is where you ha(e
current and ground:
34
!eripherals
.. Khat is leftB
7nly the interesting stuff> :<
!ower they nee%= the peripherals.. But it is the inputs an% outputs that are
interesting.
Fone of the abo2e connections can be controlle% by the 1icroEcontroller= an% unless
you burn something= the 1icroEcontroller %oes not sense weather you connect
something to these or not.
9his is where the inputOs an% outputs come into the picture:
9hese connect to the 1icroEcontrollers legs. Suite often= for a%2ance% usage=
things can be altere%J #n input can be switche% in mo%e= so that it is an output
etc. But you will figure that out= this is $ust the basics= as things are wire% in
%efault.
35
#= B= &
,: Fhe digital inputs:
&onnect a switch to ?' an% one of these. *n the program e%itor you can then write
;letOs say you ha2e connecte% to leg = there are 3 in this area<
If pin9 ; 3 then
...
G: Fhe analogue inputs
How much current from ?' ;or another source not more powerful then ?'< comes to
this pinB
Kell E it is not a Nuestion i ask= but what the pin asks :<
9he answer is then returne% into a 2ariable= e:ample= pin ( out of the in this area:
readadc *, b3
Fow the 2ariable b' is a 2alue between 6E(++= %epen%ing on how much current
from ?' ;or another source not more powerful then ?'< comes to this pin.
+: Fhe *34area
9his is a Nuite un%ocumente% feature on the boar%> *t is use% if you want to use
stan%ar% 9?Eremote controlEprotocols to sen% to your microEcontroller
Iou can hook up *R insEan% out to anything= to measure *R= for instance to see if
something is near or far= or white or black.. but you will ha2e to %o with analogue
le2els of signal an% similar= you will not be able to transmit LsignalsL that can be
translate% to numbers such as 9? remotes %oes. 1ost *R remote controls use )3
DHP subEcarrier= an% this area letGs you hook up to that Nuite simply. Iou shoul% only
use it for that>
36
"= /= F
&: Fhe /erial communication
9he sNuare on the picture shoul% perhaps inclu%e the $ack socket :< 9his is the serial
connection use% to program an% more.
Iou can also use outputE an% %igital input pins for serial connection= but the ones on
" are har%Ewire%
.: &irect outputs from the picaxe
9hese shoul% ;only< be use% if you are trying to communicate Lchip to chipL. * think
this is calle% 99LEle2el= where you let the chips talk to each other 2ia pulses. 9his
shoul% not be use% to %ri2e anything= but it shoul% always be use% if you want your
chip to talk to others= like in this e:ample:
http://letsmakerobots.com/no%e/,,
J: 9utput pins
9hese are what you shoul% start with= *1H7: &onnect a L/" or something
;Remember L/"Gs shoul% turn the right way aroun%< to one of these ;other L/"Eleg
to groun%<.. letGs say you connect to leg ) out of the 3 in this area. Krite:
high ,
to turn power on
low ,
to turn it off
Fote that if you are using a motor controller= you shoul% not use leg = += , an% 0 for
anything else>
9hese pins are also use% for stan%ar% ser2o connection.
37
8= H
1: 'otor connections , K G
9he boar% is ma%e for the typical applications= an% one is where you want to control
( motors= an% being able to switch %irections on them.
7f course if you only can turn things on or off= it can be har% to re2erse a motor.
Iou can purchase a L(5)" motor controller E chip= an% place it in here.
9hen rea% the %ocumentation for how to make output = += , an% 0 control ( wayE
%ri2e of ( motors connecte% to # @ B outputs. ;one motor to # an% one to B= not (
times #MB<

H: Fhe reset switch
*f you mount your boar% in a case or something= an% woul% like to be able to
remoteEreset the 1icroEcontroller= a%% a switch to this= press it an%.. HelloB *
remember nothing= letGs start all o2er>
38
4omething ;slightly< interesting...
or not.
Iou will most likely only see names like ?&&= ?//= ?44 an% ?"" on chip pins. *f
you see ?&& an% ?// it means that the chip is ma%e out of bipolar $unction
transistors ;aka BQ9s< an% if you see ?44 an% ?"" it means that the chip is ma%e
out of metalEo:i%e Esemicon%uctor fiel% effect transistors ;aka 174F/9s<.
?&& means L?oltage at the collector pin of a BQ9L
?// means L?oltage at the emitter pin of a BQ9L
?44 means L?oltage at the source pin of a 174F/9L
?"" means L?oltage at the %rain pin of a 174F/9L
* know Frits wonOt really care about that information :E<
By $ip
39
How to connect /3J2 to )icaxe #8 pin )roEect board
03" to more information:
http:66www.re(4ed.co.uk6docs6srf22.pdf
4ensors / input %e2ices: 4RF6+
&escription:
*f you are a newbie= you may only ha2e learne% that the !ica:e (3 pin !ro$ect
Boar% has some inputs an% outputs.. #n% you may ha2e purchase% an 4RF6+
;that !ica:e refers to as 4RF66+<= an% you are trying to connect the %arn thing..
without resultB
Reason is likely to be that you are connecting the output from the !ica:e to the
4RF6+ through the %arlington on the boar%.
9he 4RF6+ nee%s ;like many other things< a !ulseEsignal= not $ust a Lpower on /
offL. 9he signal therefore must come %irectly from the !ica:e chip.
Luckily the boar% has little Lhi%%enL holes for that kin% of connections. ;Blue wire=
the signal in to the 4RF6+ %irectly from the chip<. 9hese holes= howe2er= are not
%escribe%= simply omitte% in the manual for the boar%. 4o * won%er how a newbie
shoul% e2er fin% out= personally * burne% a 4RF6+ or two in my frustrate%
attempts to get it right :<
*f you follow the illustration abo2e= you shoul% be able to make the below co%e
work $ust fine. Iou will know that the 4RF6+ is getting a pulseEsignal when the
little re% L/" on itGs back is flashing re%.
40
4RF6+ &o%e
HHHH
symbol trig B % < 7efine output pin for Trigger pulse
symbol echo B @ < 7efine input pin for =cho pulse
symbol range B w! < 3> bit word #ariable for range
main:
pulsout trig,# < produce *+u) trigger pulse %must be minimum of 3+u)&
pulsin echo,!,range < measures the range in 3+u) steps
pause !2 < recharge period after ranging completes
< now con#ert range to cm %di#ide by ?.@& or inches %di#ide by 39.@&
< as picaxe cannot use ?.@, multiply by 3+ then di#ide by ?@ instead
let range B range * !2 6 8 < multiply by 3+ then di#ide by ?@
debug range < display range #ia debug command
goto main < and around fore#er
HHHH
Lotes:
* %i% not ha2e a fresh 4RF6+= an% so there are %rille% e:tra holes an% sol%ere% pins
on the one on the picture.
Be aware that if you also connect ser2o;s< to the same !ica:e chip= program
e:ecution may be bumpy with little irregular breaks when using things as the 4FR6+
that nee%s pulses. *f it is important for you to ha2e a stea%y program e:ecution= or if
a ser2o acts totally irrational= it sometimes helps to ha2e a small pause or turn off a
ser2os pulse for a short time in the co%e:
Llow )L or Lpause '6L. #pparently there is no system= it is $ust trial an% error with
your particular setup.
9his pages might ha2e your interest: 4ee what Robot 4ees

You might also like