You are on page 1of 6
Arduino 101 by Terry King Ete See or mogintion an inthis Low cost believe the est starter kit we ha heats century. I bri Tesned 67 of capabities to make things active, decslor-making, and. tireless The main Arduino tose is fee, open source software that works on alms ny ‘computer, The Arduino mlrocomputer i. designs ae open-source and canbe frely copied and upgraded. One upgrade isthe YourDuinoRobor that isinchadd in The Shed magazine Arduino Starter Set Aci allows you to make things that oof eondtions (like emperatre Tight ete) i thereal world around it You decide what decisions it should make and what actions t ould take. Actions can ined control of Fights, motors, vas, rch more. You wire together ideas and ectrica things. wth today’s equivalent What ean yu with it? + Home antomation to conto the emery tie of your home + Fully automated greenhouses. and Iydroponk setups + Miniature GPS-guided and gyro controlled aril drones with cameras; + Simple things ike ntoling your workshop ights an fans Getting started All you need to get stared is an beard, desi or lgtop computer Gor programming the Ardning) and topo adopt devices The Shed mmguine Arno Starter Set X way fo get slate ontains everything. you will need sd more, Infact wil be Hass ofthis series of articles that wl et you wp and unin wit the Arduino Free Software Microprocessors ike Arduino are just ‘min-computer on chip. ‘They need instructions (programs) to carry out thet functions. Inthe Arduino envionment we call them sketches, All the sotware nce to rn the Arduino i available nthe Arduino IDE (tegrated ment Environment) at we viene Arduino software looks virtually the same on Widows Mac or Linux but the Installation procedures ate different. You willbe ged on the diferent installation Procedures. from the Arduino IDE Reread Receive (RX) LED Pin 13 LED Tronsmie Totes Check out the YourDuinoRobot (much of what we discuss heres ‘lo commen to other Arduino boards At the lower left isthe PWR. LED which should light up ihenever the boord is plugged into a USB connection, or has power from an external power supply At the upper left there are two green LEDs which wil blink when a software sketch boeing downloaded tothe board or other data isbeing transferred over USB. At the top isa red LED whichis internally connected to pin 13 through a currentlimiting resistor. should blink after you load the example BLINK. software sketch Download the IDE for your computer fet. Just flow the diretions on the Arduino se tha appl to your compte. ‘n Arduino is. eompletemicroprocesor system on a board. It includes. the processor, power input, and input/output (Woypins where data can be input and actions output. These ae asualy refered tous digtal and anaogve pins. There ate also several LEDs incorporated into the board usually ax surface mount deviees (oMD9. Pag the Arduino board into your computer via the USR cable provided If yo have the YourDuino phagged in ane running, the POWER “ON” LED fs on and the “ig” LED is blinking. 1 srt ‘eck your eonnetons and start gai, Software With the Arduino ion on your desktop, lick tan you wil se the "Ardaino IDE Window” pop up. Here you wil develop your ow software to male Arno ito ‘what you want to be Sketches The visible test of an Arduino software program is called a Sketch. There are sof examples that come with the foe Arduino software system, and we will roca som of hem ltr as well as make A Shcich cones alive when you upload i to your Arduino so let's look at a Sketch, ‘Verifying ane Uploading i lick on FILE whieh opens dialogue box. tn his your can mouse over EXAMPLES, then across Arduino IDE to LBASICS and then across to eck on BLINK The new IDE window opens and explains that BLINK turns on an LED fr one second then off for one second and repeats This san example of code fn the public domain Notice that a lot of the text re. All of that is jst "Comments for yu to read to help understand the Sketch. When sou write software, yo should also ase “Comments to explain to others what you are doing. (Arduino ignores these comment) Structure very Arduino Program has the same basic strut 'SETUP- Runsonce atthe begining LOOP -Rons wer and over fonever Read the example through carefully, 4 couple fina Note the eoloured special BLINK Sketch words that are Instactions, These are unigoe words that tall Ard what to 4, They have to be spel prety SETUP: Instructs Arno aboot things that need to be done once. Arduino Digital Pins canbe used as eee INPUT (or OUTPUT. You have to tell Andina when «Pin willbe used as an OUTPUT. Inthis example there sone line that tells Arduino that Pin x must bean OUTPUT Note the colour of the lettering. The Arduino IDE changes the colour of Instructions When Instructions are two words run together, ike pinMade, the beginning of the second word is capitalised. If yu change the capital “M? to “a note that the colour changes to back, HF yo click VERIFY, ou sll got an ERROR ‘Augususeptember The Shed 7 ct and al ct upp ase, Change i ack. Chek the Click Verify again VERIFY is program in your computer sthrougheveryinstru checks that the st IRS OK, then i “oomples” of “ean the sketch ito the actual machine code that Ari ally runs on Its Arduino and run, Other call this process UPLOAD firs and compile Make" of "Compile runs Ver ram. Then it uicates o your er the USB connection and re Arduino chip. 1 rcs Aen (allel the BOOTLOADER ) to Tea your new program int the Arduino’ memory. (Arduioo wil reme even if the Is turmed of). Then it the SETUP ss 1o06¢ ona then re ion, You hisrunning Instruction cgialit to check This instruction either IG an OUTPUT PIN to 5) oe LOW (onneets ito GND). Remember: HIGH 1= ON = 45V, So, thefts ine in LOOP PIN gto HIGH. Th Perod of time. The VALUE used with delay is in liso So delayio00; walks fo ond. [Notice tha every instruction alt scmeting like MyBlink. This wil in your SKETCHROOK where youl messed up, ost go hack to what worked ind start again Changes Flat cable and pins. the section, ad the cul brackets (The begining and Sy that are grouped by these racket F Linked together Lats change the VALUE, in a del statement to change the way the LED links. Thnk about the four instruction inLoor. Allconnected a”Bus" What’ happening Not connected Turn the LED on. Walt and look at the Ls Turn the LED off, Wait and lok at atk Maybe 50 Millsecons, That a second, Then try 10 miliseeonds, LED Isonty cn 1/100 ofthe tne. Can yo which will first Verify and then Compile sour program and send it t Augutisepember TheShed 7h that are marked "FX" (Transmit) and plug on the connectors cm the Robot lo the orginal Blink and upload it RX" (receive) flash as your computer ora Senace Shick, Your kit has asrip of YourDuino, The LED you just wired up communicates withthe Arduino Male-Mae Pin Conaectors with 40 pins on your breadboard should bak the Theseean bec orstappedoffand same as the 43 LED on YourDuino, times. Like ON 1000 and OFF 5. ‘sed as pins forthe breadboard, You cannot, recheck that you have wel as Thy making both ON and OFE times cut or snap off the numberof pins you the photos and the LED's longer lead is iter and shorter. Ifyou make the ON need. TostartsnapofFaboxt singlepins. tothe let and OFF times short enough, your eye Run a red wire from «45 pin on the To work out what is happening, unphg will no longer se Blinking, because of YourDaino to the sted mil on the the wire from YourDuino pin 13 (keep persistence afvisionwhichhappenswwhen breadboard, Runa blue wir from aGND the pin with it) Now try two things: at a5 blinks per pinon the YourDuin tthe blue rillon = Pha the fee nd «cond, So mike the LED be ON for 1/50 the cadbonrd Now ifs eas o connect +5 Rail It should Tight ofasccond and OFF for 1/50 ofa second. things to the SV (+d) rail the GND» Phi the fce end ofthe wie into the You can save any ofthe selches for use Che ra GND Rail. should be of Ibteron.Then goto ile>Sketchbook and Plaga 220 Ohm (e-e-own) resistor Try i few tes, like 1 second 10 4,1 yun see the, and a red LED (ong pit othe lef nto second to GND. Nw pg. it back into the breadbourdasshown, Nowaddawire YourDuino Ping. l'should blink gain Breadboard (black is shown) from the same vertical What's happening here? The YourDuing Wires and eketronie parts lke LEDS stripastheLEDtotheGNDrall,Conpect is doing exactly the same thing and resistors can be pluggéd into the —anetherwite(reenisshown)tothestme automatically that you did! manally changed. The Dols inthe breadboard anduseapintpligtintotheurDuino to pin 1g tothe o5¥ Rail and then to doen into Ite sockets wth mal socket el 1g. (Use ahora pins cenmecting othe GND Ral. Thats Contacts Sectionstthebredboardave where you ned a male ered to pg into hw ga catpats work toms or calumns that te all connected thebachoard or Your) You havea god beginning in setting up tte, making teas to hae mal YouDuino, programming and wing things omected tsther Power up upesternaldvies. In er next iu tal rows have five holes Time to power up. Plug the USB cable we'llthink about eireuts. © (abode) and (hi) with sockets that from yourcomputr into the YourDuin The PWR LED should parts tht ate plugged into this row are pin3 LED should blinking in the way sonnet smmed it. IF nocessary her. Thevetical columns you last (red and toe bavethe sare connes running all the wey down, We wil these to connect +5¥ on our YourDulno board to the +Redl and to connect GND uy Cn the bread we will mai se the upper Red tow and. the top red railisthe +5 Vl ral and r¥-Ble rove, We think of paral Tinos Wires What about wires? Locate the “40 pi lat eal a Male-Male Pin Connectors” in the 5 rl to Von the YourDai We will use the CableMaker 40 pin at in the kit cal 1 wites You can easy section tose asacabl. The esol these wires are female connectors that ea

You might also like