Let's Make Robots!

Line Follower using Atmega8

Hi all, I am new here and about to make a debut in robotics with a simple line follower robot.

I have chose AVR ATmega8 as my microcontroller because I found out that we can chose which pins we want as input and which ones as output. So this seems pretty cool for a microcontroller. Also i figured out that it is cheaply available here.

The working of my robot will be very simple. Three(or 5 if I feel later) sensors to detect white line which will be created by me. I will use a bright red LED and photoresistors to make the sensor. These sensors will give analog input to the ATmega8 which will process the data and accordingly adjust the supply for 2 DC motors(maybe using a L293D) to move the robot in different directions.

Since this is my very first robot, i want to make everything myself(means no kit, no prebuilt boards. Just a bit of advice from experienced people like you). 

The things which I need to know is :

1) Is there any use of external crystal?(i dont understand the working of this crystal part and hence hope to avoid it)

2) How do I program it (The circuit schematic for the programmer.) I read the PICAXE manual and found that programming a PICAXE is easy as the circuit requires only 2 resistors. Is programming an ATmega8 simple as that?

3)  What battery voltage shoud I use so that the circuit is not fried up. Also let me know the input/output current/voltage of parts for which I should take care.

 

My Idea of Line Sensor The values of resistance are just for example. This is what is supposed to be my white line sensors

Another thing : I will be using Imagecraft ICC AVR software for programming the microcontroller as I once saw it and found it very easy to use. I am good with C-programming(another reason to choose AVR over PICAXE)

Hope to find help soon....thnx in advance

 

Soon I will start with this and upload pics as i finish it

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

can u give me the final circuit diagram for this project??

Hi Chip...

Nice idea....

I just saw and a little suggestion comes to my mind. just see if it is helpful.

While connecting Atmega8 to L293D, it is a good idea to connect the Input2 (pin 2 of L293D) and Input3 (pin 10 of L293D) to pin 15 and 16 of  Atmega8, respectively. The advantage is that, these pins OC1A and OC1B can be used to generate a PWM and would be very helpful when you would like to control the speed of the motors by the Atmega8 (may be later when you get more comfortable with the AVRs).

Trust me its simple. All the best !!

Ok...so now I have edited my design to include the programmer....

line_follower_mod.jpg

 

now i hav added a switch to turn on/off the power supply. 

few capacitors are added to include the programmer I saw.

The crystal will be super close to the MCU in the actual circuit...here there was no space.

Also I gave direct 6V supply to the L293D for the motors(I think something is wrong here)

The green circles are pins from parallel port

 

 

 

 

 

 

 Motors_with_LED.jpg

LED_to_indicate_on_of_switch.png

 

 

 

<<<<<now this is the design for LEDs that will indicate the direction of current flowing in the motors. again i m not confident with this one<<<<<<<<

 

 

>>>>>I also added few LEDs near the on/off switch in order to see if the circuit is on or off. R stands for resistance>>>>>

 

 

The colored triangles indicate LEDs of that color.

SOrry for the creepy design and lots of trouble for you people. But since I have 0% experience in practicle field, I would like to confirm from experts so that I dont burn my components.

 

 

I am making this as my first robot...This somehow does the same thing as the "start here"

atleast the algo is same

go forward tille u can...stop....check for suitable direction...go in that direction...

I am not confident about the circuit because it has no capacitors or resistors....so it looks incomplete to me

you have it turn left (only right wheel moving) until it sees white, then turn right (only left wheel turning) until it sees white. give it a shot. btw, have you made the Start Here?

Thanks a lot ezekiel181

I have created a schematic for the robot. I know it is still incomplete.

Have a look and tell me what changes I will have to make to get a perfect working circuit

line_follower.jpgI know it is a mess but i tried my best to make it look cleaner.

Anyways let me know what improvements I will have to make

I was thinking that I have made a circuit without any capacitors and resistors so I think I maybe missing something somewhere.

Also I wish to add LEDs to make it more cool. Like when robot is turned on, it will light an LED. When a motor is in forward direction it will lit another LED. When it is in backward direction, it will lit someother LED...etc...etc

Hope to find your replies soon...I am very impatient with this one

 

 

 

 

Also for the programmer, I found this

http://elecrom.wordpress.com/2007/10/15/make-your-own-ultra-simple-universal-avr-programmer/

let me know if this counts

The programmer looks fine. I think they call those DAPA. I used one too before I upgraded my PC to one without a parallel port and found that it worked sometimes.

The schematic seems OK. Will you be using a bootloader? You`ll want to use atmega pins 2 and 3 for communication and not motor control because they`re hardware serial. 

Your motor supply is from the regulator which may push it past its limits unless they are really puny motors or you have a big regulator. Instead you can run unregulated 6v to the motor voltage pins of the L293. Pins 1 and 9 of the L293 are enable pins and can be wired to PB1 and PB2 for pwm control.

Put some capacitors around the regulator as shown here. Also put a 0.1uf ceramic across the GND and V pins of the Atmega right up close to it.

Don`t worry about resistors. You will use some later when you add more things to it like LEDs.

Think about adding a power switch and reset button to make testing easier for you.

Hi,

1) Crystals are used because they go up to higher values and they are more accurate than the internal resonator. It`s completely optional though.

2) Program AVRs with ICSP or ISP (same thing). The simplest one uses a parallel port on your computer and a few resistors and all the hard work is done by the program writing software, but buying a good reliable programmer is worth the money in the long run.

Picaxe chips, like Arduinos, have a bootloader software already on the chip. That makes uploading easy when you have to do it a lot. You can find AVR bootloaders all over the net.

3) Feed 6v through a low dropout 5v regulator to give a smooth 5v supply for the chips.