Previous: AVR Tutorial: Switch Input and Debounce
Next: Using Your PC Sound Card As an Oscilloscope in Linux

FailureBot 5 - A Line Following Robot

May 27th, 2006
FailureBot 5 - Complete Robot FailureBot 5 - In Action
FailureBot 5 - Complete Robot FailureBot 5 Following A Line

Introduction

The objectives of the FailureBot project originated simply as "build a line-following robot". However, it somehow evolved into a 3-year robotics experiment. My first attempt to build a robot was such a complete failure that I jokingly called it "FailureBot". The name seemed quite appropriate even as the project evolved as every one of the many, many failures yielded a critical lesson in the robot-building process.

For me, hobby robotics is about creativity. I didn't want to throw a couple sensors on a robot kit, I wanted to build it from the ground up. Looking through catalogs, reading datasheets, and building the robot within the constraints of my limited resources was the ultimate experience. Much of this robot is built from raw materials and hardware available at local hardware stores-- and done so on a very limited budget. Throughout the process, I kept a couple of concepts in mind:

  • Close enough is good enough. I'm not a NASA engineer, I'm a hobbyist. It doesn't have to be perfect, it just has to work. This is especially true considering that my "workshop" is merely a bedroom floor and a Dremel rotary tool. I don't have the facilities to make straight cuts or aligned holes. Improvise.
  • The overall goal is to learn and discover. When it felt like I was re-inventing the wheel I just reminded myself that I was learning how the wheel was invented.
  • Success is a series of failures. It can be very discouraging to spend large amounts of time only to hit a dead-end and start over. This is FailureBot 5 because I've had to start over from scratch 5 times with the physical construction. The lessons learned made it very much worth while.
  • Work within your means. I would often get discouraged by what I see other people building--making molds, welding, etc. I don't have those resources nor a large budget. A roboticist shouldn't be thinking about how it is supposed to be done, but how it could be done considering the elements.
FailureBot 5 - Complete Robot FailureBot 5 - In Action
FailureBot 3 - Alluminum Frame/PIC16F627A FailureBot 4 - Breadboard/PIC16F877A

Line Following Robots

A line-following robot, or "line follower" is a pretty common type of robot for hobbyists. Robotics competitions usually have a line-following event. The line is usually a black line about 3/4" wide, such as black electrical tape, on a white surface. Advanced courses may add new challenges such as inclines, tighter turns, intersections, thinner lines, or changing line colors. The robots typically sense the line by measuring light reflected off the ground, where a black line reflects little/no light and the white floor reflects a lot of light back.There are TONS of websites relating to line-following robots as it's a very common beginner project. The Robot Room has some great information on a couple of line following robots.

FailureBot 5 Overview

FailureBot 5 is actually a fairly good robot base which could easily be adapted to maze solving, obstacle avoiding, or other applications of a small, 2-wheeled robots. However, at this point in time, it only follows a line. The robot consists of 2 plastic round decks, differential drive using 2 DC gearhead motors, a sensor board with 5 photo-transistor/LED sensors, an L293D H-Bridge motor controller board, and an Atmel ATMega8 processor board.

FailureBot 5 Block Diagram

A sensor board with 5 sensors shines light downward at the ground. If the line is underneath the sensor, then the little/no light will be reflected back to a paired phototransistor. If the line is not underneath the sensor, more of the light will be reflected back. A microcontroller measures the output of each of the phototransistors through it's analog-to-digital converter (ADC). Based on the position of the line underneath the robot, the microcontroller adjusts the speed/direction of the DC motors to steer the robot.

Building FailureBot 5

Building the robot was the hardest part for me. I am by no means a mechanical engineer and had a lot to learn. FailureBot 5 is a round, 2-deck, 2-wheeled differential-drive robot.

A differential-drive robot works like a tank. The two wheels provide both the drive and the steering. By stopping one motor and not the other, the robot pivots on the stopped motor to turn. By turning one motor forward and the other motor backward, the robot turns in place. The wheels are offset forward slightly and a caster is placed in the back of the robot for support.

The Base and Second Deck

The base and second deck are 0.118" thick x 6" diameter Acrylic Circles purchase from Tap Plastics for $1.95 ea. They were cut to allow the wheels to be mounted within the diameter of the acrylic circles. The cutting as well as drilling holes for mounting motors and electronics was all done with a Dremel rotary tool. A piece of paper with drill/cut marks was taped over the acrylic circle as a guide for cutting. A piece of aluminum foil was also taped to the under-side of the second deck and connected to ground to serve as a sheild between the motors and the processor board.

The decks are connected to each other using 4" 6-32 screws with 6-32 hex standoffs spacing the 2 decks apart. I have no idea where I got the hex standoffs, but I'm sure they're pretty common.

Cutting the Robot Base Robot Base with Motors, Controller, Wheels and Castor
Cutting/Drilling the Base with Dremel Base with Motors, Controller, Wheels and Caster
Second Deck with Foil  
Second Deck with Aluminum Foil Sheild  

Motors and Wheels

In earlier attempts I had problems with motors not having enough torque to properly move the heavy robot bases I was building. I decided to buy gearhead motors with a very high torque and use larger wheels to make up for the loss in RPMs. There are 2 Lynx Motion Planetary Gear Motors (12vdc 189:1 31rpm) ($11.40/ea) which drive the two wheels. Each wheel is made out of two 4" round discs bolted together with 2 washers spacing them out. The discs are from Home Depot ($1.49/ea) which are used to cover electrical boxes. A 4" O-ring (also from Home Depot) sits in the gap between the two discs to serve as tires. These relatively large wheels allow the slower motors to suffice for moving the robot quickly. They are also nice and thin giving the robot the ability to easily turn by pivoting on one wheel. The wheels were then attached to the motors using a pair of the 6mm Universal Wheel Hubs from Lynxmotion ($8.00).

The motors are then mounted to the base using a homemade motor mount. Although Lynxmotion also sells motor mounts, I had already felt I had spent enough money on the motors. Home Depot (or Lowes, etc) has a section with weather stripping including long pieces of aluminum in various shapes and thicknesses. I picked up a right angle strip (4" wide piece of aluminum folded at 90 degrees) and cut it up using--once again--the Dremel rotary tool.

The motors are mounted slightly forward from the center-line of the robot and a caster from Home Depot ($2.95) was mounted in the back/center of the robot.

Lynxmotion Motor with Homemade Mount Lynxmotion Motor with Homemade Mount
Lynxmotion Motor with Home-made Mount Lynxmotion Motor with Home-made Mount
Capacitors on Motor Terminals Homemade Wheel and Lynxmotion Hub
0.1uF Capacitors on Motor Terminals Home-made Wheel and Lynxmotion Hub
Wheel without Tire Parts Making Up Homemade Wheel
Wheel without Tire Disassembled Wheel

Sensor Board

The sensor board was one of the only things that worked since the very first FailureBot. There are 5 line sensors. Each line sensor consists of a single red LED and a photo-transistor. The electronics of the sensor board will be discussed later. However, the construction here does make a difference. The phototransistors will be sensitive to the ambient light in the environment and thus I want to keep that down to a minumum. I want the light from the LEDs bouncing off the ground back to the phototransistor to be the primary light hitting the phototransistor.

I used a piece of acrylic plastic (Home Depot and Lowes sell acrylic rectangles for a few bucks) which I spray painted black in numerous thin coats to ensure that it was opaque. Then, holes are drilled for the LEDs and photo transistors such that the LEDs protrude out and the phototransistors are set in a bit (see my sketch below). I wasn't too concerned with one sensor being skewed or protruding more/less as I knew I could have each LED independently calibrated via software (discussed later).

Finally, two 3" 6-32 screws with locknuts and wingnuts are used to attach the sensor board to the robot. This way, I can adjust the distance of the sensors to the ground manually by moving the locknut up/down.

Sensor Board Front View Sensor Board Bottom View
Sensor Board (front) Sensor Board (bottom)
Sensor Board Top View Sensor Board Sketch
Sensor Board (top) Sketch of Single Sensor
Sensor Board in Action  
Sensor Board Attached and Running  

FailureBot 5 Electronics

Motor Controller

The motor controller is a simple H-Bridge using the L293D ($2.70 from Digikey). 5 lines from the microcontroller are used to control the 2 motors. ENABLE runs directly to the EN pins of the L293D to disable the motors. M1DIR is the direction control for the left motor and M2DIR is the direction control for the right motor. M1PULSE is the PWM signal to run the left motor at it's desired speed (at the time of writing, the software isn't using PWM but running the motors at full speed) and M2PULSE is the same for the right motor. This is a very common DC motor control concept and thus I'm not going to go into further detail. A Google search will return numerous pages on the topic.

When testing the motors, I found that they pulled 50mA with just the wheel spinning freely and 590mA stalled. The L293D can handle 600mA per channel. Just to be on the safe side, I put a heatsink on the L293D though It was never necessary in any of the earlier versions running on a breadboard.

The most important thing I learned with this part was this: BEWARE OF THE NOISE FROM MOTORS! The motors can add tremendous noise to the supply even when using a separate battery for the motors than from the rest of the electronics (common ground). The solution was the capacitors on the motors. Three 0.1uF capacitors were used on each motor. One was connected between the motor terminals, and also one from each terminal to the motor's casing. I also added the aluminum sheild to the under-side of the upper deck as mentioned above, and twisted the wire leads to the battery. Michael Simpson's "Reduce Motor Noise" discusses these techniques in more detail.

L293D Motor Controller

(Click to Enlarge)

L293D Motor Control L293D Motor Controller
Motor Controller (top) Motor Controller (bottom)

Sensor Board

For each sensor, I used a SSL-LX5093SRC/E RED LED with a clear lens in a T1 3/4 package ($0.54/ea from Digikey) paired with an OP505B phototransistor ($0.59 from Digikey). Since phototransistors are designed for the infared frequency spectrum, I was looking for an LED with a relatively high peak wavelength and a phototransistor with a relatively low peak wavelength, or at least a broad bandwidth, so that their active bandwidths overlap. I had read that you don't want to use infared LEDs for line detectors as infared light does have the same reflective properties as visible light. In rhetrospect, I was being a little overly concerned here. I believe just about any red LED and phototransistor would have sufficed considering the ability to calibrate the sensors via software.

I did not want to deal with difficult hardware for the sensors. I knew the tools I have at my disposal will not allow perfection in terms of mounting these LEDs and getting each of the 5 sensors to behave the same. Each of the phototransistors outputs are tied together resulting in a single output line fed back into the ADC of the microcontroller. However, only one LED is turned on at a time via software. Each sensor is individually calibrated so that ambient light and variations in how each sensor is mounted are accounted for.

Sensor Board Circuit
(Click to Enlarge)

Microcontroller Board

This robot has used a PIC16F84, PIC16F627A, PIC16F877A, and now finally, and Atmel AVR ATMega8. Whenever I'm learning to use a microcontroller, I make a little board for a common part (in this case the "mega8"). This allows me to experiement with the part without having to breadboard up the power supply and clock source each and every time. FailureBot 5 uses such a board. I take the board off and use it in other projects. So, this board is relatively generic. It simply contains the ATmega8 microprocessor with an 8.000MHz crystal oscillator, a low-dropout MAX667 +5V voltage regulator, and .100" pin headers for each of the I/O pins (My board also has the AREF pin at the header but is wired back to VCC for a +5V reference voltage).

AVR ATMega8 Processor Board Schematic

(Click to Enlarge)

ATMega8 Processor Board Top ATMega8 Board Bottom
ATMega8 Board (top) ATMega8 (bottom)

FailureBot 5 Software

The software for the robot is written in C for the Atmel AVR microcontrollers using avr-libc and the GNU gcc compiler (open-source). The software is still relatively primitive, however, it works quite well. The robot is able to handle 90 degree turns, inconsistant floor color (tiles) and intersections at a very decent speed. At this point in time, my gear motors have such a high reduction ratio that I do not need to use PWM to change the speed, however, the robot was originally designed to allow for PWM.

When turned on, the robot spins in circles on the line for a couple seconds while it calibrates the sensors. Once this calibration is complete, the robot begins it's line detection algorithm in a loop, however, the motors are disabled. By pushing a button, the motors are enabled and the robot follows the line. Pushing this button again disables the motors again. So, the robot is always performing the line following, however, it only moves when the motor enable button is activated.

Calibration

During the calibration, the robot turns in place in circles above the line in an attempt to "learn" the lighting conditions of the environment. 2 values are setup for each sensor. A low value indicating the lowest value read from that sensor and one for the highest value for that sensor. At the end of the calibration, the middle of these two values is the "trip point" for the sensor. Anything above this trip point is considered high and anything below is considered low. Each LED is calibrated many times over, one at a time, as follows:

Turn on LED.
Measure ADC value from phototransistor.
If the value is lower than the lowest value measured, save this as the lowest value.
If the value is higher than the highest value measured, save this as the highest value.
Turn off LED.

Then, a trip point is setup as low value + ((high value - low value) / 2).

Steering

There are 6 directions defined for the robot.

GO_LEFT The left motor is stopped and the right motor goes forward. Robot pivots to the left on the left wheel.
GO_HARD_LEFT The left motor goes reverse and the right motor goes forward. Robot turns in place to the left.
GO_FORWARD Both motors go forward and robot goes forward.
GO_HARD_RIGHT The right motor goes reverse and the left motor goes forward. Robot turns in place to the right.
GO_RIGHT The right motor is stopped and the left motor goes forward. Robot pivots to the right on the right wheel.
GO_BRAKE Both motors are stopped. Currently not used. Disable is used instead.

Line Detection Logic

The robot decides which direction to go based on the 5 sensors. Each sensor is read one at a time and the bit value is stored in a variable. The bits are left shifted into the variable starting with the left sensor. Therefore, the leftmost sensor is the most significant bit in the variable. Based on the final result of all 5 sensors being left-shifted into the variable, the robot decides how to steer.

Bit Pattern Hex Value Decision
00100 0x04 The line is in the center. Go forward.
01110 0x0E The line is center but really thick? Go forward.
11111 0x1F Possible intersection. Go forward.
00001 0x01 Line on right-most sensor. Go hard right.
00011 0x03 Line on right-most sensor. Go hard right.
00111 0x07 Line on right-most sensor. Go hard right.
00010 0x02 Line on mid-right sensor. Go right.
00110 0x06 Line on mid-right sensor. Go right.
01100 0x0C Line on mid-left sensor. Go left.
01000 0x08 Line on mid-left sensor. Go left.
10000 0x10 Line on left-most sensor. Go hard left.
11000 0x18 Line on left-most sensor. Go hard left.
11100 0x1C Line on left-most sensor. Go hard left.
? N/A All other conditions, continue in the last direction determined. Line could be between sensors or there could be a problem.


Categories
AVR Microcontrollers My Robots Robotics/Electronics

Related Posts


Technorati Tags

104 Responses to “FailureBot 5 - A Line Following Robot”

RSS Subscription Comments RSS Feed

  1. Karan Says:

    Hey....this is a great project....i dont know if you can be of help to me but i really hope so...how would i go about building this same line follower but using the PIC16F877 and furthermore i dont want to use IR sensors but instead using photo transistors.....could you please help me.

    thanks

  2. Micah Says:

    Well, I did in fact use photo transistors in this project. They were paired with red LEDs with a high wavelength.

    As for using a PIC16F677, it's almost exactly the same (at one point I was using that very microprocessor in this project). You'll simply have different processor board. The PIC has the ADC ports you'll need to get the data from the photo transistors and it also has dual PWM outputs if you need to control your motors. However, the motors I used were so slow that I didn't even need to use PWM--which makes the coding slightly easier.

  3. Karan Says:

    hey

    Thanks for the help. Will shout if i need to know anything more.

    :) thanks again

  4. Karan Says:

    hi there

    i have a few more questions for you.....was there any particular reason why you chose to use red LEDs. What are the components labelled JP1, JP2 etc on your diagrams?

    thanks for your time

    Karan :)

  5. Micah Says:

    The red LEDs were chosen because red is closer in the spectrum to infrared. Most phototransistors are sensitive to IR light. By looking at the data sheet of each part, you can see where they intersect. I tried to find LEDs that had the highest peak wavelength I could find and phototransistors with a lower wavelength (relative to other photo transistors) to be sure they would be sensitive to my LEDs.

    I didn't use IR LEDs because a) I wanted to SEE them working and b) I've read that IR light can behave unpredictable in terms of ambient light and which materials reflect it. Remember, the robot "sees" the line based on how much light reflects back. Obviously visible light reflects predictably because that's how WE see the line too.

    The JPx components are connectors. I broke each part into it's own board, so I used .100 pitch headers to connect each of the boards. Those show how each of the boards are connected.

  6. Curtis Says:

    Hello,
    Just started with microcontrollers using pic16f627a. Perhaps you could give shed some light on line following and obstacle avoidance using this chip. Using picBasic as the language. At the moment, i can connect the sn754410 motor driver chip to the motors but a little sketchy on the I/O for the sensors and the coding.

  7. Micah Says:

    It's been a few years since I've worked with PICs and when I did, I used Assmebly language or C. Checking the state of your sensors will be much easier than controlling the motors. You simply check the state of the pin. There are a lot of PIC tutorials out there to help you with this.

    You may also want to join a robotics club mailing list. I subscribe to Portland Area Robotics Group and Seattle Robotics. Both groups are very friendly and helpful when trying to work through the details of building your robot.

  8. karan Says:

    hi...i have a zillion more questions for you.....here it goes...
    1.could you provide me with the circuit diagrams etc from when u were using the pic16f877 as the microcontroller?
    2. I want to use smaller wheels that i can easily source from a toy car(maximum 10cm in diameter). Can i still use the motor type you used or will i have to use another one? if so what do u recommend?
    3.in your first circuit diagram is IC3 your microcontroller or the h-bridge?
    4. on all the three different diagrams JP1 is connected to various points as in for example pin1 of jp1 in the first diagram goes to 4A on IC3 but in the second diagram the same pin1 is connected to gnd and then in the third circuit diagram pin1 of jp1 is connected to some thing on ic1....help me....i dont understand how to read the diagrams.....do you perhaps have a more complete circuit diagram of the whole system instead of breaking it up into different boards?

    sorry for all of this....really need help though! thanks a lot...u are a life saver!

  9. Micah Says:

    1. I don't have any schematics around for FailureBot 4 which used the '877. However, a schematic of FailureBot 3 which uses a PIC16F627 can be seen at http://www.micahcarrick.com/files/failurebot_3.png

    2. Smaller wheels are fine, however, remember that it takes more revolutions to go the same distance when the wheels are smaller. The motors I used in this robot are quite slow (31 rpm). This robot went pretty fast (faster than many I see at competitions) and it or something like the GM3 from Solarbotics shoult work. However, if I were to re-do this project another time around, I would go with a bit faster gearbox such as the similar 64 rpm motor from Lynxmotion and use PWM to control the speed of the wheels (PIC16F677 or ATMega8 will both allow for PWM control).

    3. In that diagram, it's only showing the motor controller board. So IC3 is the L293D H-Bridge chip. The microcontroller connects to this board through JP1 in the schematic.

    4. I may not have paid attention to the numbering on the diagrams. I'm afraid the microcontroller board doesn't label which pin I connected to which connector on the supporting boards. You'd have to look through the source and then back to the schematics. If I find some free time, I'll make this more clear.

  10. karan Says:

    hey...thanks for the prompt reply! did failurebot_3 actually work?

  11. karan Says:

    hi again......does failurebot_3 use the same Leds,phototransistors, h-bridge, motors as failurebot_5?
    further more looking at the schematic of failurebot_3,obviously IC3 is the h-bridge but what is IC2 and what is it used for? what is the value of VDD to be used? 5V?

    Do u happen to have the same type of schematics as that of failurebot_3 for failurebot_5? if you do do you think you could put that up like you did the other schematic? oh yes....for some reason i cant open the source code and eagle schematics for which you put a link on this page. Could you maybe share that the way you did the schematic for failurebot_3?

    i am so sorry about being such a bother and you have no idea how great a help u have been. thanks a million again :)

  12. karan Says:

    hi again……does failurebot_3 use the same Leds,phototransistors, h-bridge, motors as failurebot_5?
    further more looking at the schematic of failurebot_3,obviously IC3 is the h-bridge but what is IC2 and what is it used for? what is the value of VDD to be used? 5V?

    Do u happen to have the same type of schematics as that of failurebot_3 for failurebot_5? if you do do you think you could put that up like you did the other schematic? oh yes….for some reason i cant open the source code and eagle schematics for which you put a link on this page. Could you maybe share that the way you did the schematic for failurebot_3?

    i am so sorry about being such a bother and you have no idea how great a help u have been. thanks a million again :)

  13. karan Says:

    what is the purpose of IC2 in failurebot_3? did you use the same leds,phototransisors,h-brige,motors as in failurebot_5? did failurebot 3 work? do you have the source code for failurebot_3? thanks

  14. Micah Says:

    IC2 is a 3 to 10 line decoder. It takes a binary value on the 3 inputs to turn on (or off) one of the 10 output lines. Do a google search for "74138" for more information.

    I don't have any other information on failubot 3 I'm afraid. It was never finished. I think it may have rolled around but that's it. Not entirely sure. Exact same phototransistors, motors, and h-bridge.

  15. karan Says:

    okay...do you have schematic diagrams for failurebot 5(like the one you put up for failure_bot 3?) I am really desperate for it! Please help! and i cant open the eagle cad and source code files you have up on this website. could you perhaps post them the way you did the diagram for failuerbot_3.

    thanks a lot.

  16. Micah Says:

    I wouldn't have time to do that right now. I'm sorry.

  17. karan Says:

    thats okay...thanks anyway! what program do you need to open the source code and eagle schematics link you have on this website?

  18. karan Says:

    oh okay....thanks anyway

  19. Micah Says:

    Oh right. They are opened using Cadsoft Eagle, available for FREE for Linux and Windows at http://www.cadsoftusa.com/

    The .sch files are the schematics.

  20. Micah Says:

    And by the way, the pins of the microprocessor are given names in the source code like M1PULSE which correspond to the M1PULSE pin on the schematic of the H-bridge. So if you look at the C source code you can figure out how the whole thing connects together.

  21. karan Says:

    hey there....for some reason i can only download about 30% of the file on this website(i am talking about the link you have for your schematics and code). i thought it was me but i got some friends to try and download of their computers and they also had the same problem. do you think maybe the link is corrupt or something? help?

  22. karan Says:

    hey there...need some help again....with your sensor board can you please help me understand the connections? from the jumper points LED1,2,3,4,5 and sensor out where do these wires go to? as in where do those points connect to from there onto the microprocessor?

  23. karan Says:

    and did you use photo-comparators.....do you think you could repost your c-source code? please! Could you please just explain how the sensor board is actually connected? where does are the cathodes of the LEDS connected? do they go to some place on the microcontroller? and what about the collectors of the phototransistors? where does their common connection go to on the microcontroller? or do you use some sort of decoder? please help....it really is an emergency...i would be so greatful! thanks a lot

  24. Micah Says:

    I'm on my way out for a couple days. When I get back, I'll try to help you out.

  25. karan Says:

    that would be fantastic.Thanks

  26. Kasturi Says:

    hi..can u send me the source coding for PIC16F877? i've tried writing on my own many times but failed.
    i am doin the programming for Microprocessor based digital speed controller for DC motor.can u plz help me?

  27. Yuri Says:

    hi...i don't know if you'd mentioned this in that description, but i wanna know do you implement the PID algorithms? in every serious project which connected to Line-Follower Building described that people used this tricks to callibrate data from sensors. have you heard about that? please, whrite me few words if you cleary know...

  28. RAJARAJAN Says:

    hi....
    pls help me 2 use PIC 16F877 for building the line following rbot....
    wer 2 find d details abt the circuit diagram and source code for the microcontroller!!!
    pls help!!

  29. Akim Says:

    Hey there, I was looking at the video you have posted of your robot, and your design caught my attention! I am currently working on a robot for my senior design project and I am very interested in asking you a couple of questions.

    1. What motor did you use on your robot?
    2. Why did choose that one over any others you considered?
    3. What were the other options you considered? (AC, Stepper, Servos, etc.)
    4. Did you have any problems with the motor you chose? If so how did you fix it?
    5. What are the fastest speeds and torque values?
    6. Did you do any tests for choosing your motor? If so, what were they?
    7. Essentially, what were some of the pros and cons of the motor you chose?

  30. Micah Says:

    Akim:

    Most of that is answered in the above article under the "Motors and Wheels" section.

    I considered and tried the Tamiya Dual Motor Gearbox which didn't work because a) too weak, b) too slow, and c) I broke the plastic gears when the robot hit a wall and didn't stop trying to drive the motors. The onese I selected were primarily because they were overkill in terms of torque. With my large 4" wheels, I still got enough speed and since I didn't know my robots weight or home much torque I needed, I went over.

    I did consider steppers only because I had some around, however, the "stepping up" and "stepping down" to start and stop is a little tricky and it required more I/O pins from the processor.

    I didn't measure speed or torque, however, the wheels are 4" and the motors go 31 RPM max, so there's the speed. Stall torque on those motors is 295.34 oz-in.

    As far as testing, I pretty much just attached my homemade wheel and put the motor in a vice and ran at full speed, using my finger to push on it and see how much pressure I could put without it stalling. I couldn't even stop it.

    The only cons of the motors I chose is they might be pricier than the cheaper plastic ones, and that my speed was limited. However, the speed was much greater than that of most line-followers I've seen.

  31. jahan Says:

    hi..
    me and my friend sibi planed to construct a line follower robot..
    we selected your FailureBot 5..
    we got all componets..
    we have few douts..
    1. In Motor Controller (bottom) which capasitor is used ...
    2.we didnt get OP505B phototransistor . insted we got 3 pin transistor..
    hope u will help us..

  32. Sibi Says:

    how can the sensor diagram be modified with 3 terminal phototransistors??

  33. jahan Says:

    hi
    can u explane conection between jp1 jp3 jp4 jp6 and motor control

  34. jahan Says:

    hi..
    i am jahan.. i am from india...
    can u explane the connection of port c in ur atmega8... in circute its seems like nu connected

  35. tinju Says:

    hi..
    can u explane connection of port c.. were i have to connect the port c..

  36. Micah Says:

    You can see what gets connected to where by looking at the source code in main.c All the #defines at the top define which port bit becomes which "label" in the schematic (M1PULSE, etc.)

    So, PORTD is for the LEDs PORTB is used for the motor control, and PORTC contains the ADC pin we need to connect to the photo transistor.

  37. Rodrigo Says:

    Hi Micah
    can I use a LM7805C instead of the MAX667CPA?

    Thanks and regards
    Rodrigo

  38. Micah Says:

    Yes, an 7805 regulator or any other 5V regulator is fine. I used the MAX because a) I had it lying around and b) it's more efficient.

  39. Aakash Says:

    Why do I get compiling errors?

  40. Aakash Says:

    Is there any other motor that i can substitute instead of the one here, becuase the one you have is out of stock...

  41. Aakash Says:

    Hi...The motor that you have on the tutorail is out of stock and I was going to buy a 65RPM motor...can you please help me use PWM speed control?
    I would really appreciate it. Thanks

  42. Aakash Says:

    Fix the compiling errors(i make a stupid mistake)

  43. nwabisa Says:

    hi.......where can i find the source code for line follower robot using picaxe 14A

  44. johns Says:

    can u pls tel which phototranistor u used .
    can i use 2n5777 phototransistor .
    u r work is excellent, especially u r code.

  45. johns Says:

    y do u use 8Mhz crystal, can we use 1 Mhz crystal present in atmega8 itself

  46. johns Says:

    pls reply to this
    u said u connected the phototransistor(sensor out) to portc, but there is no initialization for that in the code.

  47. saeid Says:

    help me

  48. fary Says:

    hi.
    your web is very good , your robots too.
    i have some questions for you .
    how many motors rpm in FailureBot 5 ?
    i want build a line following robot but i want use 5 optical sensors with your arrangement sensors. do suitable these sensors for line following ?

    thanks.

  49. Rodrigo Says:

    Hi Micah
    what you mean by 'pushing a button' so the robot start to follow the line? I can't see any buttons ;]

    Thanks

  50. Aakash Says:

    Rodrigo:

    I have the exact same question...

  51. ladyada’s ranting » Blog Archive » FailureBot is a success! Says:

    [...] Carrick has some really excellent AVR tutorials and detailed build notes on FailureBot5, a 5th-gen line following [...]

  52. SneakyWho_am_i Says:

    Though I've got no use for such a thing, it's certainly exciting! I've always wished I had a dremel, this makes me want one even more ;)... Anyway I'm very impressed by this thing and the way it's been put together. For someone who claimed to be not good at that manufacturingish type aspect (or even for someone who claimed to be good at it!) you did a splendid job imho!

  53. FailureBot 5 | The Kevin Pipe Says:

    [...] FailureBot 5 - A Line Following Robot [Via ladyada's ranting] Read more | Permalink | Comments | Read more articles in Robotics | Digg this! Tags: make [...]

  54. Tim Says:

    Looks great, and the detail is a big help for lots of folks! One question: Why did you switch from the PIC to the ATMega? Do you have any general advice for which to use for someone starting out? (okay, that was two questions)

  55. blink Says:

    i want to ask..my class project is to desinged line following robot usin pic16f877a..the lecturer just give a topic but he never explain to class..hope..somebody can help us..tq

  56. chella Says:

    your robot is good. i need your help.i need to build this same line follower but using the PIC16F877A .Can u help me? is it possible to convert the PIC.

  57. bluess Says:

    could you help me in find the suitable schematic for line follower robot using pic16f877a. i found a lot of the example but i don't know which one is the most suitable for my level.

  58. ghanshyam Says:

    hi...sir...
    i want to know that how i make this line follower to be more efficient fast.......

    this line follower little be slow.......

    if there is any way to speed up line folllower..

  59. ghanshyam Says:

    can you explain your pic c++ code....
    only the #define part.....
    function of each define function..
    e.g...
    what is mean by #define MOTOR_PORT PORTB.......etc...

  60. ghanshyam Says:

    can you also explain function of various function use in your c++ code........

  61. Chris Says:

    hi..can u send me the source coding for PIC16F84 i've tried writing on my own many times but failed.
    Thanks...

  62. Micah Says:

    ghanshyam:

    To make it more fast, you need either a faster motor or larger wheels. I used 4" wheels which made it quite fast but the motor I used it pretty slow (thus very strong).

    #define MOTOR_PORT PORTB is typical C syntax. In this case, I'm using these to make the code more readable. Any time you see "MOTOR_PORT" used in the code, it's going to be replaced with the address defined in the header for that part for PORTB. I wanted to use MOTOR_PORT so that if later, the motor is driven on PORTC instead of PORTB, I only have to change one line of code.

    As for explaining it more thoroughly, I don't expect to have time for that in the immediate future as I'm very busy this year.

    Also, I don't have any of the source code for the PIC16F84 or PIC16F877 versions. I've looked. I don't know where it went as I am in fact a data junkie, however, those versions were created some 5 years ago. Sorry guys!

  63. praneeth Says:

    hi Micah,
    this is really a wonderful job
    but i have a small doubt
    my requirement is a bot following white lines on black background
    but your code seems to suit my requirement but how did this work for you with just an opposite configuration.
    To be more precise adc_value will be greater than midpoint only when phototransistor responds to a light reflected from white background as light reflects less from black .
    could u please explain me how did this work for u .
    By the way iam using atmega 16
    Would be very thankful if replied

  64. ankit Says:

    hi
    am a total newbie to this robotics thingy........
    what i want to knw is how do i feed programs in microcontrollers............
    n another thing is how to write programs for it
    i knw we write in c and i can say am a pro at c but need guidance abt robotics
    hoping for a +ve response

    thanks

  65. yaksha Says:

    Hi Micah,
    As you mentioned that the PORT C needs to be connected to the Photo transistors, can you please tell me the layout of its connection to the PORT C, like how you have explained each ports(JP1,2 etc)?

  66. JAYPEE Says:

    HOW ABOUT IF IM USING 16F84A IS IT POSSIBLE?? PLZ HELP US..

  67. sneakers. Says:

    hey dude. what is the pros and cons when using the ADC of the mcu as input from the sensors, compared to GPIO as an input from the sensors? which do you think is much more better?

    cheers!

  68. robotic with linux. « Nidprod’s Weblog Says:

    [...] http://www.micahcarrick.com/05-27-2006/failurebot-line-following-robot.html#more-17 [...]

  69. chandra Says:

    hi...
    Can you help me....
    I use motor DC 12 A..
    and it make strong motor noise....
    can you tellme what can I do??

    please send in my e-maill

    chandra
    Indonesia

  70. Veeresh G T Says:

    Hi..
    Frenz I hav found a Line Following Robot without using Microcontroller...
    Please guide me, I want to do the same project for my final year project and please give me your valuable suggestions..

  71. Rakesh Says:

    Hi!!
    I am Rakesh from India. I am new in robotics. I read this line follower robot tutorial.But if I want to follow robot on white line in black background then what to do?????
    Please send me full information on my id trivedi_rakesh24@yahoo.co.in.

    Thanks

  72. aku.digit Says:

    Huh...
    Looking for control that using PID, Fuzzy_PID,neural...
    Any samples?

  73. AJEESH.P.K Says:

    Sir, i'm Ajeesh.P.K. i'm a final year B.Tech student. i've chosen line follower robot as my major project. i'm planning 2 do it with PIC 16F877 micro-contoller, IR sensors, Stepper motor ,ULN2003 driver. I'm planning 2 use 10 IR LED's. 4 of them were main line scanners. 4 of them were turn line scannersw. 2 of them were position scanners. Sir, Can u help me 2 study the working of each and every part of the robot. Pls help me 2 design the entire circuit. Plz help me 2 study the working of IR sensors, PIC 16F877

  74. iza Says:

    what component are suitable for vacuum robot?

  75. cory Says:

    Hi,

    I am new to building robots, my first attempt. Can you help me with providing the source code you used? Was it done in C/C++?

    Cheers,
    Cory

  76. shubhang Says:

    hi pls could you give me details on the 12v supply for the motors.

  77. bruce Says:

    You should post a video on youtube. id like to see this in action =]

  78. arushii Says:

    hello sir,i m actually planning to make the fastest possible line follower.could you plz mail me any thing basic,which would make my line follower faster than others.i wud appreciate any help provided.
    thank you
    arushii

  79. nihkil Says:

    may i know if i can do this robot without use of microcontroller

  80. kim Says:

    hi Micah,......am designing an AGV and i am borrowing some designs frm your circuit. now in the circuit diagram of failurebot 5 you have connected the sensor out line from the phototransistors to the INT0 pin instead of the of port c which has the ADC. is it ok? and will the value from the sensors be registered by the ADC...please help

  81. siva Says:

    i have how many components to use

  82. siva Says:

    Can you help me with providing the source code you used?

  83. violet Says:

    hi,
    i'm interested about the h-bridge..can you give me the details..urgent..thanks..

  84. ro Says:

    in the program, u hav used PD2 and named it sw_bit
    ..
    cool
    ..
    now i don know where exactly it goes outside..
    thank you..
    rest of it, excellent.. was amused. great work

  85. Linda Says:

    Hello, I have a simple question. Why are the LED's and phototransistors connected to a 10KOhm resistor? Why did you pick that value?

  86. kamil Says:

    can you explain me ebout isp kable for atmega8

  87. Linda Says:

    Why aren't the LED's grounded for the line sensor?

  88. rajesh Says:

    hats off to you, sir..

    our area of interest matches to much extend, along with i have also build line tracking bot and won first prize at NIT, Jaipur INDIA.

  89. rohith Says:

    hey, i don know where port-d2 ie. int0 goes in the external connection..
    plz help me out

  90. Raveen Says:

    hi there,

    can i have a schematic diagram of line trackin robot which using pic16f84a....

  91. karan Says:

    what are the changes in black line follower robot to convert into the white line follower robots?

  92. dewa parang Says:

    i'm using PIC16F873...is it work if i'm not define??starting include ... and then initialize

  93. asif Says:

    i am making the same project.would you please send me the program you used.

  94. alexis Says:

    hi, i am doing the line following robot. would you please send me the c programe coding tat used for the PID control of the motor?. i need it for reference. thanks a lot....

  95. Raghu Says:

    Hi What programmer you guys used to Program the PIC is it custom made or its easily available for less price..Please let me know

  96. amit kumar sharma Says:

    what is the application of line follower robot

  97. abhinav Says:

    I will be starting with my line follower robot shortly...
    Which controller should i use........
    Atmel Atmega16 or 8051 ????

    Which program i should go for
    I know BASCOM AVR and KEIL C .....
    I am in a fix....
    thanks

  98. pradi Says:

    can u please send me the complete circuit diagram and components name

  99. Farook Says:

    Hi. Great stuff. Am part of a team building a line-following robot and am in a dilemma. I have 6 line sensors. Was debating on whether to have 4 sensors inside the line and have one on each side outside the line or have 2 sensors inside the line and 2 on each side outside the line. Plz reply. Thanx.

  100. Honeysucker Says:

    great post, thanks for providing so much. Keep up the good posts.! www.hoover-f5914900.com

  101. vignesh Says:

    hi i m doing my mechanical engineerimg i need u to send the coding for the micro controller

  102. joseph Says:

    hello,

    you said that you have tried using pic16f84a, can i get a copy of your code and schematic using that pic?

    thank you very much!

  103. macky Says:

    hi mica..
    we are now constructing a line following robot with a lcd display of the distance it travels and we will be using a pic16f877..do you have any circuit??
    by the way i'm a fifth year ece student from the philippines..
    tnx

  104. Don Says:

    First of all I'd like to thank you for making the plans for your failurebot available to students, like me. It is a great piece of work, and amazing you completed it with your available resources.
    I know very little about C programming. I'm building a robot to learn something about it. I have built your failurebot, with a AVR ATMEGA162 and a 16MHZ crystal (the only mcu I have available). I'm also trying to compile it with AVR studio in Windows. Are there any changes I need to make to the code? besides #define F_CPU 16000000UL. when I tried to compile it I got some kind of error about undeclared variables and I thought, perhaps it might be because I'm using a different processor. Please direct me if you can to a C programming tutorial that can help me understand the coding better. I don't know if there is a tutorial specifically about robot programming, but if there is one I'd be very grateful for the link.
    Thanks a bunch,
    Don

Leave a Reply