1、 Ulna n ven tors Ul e , , ABOUT THI S KIT The overall goal of this kit is fun. Beyond this. the aim is to gel you comfortable using a wide range of e lectronic components through small, simple and easy circuits. Th e focus is to get each circuit working then giving you the tools to figure out why.
2、If you encounter any proble ms, wanl to ask a question, or would like 10 know more about any part, extra help is only an e -mail awayhe lp o om . ABOUT OPEN SOURCE HARDW ARE All of the projects at SparkFun and .:oomlou!:. are open source. What does this mea n? t means everythin g involved in making
3、 this kit, be it this guide, 3D models, Of code is available fo r free download. But it goes further, youre also free to reproduce and modify a ny of this materiaL then distribute it for yourself. The catch? Quite simple, it is released under a Creative Commons (By Sh are Alike) license . This means
4、 you must credit .: oomlout:. in your design and share your developments in a similar manner. Wh y? We grew up learning and playing with open source software and the e xperience was good fun, we think it would be lovely if a similar experience was possible with physical things. M:Jre details on the
5、Creat ive Commons CC (By - Share Alike ) Ucense can be fou nd at http:/ard x.org/CXlJ ABOUT.: OOMLOUT :. We re a plucky little design company focu sin g on producing “de lightfully fun open source products“ Tp check pu( what we are up (p http:/www .oom louLcom ABOUT SPARKFuN SparkFun is an energetic
6、 yo ung company seeking to make electronics fun, accessible, and approachable to everyone - from kid s in elementary school to PhD-totin g e ngineers. http:/www.sparkfun .co m / ABOUT PROBLEMS We strhe to deliver the highest level of quality in each and eery thing we produce. If you ever find an amb
7、iguou s in struction. a missing piece. or would just like to ask a question . welItry our best 10 help out. h e lpoomlou t .com (we like hearing about problems it helps us improe future versions) Thanks For Choosing .:oomlout:. and SparkFun .: W HERE TO FI ND EVER YTHI NO :. Before We Start I ASE M)
8、 As sembling the Pieces 02 I I NS T ) In stalling the Software 03 I P R OG ) A Small Programming Primer 04 I ELE C) A Small Electronics Prime r 06 The Circuits I CI RCO I ) Getting Started - (Blinking LED) 08 I CI RCO 2 ) 8 I ED Fun - (Multiple LEOs) 0 I CI RCO 3) Spin Mutor Spin - (Transistor and M
9、utor) 12 I CI RC04 ) A Single Servo - (Servos) 14 I CI RC O 5) 8 Mure I EDs - (74HC595 Shift Register) 6 I CI RCO 6 ) Music - (Piezo Ele me nts) 18 I CI RCO 7) Button Pre ssing - (Pu shbuttons) 20 I CI ReO 8) Twisting - (Potentiometers) 22 I CI RCO 9) light - (Photo Resistors) 24 I CI RCI 0) Tempera
10、ture - (lM335A Temperature Sensor) 26 I CI RC I I ) L1rger Loads - (Re la ys) 28 I CI RCRGB ) Colorful light - (ROB LED) 30 01 ASEM assclllhlin.1,! the plece :-.: PUTT! NG I T TOGETHER :. Arduino Holder ,I Breadboard , I .: For an introduction to what an Arduino is, v is it .: hltp:llardx.org/ INTR
11、:. Arduino xl .: I NSTALLING THE IDE : . 02INST Installing This is the program used to write code for the Arduino. It may seem a little daunting at firs t but once you have il in s talled and start playing around, it s secrets will reveal th emselves. ( . “. “d 1.“,1,_ ,) Step l: Download the softwa
12、re Go to h t t D: II a rd u inc.eel e 111 Ma inl Soft wa re download the software for your operating system Windows XP St ep 2: Unzip th e Softwar Unzip e r Mac OSX Step 2: Open The Open ( mount) .dmg ardu ino-OO X X -win .ziQ. ( X x version Reco mm e nd ed Path c : Program Files . ) arduino-OO -mac
13、.dmg ( X x- Crsion Step 3: Short cut Icon Open c:program ti lc sarduino-OO X X ()()( . “ .“ “ oj Righ i Click Arduino.cxc (snd tosk!op (reaIC shOrl u!) / Step 4: Plug Tn Your Arduin Pl ug yo ur Arduino in: 0 Using the included USB ,able. plug your Ardui board into a free USB pon. Wait for a box to p
14、op up “ e ./ Step 5: Add new Hardwar Skip searc hin g th e interne t (did (he neXI box when prompted 10 do so) I n s tall from a specific location (click “Inslall from a lis( or spe cifIC local ion ( Advan Choos e the Locat ion c:proram filcsarduino-OO X X driycrsOJ)J USB Finis hed ced)“) )ri,er /“S
15、tep 3: Copy The Application Go (0 “Arduino“ ( in the devices section of finder) Move “Arduino“ Application to the “-“Applica tion s“ fold er / /“ Step 4: In sta U Drivers Go10 “Arduino“ device Double Click : lIbs,:s 1.l2kg ( FTI)I1) ;,o . fo r PPC Ma“ ( X X X X),pa Re s t art “-/ / Step 5: Plug In Y
16、our Arduino Plug your Arduino in : Using Ihe in cluded USB cable, plug your Arduino hoard inlO a free USB porI. “-Finished ./ .: NOTE: :. En counte ring problems ? .: Would like more deta ils? Using Linux?: . . : http:/ardx.org/UNU: . .: ASmall Programming Primer:. MDUI NO PROGRAMMING I N BRIEF The
17、Arduino is programmed in the C language. Th is is a quick little primer targeted at people who ha ve a little bit of programing experience and just need a briefing on the idiosyncracie s of C and th e Arduino DE. If you tind the concepts a bit daunting, dont worry, yo u can start going throug h the
18、circuits and pick up mos t of it along th e way. For a more in-depth inlro th e Arduino.cc website is a great resource. STRUCTURE E.1ch Arduino program (often ca lled a s ketch) has two required function s (also ca lled routines). SYNTAX One of the slightly frustrating elements of C is it s form a n
19、 ing requirements (t his also makes il very powe rful), If you remember the following you should be alright. VARIABLES A program is noth ing more than instructions to move numbe rs around in an intelligent way, Va riable s a rc used to do the moving. boolean (boolean) A simple True or False varbble.
20、 Useful because it only uses one bit of RAM void se tup () 1 I All th e code between the lWO curly brackets will be run once when your IIrduino program firs! runs. II (single line comment) it is often useful to write notes to yourse lf as you go along about what each li ne of code does. To do this t
21、ype two back sla shes and everything until the end of the line will be ignored by your program. curly brackets) Used to define when a block of code Slarts and ends (used in functio ns a well a s loops). inl (integer) The mai n workhorse. stores a number in 2 bytes (16 bits). Has no decimal places an
22、d wi ll storc a value betwecn -32,768 and 32.767. f lo a t (!loat) Used for flo at ing point ma th (decimals). Takes 4 bytes (32 bits) o f RAM and h as a range between -3.4028235E+38 and 3.402823513+38. vo id ioop ()1 I This function is rUIl after se tup has finished. After it has run once it will b
23、e run aga in. a od a g a in. until power is re moved. I * * I (multi line -Omment) If YOll have a lot to say YOll can span severa l lin es a s a com men!. Everything between these two symbols will be ig nored in your program. ; (semicolon) Each line o f coue must be ended with a semicolon (a missing
24、 semicolon is o ften the reason for a progra m refu sing to compile). lo ng (lon g) Used when an in teger is not large enough. Take s 4 bytes (32 bits) of RAM and ha s a range between -2, 147,483,648 a nd 2, 147.483,647. char (character) Stores one character using the ASOI coue (ie A “ 65). Uses one
25、 byte (8 bits) of RAM. The Ardu in o handles strings as an array of chars. :For a fu U programmin g reference VISIt: . http:/ardx.org/PROG 03 PROG pl o g ralllllllll g PI llllCI MATH OPERATORS Operators lIsed for manipu latin g numbers. (t hey work like simple math). = (assignmenl) makes something e
26、qual to something else (eg. x = 10 2 (x now equals 20 % (mod ulo) gives the rema inder when one number is divided by another (ex. 12 % 10 (gives 2 + (addition) I (subtraction) (In u It ip lica t ion) (division) COMPAR I SON O PERATORS Opera tors lIsed for logical comparison. CONTROL STRUCTURE Progra
27、ms are reliant on con tro llin g what runs next. here are the basic control e lements (there are many more onlin e). DI GITAL pinMode(pin, mode); Used to set a pins mode. pin is the pin number you would li ke to address 0 - 19 (analog O S are 14- 19). The mode can either be INPUT or OUTPUT. ANALOG 1
28、1le Arduino is a d ig it al machine but it ha s the abilit y to opera te in the anak)g realm (through tricks). Heres how to dea l with tllings that arent digital. ,-.-(equa I to) (eg. 12 = 10 i. FAlSE“r 12 = 12 is TRUO) (not equal to) (eg. 12!= 10 is TIlUE“. 12!= 12 is FAlSE) (greater than) (eg. 12
29、10 i, TRUE“r 12 12 i, FAlSE“. 12 14 “ FAlSE) if(c() nd i t i on)( ) els e i ff condition ) I tile I This will eecute the code between Ihe curty brackelS if The condiTion is lrue, and if n“t it wilitesl Ihe t i t t i f condition if that is also false the tis e code will execute, d i git31 r ite(pin,
30、nlue): alice a pill is set as an OUTPUT, it can be set either HI GH (pulled to +5 volts) or LOI(pulk: d 10 ground). int analog r i te ( p i n, alud: Some of Ihe Arduinos lin . ,ullOrl lube widlh modulalion (3, 5, 6. 9 , 10, t tJ. Th;, lurns Ihe lin on and offve.y qui“0 curr: http:/ a rdx. org/TRAN H
31、obby Se rvo Wh at it Does: No. of Lead s: DC Mot o r -or ldkcs a lime d pulse and cunverts it into 3 an angular pos ition of the output sha li. Things to watch out fo r : Id ent ifying: - The plug is not polaril.ed so make sure A plastic bux wil h 3 wires coming uul one il is plu gged in lhe right w
32、ay. s ide and a shan with a plastic horn out the top. What it Doe s : Spins when a current is passed through it. Ide nlifyin g: This one is easy. it looks like a motor . Us ually a cylin der with a s haft coming out of one end. More Details: htt p:/ a nix. orgl SERV No. of Le ads: 2 Thin gs 10 watch
33、 out for: - Usi ng a transistor or re lay that is rated for !he size of motor youre using. More Details: hnp:llardx.orgl MCITO COMPONENT D ETAILS (CONT.) P iezo Eleme nt Wh at it Does: A pulse of c urre nt will cause it to dick. A stream of pulses will cause il to e m il a tone. Identifying: In this
34、 kit i1 comes U1 a little black barre l. but sometimes they a rc just a gold disc. No. o f Lead s: 2 Thin gs 0 watch ou t for: - DiffIC ult to mis use. Mo re Deta il s: http:/ardx.org/PIEZ Ie (Integra ted Ci rc uit ) W hat it Does: Packages any fallgc of complicated electronics inside an easy 10 use
35、 package. Ide ntifying: TIle part 10 is wriucn on the outside of the package. (this sometimes requires a Jot of light or a magnifying glass to read). No. of lead s: 2 I ODs (ill .his kil there ;. O“ lo (0 “,t, ,h“win pin I) More Details: hi (P :11 a rdx.o rgl K.1C Pu s hbutton What it Docs: No. o f
36、Leads: 4 Com pletes a circuit whe n it is pressed. Iden tifyin g: A little square with lea d s out the bottom a nd a button on the top. Things to watch out for: - these are a lm ost square so can bc inserted 90 d egrees off angle. Mo r e De lails: http:/ard x.org/BUIT Potent iometer Wh at it Does: P
37、roduces a variable resistance depe ndant on the angular position o f the shall. Identifying: Th ey can be packaged in many differe nt form factors , look for a dial to identify. No. of Leads: 3 Things to watch out for: - Accidentally buying lo garithm ic scale. Mo r e Details: http:/ard x.org/PCITE
38、Ph o to Re sis tor What it Does: Produces a varia ble resistance dependant No. of Lead s: 2 on lhe amount of incid enl li gh t. I de nt ifying: Thin gs to wal c h o ul for: Usually a little disk with a clea r top and a curvy line underneath. - Remember it need s 10 be in a vo lt age divider before i
39、l provides a useful input. Mo re Delails : http:/ardx.org/PHCIT R ES STOR COLOR CODE Exarnpt: grn.bkJe.brown. 560 ob m red-red-red . 2 200 obrn, (2.2kl brown-black-ora ns - t I) 000 ohrns (10k .0 . Black .5 . Grecn .1 . Brown 6 - Blue . 2 . Red .7 -Pu rpJc .3 . Orange 8 - Grey 4 . Yellow 0 9 . Wh it
40、e irst digit - “econd dig it of zeros 20% none 10% silver 5% gold L EAD CLI PPI NO Some components in this kit come with ay long wire leads. To ma ke them more compathle wil h a breadboard a couple of chanJ;es are required. LEOs: aip the leads so the long lea d is - tOmm (3/“) long and the short one
41、; -7mm (9/ 32“). Re s istors: He nd the leads down so they arc 90 degrees to the ytinder. Then snip them so they are -6111111 (1/4“) Ion J; . Other Cornp)nnt,; OIhr components may need dipping . Usc your discre tion when doing so. .:Getting Started: . . :(Blinkin g LED):. WH AT W ERE DOING: IEIJs (l
42、ight emilting diodes) are used in all sort s of clever things which is why we have included them in this kit. We will star! otT with something very s imple, turning one on and oft; repeatedly, producing a pleasant blinking etTeCI. To get started, grab the parts listed below, pin the layout sheet to
43、you r breadboard and the n plug everything in. Once the circuit is assembled youll need to upload the program. To do this plug the Arduino board into you r USB port. Th en select the proper port in Tools Seria l Port (the com m port of you r Ardu in 0). Next upload the prog ram by going (0 File Up l
44、oad (0 1/0 Board (ct r l+ U). Finally, bask in the glory and possibility that controlling lights olTe rs. If you arc having rouble upload in g, a full troublt s hooting guide can ht (bund here: h llp:!1 a rdx.org!TRBL THE CIRCU IT: Parts: CIRC-OI Breadboard Sheet 330 Ohm Refa nf e, n r re Il DEll! 2
45、 Pin Hader “ 5 mn. Yello . LED “ W ire CODE (no need lolype everYlhing injUSI click) File Examp les Dig ital Blink (example from the great arduino.cc site. ch ec k it out for other ideas) / , BI;n , Turns o n an LED o n for one seco nd. then off for one seco nd. , repntedly. (Toted I June 2005 B Dai
46、d CUil l iellts , hltp : /iar du ino. cci e nITulor i a I 1 8Iin k based o n an org in al by H. Bu r agan for l he i,ing ilo boa r d 1 inl le dPin“ 13: /I LED connected 10 digita l pin 13 /I The set up() method Tu nl once. wh en the sketc h I t artl .oidsn up () I /I inilia l iH I he digilal p in u
47、an OutpU I : pin)de(ledPin. OU TP UT): J /I the loo p() method Tun , oHr /I u l o ng 1 Ihe Ar duin o has oi d I oop() , OHr a ga I o. J dig ; lalTi l qle dP i n. HIGH) : de l ay (IOOO): dig i tai li“ i lt (l tdPin. LOW): delay(IOOO): powe r J II II II II NOT WOR KI NG? (3 th ings () try) “ , Wi i I
48、“ WI i I , h LED on I“ secon d , h, LED off I“ He n d -LED Not Li ghting Up? lEDs will only work in one direction. Try taking ;t out and twis ting it 180 degrees. ( no necd to worry, inslalling ;1 backwards does no pemlnnent harm). Program Not Uploa ding This happens somet imes, the most like ly cau
49、se is a confused serial port, you Still No Success? A broke n circu it is no fun. send us an e -mai! nd we will gel back to you a s soon s we cn. can cha nge this in toolsse rial port help oo mlolll,com MAKI NG IT BETTER Changing the pin Th c LED is conncded to pin 1 J bul We Can us e any of the Arduinos pins. To cha