Arduino Robotics Camp.pdf

Embed Size (px)

Citation preview

  • Arduino Robotics Camp

    Andrew D. Sullivan Summer 2013

  • Arduino Robotics Camp

    Andrew D. Sullivan Page 1 of 27 MSUB City College May 14, 2013

    Table Of Contents Introduction .................................................................................................................................... 2

    Supplies What You Will Need ...................................................................................................... 3

    Getting Started How to Use the Board ........................................................................................ 4

    Your First Program Blink .............................................................................................................. 6

    Getting Moving - Controlling Motors ............................................................................................. 7

    Saving Your Work .......................................................................................................................... 10

    Simple Circuits and How to Build Them ........................................................................................ 11

    Light Emitting Diodes - LEDs ..................................................................................................... 13

    Which Way Do LEDs Hook Up? ................................................................................................. 14

    How to Read Resistor Color Codes ........................................................................................... 15

    Sourcing Large Currents from the Arduino ............................................................................... 16

    Seeing Your Surrounding Sensors .............................................................................................. 18

    Interfacing the Sensor to the Arduino .......................................................................................... 20

    Strategies for Following a Line ...................................................................................................... 21

    Make a Rugged Circuit Soldering ............................................................................................... 22

    Competition Day Rules to Live By .............................................................................................. 23

    Resources ...................................................................................................................................... 24

    Example Code ............................................................................................................................... 25

  • Arduino Robotics Camp

    Andrew D. Sullivan Page 2 of 27 MSUB City College May 14, 2013

    Introduction Welcome to the exciting field of robotics and computer control. Building a robot is easier than you may have thought, but like anything new, where to start can be a little challenging. That is what this booklet is for. It is a concise guide to jump start the robotic creation process. It was developed as part of a Robotics Camp hosted by Montana State University Billings City College. I wrote this booklet to help people host a similar camp or activity, and to service as my guide and lesson plan as I deliver the camp. The intent is to minimize book study and maximize hands on learning while covering a range of topics important for robotics. I was first introduced to robotics 23 years ago when the tools and information on the subject were less available. I was fortunate to have taken course 6.270, Autonomous Robot Design Competition, at MIT in 1990. The description for that years completion was RoboPuck: Three robots compete at a time to gain control of a hockey puck located at the center of the table. We worked in groups of 2 or 3 and built a robot out of Legos. This camp doesnt rely on Legos, although it could. A main focus of this camp it to keep costs down and open it to the widest range of campers possible, so using commonly available materials is a priority. The total cost of your robot will be about $70 including computer board and motors. My first robot used a custom computer board built my MIT graduate students that was way beyond my construction abilities. It was challenging to use because it was programed in low level assembly language. The evolution of single board computers has created great opportunity for the do-it-yourself robotic enthusiast. Boards are available for less than $30 that are easily programed from a PC in higher level languages like Basic, C, and Processing. These boards facilitate input and output from very low cost sensors and motors. They are perfect for robotics or any other ideas you may have where you want to control something. In fact, many of the appliances you are familiar with use similar computers like your microwave, smart thermostat, or automotive control system like cruise control. These are called embedded systems, and they are all around us. This course was built around the Arduino microcontroller. It has advantages of low cost and a free development environment. It is programmed in the C programming language which is heavily used in industry, and students are likely to see something similar later in their careers. There is also a large Arduino community and online resources available.

  • Arduino Robotics Camp

    Andrew D. Sullivan Page 3 of 27 MSUB City College May 14, 2013

    Supplies What You Will Need The following table is a listing of what you will need to host a similar camp. Quantities are based on 10 campers with a 10% allowance assuming some things will get damaged. Total cost is about $771.56 or $77 per student.

    Per Studen

    t

    Total + 10%

    Description Vendor Item # Price Each

    Total Price

    1 11 Arduino Leonardo /w Header SparkFun DEV-11286 $22.46 $247.06 2 22 Servo - Medium Full Rotation SparkFun ROB-10189 $10.76 $236.72 -- 1 22 AWG solid hook up wire SparkFun PRT-11367 $16.95 $16.95 1 11 9V Battery Holder SparkFun PRT-10512 $2.66 $29.26 -- 2 Soldering Iron - 30W SparkFun TOL-09507 $9.95 $19.90 -- 1 Solder Lead Free - 100-gram SparkFun TOL-09325 $7.95 $7.95 1 11 NPN Phototransistor Mouser 782-BPW96B $0.51 $5.61 1 11 Infrared Emitters Mouser 720-LD274 $0.21 $2.34 1 11 47 ohm 1/2W Resistor Mouser 2CT52R470J $0.08 $0.88 1 11 220 ohm 1/2W Resistor Mouser 2LCT52R221J $0.14 $1.54 1 11 5.6K ohm 1/2W Resistor Mouser 2CT52R562J $0.08 $0.88 1 11 2N4401 Transistor Mouser 610-2N4401 $0.38 $4.18 1 11 Dual Mini Board 213 Holes RadioShack 276-148 $2.49 $27.39 1 11 USB Cable - 6ft Amazon $2.52 $27.72 -- 1 6x6x6 Boxes Bundle/25 Amazon $14.86 $14.86 -- 1 9 Volt Battery, Pack of 12 Amazon $17.90 $17.90 1 11 Pair 2.5 inch hobby wheels Central

    Hobbies CHS036W $3.47 $38.17

    -- 1 1/2" Foam Board Hobby Lobby $3.99 $3.99 -- 1 Glue Gun & Glue Hobby Lobby $11.98 $11.98 -- 1 Two Sided Foam Tape Hobby Lobby $5.99 $5.99 -- 1 2" x 4" x 96" Stud Home Depot $2.73 $2.73 -- 1 1/2" 4x8 OSB (Particle Board) Home Depot $17.97 $17.97 -- 1 Quart White Paint Home Depot $15.74 $15.74 -- 1 Black Electrical Tape Home Depot $1.97 $1.97 -- 4 Goggles (for soldering) Home Depot $2.97 $11.88

    $771.56

  • Arduino Robotics Camp

    Andrew D. Sullivan Page 4 of 27 MSUB City College May 14, 2013

    Learnings from Prior Camps Following is a list of things learned from conducting the camp that may be helpful for future camps. 1. Ten students is a practical max for a single instructor. We used a grade 8-12 guideline for

    the camp, and some students needed quite a bit of help. 2. Add a little budget for food. Donuts are popular and about $8 per day. 3. Set the camp somewhat later than the camp flyer. We were too close and had to over order

    materials because counts were not final. 4. The 9 volt battery didnt work too well. Voltages would drop and reset the board on some

    robots requiring a second battery just for the servos, but then the voltage was 9 vs. 6 volt limit on the servos. It worked, but was sloppy. A 4-AA battery pack may be better, but the volts is near the low limit again and needs more testing.

    5. A three sensor robot works very well and is worth the few extra components. 6. Computer configuration was challenging even with the pre-work. The board the system was

    prototyped with was discontinued and we went to a new board which needed new configuration. Prototype with the board you will use.

    7. The original camp was from 9-12, M-Th for two weeks for a total of 8 classes and 24 hours. An alternative might be 9-5 M-W to make it easier for parents who work to drop off and pick up with hours closer to typical working hours. 24 hours for camp seems adequate.

  • Arduino Robotics Camp

    Andrew D. Sullivan Page 5 of 27 MSUB City College May 14, 2013

    Getting Started How to Use the Board We use an Arduino board which is easy to interface to a home computer, and there is a lot of online documentation. One thing that can get a little more challenging in a camp setting is if the computers you use are locked down. Academic and commercial settings are forced to limit computer access to protect their systems. This means that installing software and drivers may be restricted to computer support specialists. I suggest you get the process started early and test it well ahead of the camp to avoid surprises. Following is a procedure that worked at MSUB. Your site will likely require some fine tuning. 1. Get a board that you will use in the camp. This is important to pre-test your facilities

    configuration and to complete driver installation. You will also need an appropriate USB cable.

    2. Download the free Arduino software from http://arduino.cc/. If your systems are locked down, you will need your Information Technology support group to do this for you. It will normally install to C:\Program Files (x86)\Arduino.

    3. Refer to the installation guide at the Arduino site, or http://arduino.cc/en/Guide/Windows.

    4. Test the software. At MSUB, the software worked right off on PCs, but it wouldnt launch on

    laptops. We had to right click on the executable file and click run as administrator, then it worked.

    5. Plug in your Arduino board and configure the USB driver per the installation guide. This can

    take a little experimenting depending on your facilities. We had more than one version of Windows in use, so there was some variation. If you are lucky, the drivers will load automatically when you plug in the board. Sometimes it doesnt work. For the MSUB configuration, I took the following notes:

    a. Use Windows Explorer to navigate to C:\Program Files (x86)\Arduino\drivers. b. Right Click on Old_Arduino_Drivers which is a .zip file. Click on Extract All and

    click Extract when prompted. c. Open Control Panel then Device Manager. On some systems this might be in

    Control Panel / System. d. Expand the COM Ports selection, right click on one of them, and click Update

    Driver. e. Browse to the C:\Program Files (x86)\Arduino\drivers\Old_Arduino_Drivers

    directory and click OK. Your software should be ready for use. The next section tests it on a simple program.

  • Arduino Robotics Camp

    Andrew D. Sullivan Page 6 of 27 MSUB City College May 14, 2013

    Your First Program Blink 1. Logon to your PC. For the 2013 summer camp at MSUB, students IDs are set as:

    Username: CCA062 Password: Robotics 2013

    2. Open the Arduino IDE (Integrated Development Environment).

    3. Open program Blink under File/Examples/Basics.

    4. Set the board to the one you are using under Tools/Board.

    5. Set the COM port to the proper one under Tools/Serial Port. This might take some trial and error. Start with the highest number. There are normally only 3 choices or so.

    6. Test uploading the code to your board. Click the upload / right arrow button on the top

    left of the window. It looks like a play button. a. The window will signal

    that it is Compiling Sketch.

    b. You should then see the double lights (LEDs) on the board blink rapidly for just a moment as the program / sketch is uploaded.

    c. The other LED should blink slowly once done.

    7. Experiment making the light

    blink differently by changing the delay(1000); commands near the bottom of the sketch. See if you can figure out what the sketch is doing. Note that there are 1000 milliseconds in a second.

  • Arduino Robotics Camp

    Andrew D. Sullivan Page 7 of 27 MSUB City College May 14, 2013

    Getting Moving - Controlling Motors There are many types of motors and many ways to interface them to a microcontroller board. A microcontroller does not supply enough power on an output pin to run a motor directly. Trying to do so would burn up the microcontroller! Instead, an interface of some kind is needed to convert a small signal from a microcontroller into the power needed by a motor. For example, two small DC motors can be driven with a board such as the Ardumoto - Motor Driver Shield sold by SparkFun for $24.95. Motors run too fast and with too little torque to connect directly to a robots wheels, so a gear motor is needed. They are available from many retailers and cost in the neighborhood of $12.99. Total cost for the controller and motors would be close to $50 which is getting a little high. Stepper motors are a more precise option because the motor rotation can be accurately controlled. Costs will be more because stepper motors cost more, and they still need to be geared down to a wheel. A control board is needed, and controlling the steppers is a little more complicated. We dont need the accuracy, so steppers are not necessary for this project. To keep cost and complexity down, we will be using continuous rotation servo motors. The hobby airplane market has yielded this low cost option that has a controller and gearbox build into the motors. A medium sized servo is available for about $11 dollars which has plenty of power for our robot. The photo on this page shows an example robot that uses two continuous servos for locomotion. Servos can have different wire color conventions, but in this case:

    red is hot black is neutral white is signal

    The servos in your kit use the same color convention. the wheels are simply hot glued onto the servo "horn" and the servos are hot glued to a piece of foam board that forms the body. Connecting the servo to the Arduino board is pretty easy. If you take a look at your board, you will notice some pins labeled 5v and GND. The 5v pin is a regulated 5 volt source that the

  • Arduino Robotics Camp

    Andrew D. Sullivan Page 8 of 27 MSUB City College May 14, 2013

    Arduino regulates down from the supply voltage with an onboard regulator. The red wires from both servos attach to the 5v pin.

    The GND pin on the Arduino is the ground pin or neutral. The black wires from both servos connect here.

    The white wires from each servo are the signal that tells the servo which way to turn, and how fast. The servos respond to a signal that pulses every 10-20 milliseconds. Recall that a millisecond is a 1/1,000 of a second, so this is pretty quick. Your Arduino runs at 20 MHz, which is 20 million cycles per second, so to the Arduino, the servo signal is like watching paint dry.

    The length of the pulse tells the servo how fast to go and in which direction. If the pulse is about 1.5 milliseconds in length, the servo should not turn much in either direction. It is not likely to be exact, an a little fine tuning will likely be necessary. A shorter pulse will turn the servo to the left, and a longer pulse will turn it to the right.

  • Arduino Robotics Camp

    Andrew D. Sullivan Page 9 of 27 MSUB City College May 14, 2013

    The Arduino has a library of code that makes using a servo easy. A library is code that someone else has written that we can use. We don't even have to know how the code works. We can make calls with some simple commands, and the library does the rest.

    Connect your Arduino and open the example "Sweep". We will go through this at the board. Try to get your servo working with the Sweep code, then modify it to get two servos working. Consider how you will use the servos and the Arduino to move your robot. There is great online help for the Arduino under the Help menu if you have questions or want to dig deeper. Be careful not to hook the wrong pins up. You might damage or destroy your board. Best to ask the camp leader to check out your circuit before plugging in power until you are comfortable with the board and circuits.

  • Arduino Robotics Camp

    Andrew D. Sullivan Page 10 of 27 MSUB City College May 14, 2013

    Saving Your Work Be aware that worked saved on a C:\ drive is likely to get lost. Shared computers, like those at MSUB, are frequently set up to maintain fixed starting configuration. That means that anything saved on the C:\ drive will be erased if the computer restarts for any reason. Here are a few choices on how to save your work: Use a Flash Drive. This might be the best option if you have access to a drive or can borrow one. Low cost drives are routinely given away as promotions, so you might have a stack around home. They are a little costly to buy in bulk; about $6, so I didn't by a bunch of them just to have them end up unused in a draw. I will make a common drive available to the class and will back it up at night. Writable CD. The school computers can write to a CD, and they are cheap storage. The technology is a little clunky, and you will have to copy to the C:\ drive to edit, but it will work. Let me know if you would like to use this option, and I will bring in some blanks. The Cloud. This is a good option, and it is free. Suggest using your personal Email to set up a Google Drive account to store files. Suggest using Mozilla on the MSUB computers that still have Windows XP installed. The older version of Internet Explorer doesn't seem to work with Google Drive. If needed, I have set up Google Drive account that the camp can use. Anyone can delete stuff, so please be courteous.

    Username: [email protected] Password: Robotics 2013

  • Arduino Robotics Camp

    Andrew D. Sullivan Page 11 of 27 MSUB City College May 14, 2013

    Simple Circuits and How to Build Them We mentioned before that the Arduino can't run a motor directly from a pin. This is because each pin can only supply (or sink) so much current. Imagine the tiny circuitry inside the chip, and you can imagine why a pin can't handle too much current. Each I/O pin on the Arduino can handle only 50 ma, or 50 milliamps. A milliamp is 1/1,000 of an amp. But how do we limit current? It depends on what you are doing, so we will look at a few examples. First, we will look at a simple LED, or Light Emitting Diode.

    An LED is rated for a current that ranges based on its power output. A small surface mount LED might use only 5 ma. Larger LEDs like the one on a TV remote control might use 100 ma. An LED takes about 1.3 volts to turn on. If you hook an LED to a 5 volt source, too much current would flow through the device and it would burn up. To limit flow, we use a resistor. A resistor is an electrical component that "resists" electrical flow. That is, electricity flow is restricted through the device. Voltage also drops through the device. If you look closely at your Arduino board, you will see the LEDs are wired to small surface mount resistors, or resistor networks as shown here. We will use through hole resistors that are easier to work with because they are not as small. A resistor's ability to slow electrical flow is measured in units of ohms. Current, voltage, and resistance are related with the equation: I = V / R Where: I = Current in amps V = Volts across the resistor R = Resistance in ohms Ohms is sometimes represented by the symbol.

    A Through Hole Resistor

    A Surface Mount Resistor Network. There are several 1 kohm resistors in the component

    labeled 102.

  • Arduino Robotics Camp

    Andrew D. Sullivan Page 12 of 27 MSUB City College May 14, 2013

    As an example, lets calculate the current through a 1 kohm resistor with 5 volts across it. 1 kohm, or 1k, is 1,000 ohms. (5 volts) / (1,000 ohms) = 0.005 amps = 5 ma As another example, consider the following schematic. A 5 volts supply is used to power an LED, and a resistor is used to limit current. Because an LED takes about 1.3 volts of voltage drop, the voltage downstream of the LED is 3.7 volts. The resistor sees 3.7 volts, and is 220 ohms. Using our equation, we come up with 17 milliamps of current (3.7/220=0.017).

    Important: We will use resistors to protect our Arduino boards from over-current and damage.

  • Arduino Robotics Camp

    Andrew D. Sullivan Page 13 of 27 MSUB City College May 14, 2013

    Light Emitting Diodes - LEDs There are 2 interesting things about Light Emitting Diodes that are a lot different than light bulbs. First is that they emit light at a specific frequency. This might be outside the spectrum that you can see. Consider two examples:

    1. Your TV remote control. Who can tell me how it works. Light or radio waves? Use a digital camera to demonstrate it is light, IR, that you can't see.

    2. Bring in a UV or black light LED flashlight. Be careful with it as it can burn eyes without knowing. Use it in the dark to see the interesting effect of UV light causing material to Fluoresce.

    The other interesting thing about LEDs is that they let electricity pass in only one direction. Hook them up backward, and they don't light or pass current. Consider the last schematic with a battery, LED, and resistor in series. If the LED was hooked up the other way, it would stop the flow of electricity and would not light.

  • Arduino Robotics Camp

    Andrew D. Sullivan Page 14 of 27 MSUB City College May 14, 2013

    Which Way Do LEDs Hook Up? LEDs are constructed with a longer lead and a plastic case that sometimes has a flat side. The LED hooks into a circuit such that current flows from the positive potential, into the LED on the longer leg, and out the LED to the negative potential on the shorter leg with the flat side as shown below. The longer leg is sometimes referred to as the anode, and the shorter leg is the cathode.

  • Arduino Robotics Camp

    Andrew D. Sullivan Page 15 of 27 MSUB City College May 14, 2013

    How to Read Resistor Color Codes Read a resistor's value using the color codes. Start with the bands opposite the gold or silver band. Write down the number corresponding to the bands. In this case, brown = 1 and green = 5, for a 15. Next read off the multiplier. In this case a 1. Fifteen times one is fifteen, so this is a fifteen ohm resistor.

    What is the resistance of the following resistor?

  • Arduino Robotics Camp

    Andrew D. Sullivan Page 16 of 27 MSUB City College May 14, 2013

    Sourcing Large Currents from the Arduino We have reviewed that the Arduino can only source 50 ma from a pin, and discussed how we can us resistors to limit the current flows to acceptable levels. What if we need more current than the Arduino can supply? Say for a high powered LED that might take 150 ma? We will us a transistor to control larger currents with the Arduino. A transistor is an electronic switch that we can use to control larger currents with a smaller current. Transistors are everywhere, and are the backbone of the information age. The Central Processing Unit (CPU) in your computer might contain 1 billion transistors that form its logic system. Your computer's memory contains more transistors. Consider the diagram to the right. The reed relay is a mechanical device that uses a magnet to close a mechanical switch. The switch can control a large supply of power such as house current. The control current is much smaller, but still more than the Arduino can supply. In this case, 12 volts and 130 ma. 12 volts would burn up an Arduino and it can't supply that voltage. If a pin was hooked straight to the coil, it would draw too much power and damage the pin. To address the situation, transistor Q1 is used. This is an NPN transistor. There are other types, but we will stick to NPN in this discussion. There are three leads from the transistor. The main load flows from the Collector (C) to the Emitter (E). Current won't flow until a small current is supplied to the Base (B). The main flow is proportional to the base flow, and can be used to control current. We don't need proportional control, and will be using the transistor as a switch (ON or OFF).

  • Arduino Robotics Camp

    Andrew D. Sullivan Page 17 of 27 MSUB City College May 14, 2013

    Resistor R1 limits current to the Base at a reasonable level. 5 volts / 220 ohms = 23 ma which is within the Arduino pin supply capability. The pins for the NPN transistor are as labeled to the right.

  • Arduino Robotics Camp

    Andrew D. Sullivan Page 18 of 27 MSUB City College May 14, 2013

    Seeing Your Surrounding Sensors

    To detect the line under our robots, we will us a combination IR emitter and detector. The IR emitter is an LED. It works like an ordinary LED, but the light it emits is beyond red in the visible spectrum. That is the wavelengths of light are longer than the longest we can see. Warning: You can't see IR light, so your eyes won't contract if the LED shines in your eyes. These LEDs have enough power to damage your eyes, so don't look into them. The IR emitter is rated for 150 ma. It takes about 1.3 volts of drop, so there is a remaining 3.7 volts of potential. 3.7 volts / 47 ohms = 79 ma which is well within limits. If we needed more light, we could decrease the resistance in that circuit. Line detection will be implemented by shining the IR light down on the floor, and detecting how much light reflects back. More light indicates a reflective surface, and less light indicates an

  • Arduino Robotics Camp

    Andrew D. Sullivan Page 19 of 27 MSUB City College May 14, 2013

    absorbing surface. Black absorbs and white reflects visible light. This is also true for our IR light, but note that objects don't always absorb other light frequencies like they would visible light. A phototransistor will be used to detect the reflected IR light. It works just like the NPN transistor discussed previously, but the Base control current is replaced by a light signal. Note that the current flows from the short lead to the long lead as shown in the photo. The sensor circuit works by measuring the voltage between the IR detector and the 5.6 k resistor. In a dark situation, very little current flows through the detector and the voltage is near 0 volts. As light intensity increases, current will flow through the detector. The 5.6 k resistor causes a voltage drop proportional to the current flow. At "ON" conditions, voltage at the signal line will increase to closer to 5 volts.

  • Arduino Robotics Camp

    Andrew D. Sullivan Page 20 of 27 MSUB City College May 14, 2013

    Interfacing the Sensor to the Arduino In the last section we explored how to use an IR emitter and detector to determine if a sensor is over a light or dark object. The technique used a simple circuit that would produce a signal closer to 5 volts over a light object and closer to 0 volts over a dark object. In this section we will use that circuit to feed data to our Arduino. The 0-5 volt signal voltage is read into the Arduino using the analogRead command. Clicking the "Help" / "Reference" menu from the Arduino IDE gives background on the command. The command returns an integer value from 0-1023 that is proportional to the voltage. 0 volts yields a value of 0, and 5 volts yields 1023. A sample program is included that provides details on how to use the command. The reference resource also provides help. But what voltage corresponds to seeing the line? That is a question for testing. I suggest testing your circuit with a volt meter to get it working about right, then write a little program similar to the example to test what signal you get for a light vs. dark response. I took 5 readings and added the values together to smooth noise a little. I used a variable named "threshold" set at 4250 to differentiate between light and dark. That is 4250/5 = 850 per read. That is if the reading is less than 4.2 volts (4.2=5/1023*850), it sees a dark line. Your values may be different. Results will depend on how close your sensor and emitter are to the surface, and particulars of your circuit. A great way to test is to use the Serial.Println() command and the "Tools" / "Serial Monitor" to print a reading while moving a paper with black tape under your sensor.

  • Arduino Robotics Camp

    Andrew D. Sullivan Page 21 of 27 MSUB City College May 14, 2013

    Strategies for Following a Line There are different line following algorithms you can use, and you are encouraged to do some research on the Internet to optimize your strategy. To get you started, you can use the sample code at the end of this document. It uses a modified "Follow the Gray" strategy where the robot attempts to follow the left edge of the tape (between black and white = gray). In the sample algorithm, the robot turns left until it doesn't see the tape. Then it turns right until it sees the tape. It knows it is at the edge of the tape, goes forward a small amount, then repeats. The algorithm isn't very efficient because it stops to move back and forth checking for the line all the time. This strategy slows the machine down, but the advantage is simplicity. You could do better with a more advanced strategy, and/or using more sensors.

  • Arduino Robotics Camp

    Andrew D. Sullivan Page 22 of 27 MSUB City College May 14, 2013

    Make a Rugged Circuit Soldering Sparkfun.com has made a freely distributable guide on soldering that will be handed out and reviewed with camp. It is an a comic book format titled "Soldering is easy here's how to do it," by Mitch Altman. It is available at the following link: https://learn.sparkfun.com/curriculum/42

  • Arduino Robotics Camp

    Andrew D. Sullivan Page 23 of 27 MSUB City College May 14, 2013

    Competition Day Rules to Live By Just for fun, we will have a little friendly competition to see which design strategy was most successful. Competitions can sometimes be disappointing because a machine won't work its best when needed. This is Murphy's law and has happened to me plenty of times. Luck can be a big part in a competition. Sometimes ideas don't work. That is not a failure, but a learning. We wouldn't get far as a culture if we didn't take chances. Fortunes are made with gambles that worked out, but many smart people have gamble and lost. If your device doesn't perform like you hoped, remember Thomas Edison's quote: "I have not failed. I've just found 10,000 ways that won't work." Edison gave us much, but one failure of his is that he was a strong supporter of DC transmission systems. Tesla favored AC transmission which ultimately took acceptance.

    1. All robots must fit within a cube 6 inches on a side. The box your kit came in is a 6 inch cube.

    2. Your robot many use parts other than kit parts. Keep track if your robot uses only stock parts, or if you have used customized parts. We will compete in both categories.

    3. Once you start your robot, it must complete the course without being touched. Interventions will be counted as a non-completion.

    4. If we have the judges, we will take 3 time readings and use the middle score. If we have only 2 readings, we take the average. The judge's ruling is final.

    5. Sportsmanship is important in life. We will try to time accurately, but this can be tricky and sometimes can be debated.

  • Arduino Robotics Camp

    Andrew D. Sullivan Page 24 of 27 MSUB City College May 14, 2013

    Resources Following are some websites I like. They either sell neat electronics, offer educational materials, or both. https://www.sparkfun.com/ http://www.parallax.com/ http://www.mouser.com/ Getting Started with Arduino by Massimo Banzi. $12.99.

    The C Programming Language by Dennis Ritchie. More details than you need for Arduino, but handy if you start more sophisticated Arduino programming projects.

  • Arduino Robotics Camp

    Andrew D. Sullivan Page 25 of 27 MSUB City College May 14, 2013

    Example Code Following is an example program to drive a line following robot. It works well, but there is room for great improvements.

  • Arduino Robotics Camp

    Andrew D. Sullivan Page 26 of 27 MSUB City College May 14, 2013

    IntroductionSupplies What You Will NeedLearnings from Prior CampsGetting Started How to Use the BoardYour First Program BlinkGetting Moving - Controlling MotorsSaving Your WorkSimple Circuits and How to Build ThemLight Emitting Diodes - LEDsWhich Way Do LEDs Hook Up?How to Read Resistor Color CodesSourcing Large Currents from the Arduino

    Seeing Your Surrounding SensorsInterfacing the Sensor to the ArduinoStrategies for Following a LineMake a Rugged Circuit SolderingCompetition Day Rules to Live ByResourcesExample Code