Komli

Tuesday, October 6, 2009

Simple Line Follower Tutorial

Hiii Everyone, I am sorry for all the people who have been logging onto my blog as I haven't been updating a lot.

I would be explaining about making a line follower, using 3 and 2 sensors. I would also be telling the advantage of using 3 sensors over two sensors.

Prerequisites :

1) Have a sensor circuit ready. You can check my post to know how to make a sensor ckt.

2) Have microcontroller (I would be using atmega8). and a motor driver ready.

Setup of sensors:

Have the sensors setup on the chassis in such a way that center sensor is atleast 2cm away from left and right sensor.( Why 2cm you will know later).

Now the LOGIC part: Assuming that arena is white in colour and line is black in colour.

L C R Direction
1 0 1 Forward [ both motors move in same direction]
0 0 1 Left [ only right motor moves]
1 0 0 right [only left motor moves]
0 0 0 Forward. ( we have encountered a junction over here)


Code to be written :

#include
int L; //left sensor connected to 1st pin of Portc, which is PINC.0
int R;// right sensor connected to 2nd pin of Portc, Pinc.1
int C;// center sensor connected to 3rd pin of Portc, Pinc.2
main()
{

if(L==1&&C==0&&R==1)
{
PORTD=0xAA;
}
if(L==0&&C==0&&R==1)
{
PORTD=0x02;
}

if(L==1&&C==0&&R==1)
{
PORTD=0x88;
}

if(L==1&&C==0&&R==1)
{
PORTD=0xAA;
}

Motors are connected to PORTD pins.

When PORTD=0xAA;

AA stands in hex as 10101010 [ Most significant bit to least significant bit]

So the motor pins are connected as follows: Consider only the first four bits/pins, bcz we wont be using the last four bits/pins.

PIND.0= R-;
PIND.1= R+;
PIND.2=L-;
PIND.3=L+;

When R+,L+ are high. Both the motors would rotate in one direction.

When R+ is high, rest ground. Only the right motor would rotate.

Same thing for rest all.

I hope you did understand the code . I will be posting the ckt of it shortly.
If any queries please ask me.

Saturday, June 6, 2009

MICROCONTROLLER TUTORIAL 2

WHAT ALL WILL YOU WILL BE REQUIRING TO PROGRAM A MICRCONTROLLER:

1)Firstly you would be needing a burner which will transfer a hex code from your system into the microcontroller.
So first go get this thing, I will wait for you, go get the burner and see how your robots dance with ease. The cost of the burner is not more than 500 rs including shipping charges. If you want to make your own burner then it would cost you less than 250 rs.

Places to buy micrcontroller( in india only):

www.robokits.co.in
www.extremelectronics.com
www.nex-robotics.com

If you want to make your own burner then check here:

Serial programmer click here
USB programmer click here
An another serial programmer click here

2) Now that you have a burner get a micrcontroller, buy an atmega8 it has all the features like ADC, timers, PWM , that would be enough at the start later you can change this after you know more abt micrcontrollers.

I have a burner where I bought it from extremeelectronics, and I started with ATMEGA8 top program it.

3)Now that you have all the hardware part ready , the next thing which will you be needing are a couple of softwares.

1) CODEVISION AVR:
This is the place where you will be writing your code in C language and creating a hex code.(dnt wrry I will be teaching you how to write the code).
Download this software first click here to download it.

2) The next software which will you would be needing is AVR STUDIO software.
In this software you can write the code and create a hex code also, but we will be using it only for debugging. If you dint understand what you meant by debugging, then here is wat I mean. You write the code in Codevision avr, then to know how your code works you would be translating your code from codevision avr to avrstudio. In avr studio, you can c how your ports respond by looking at a simulator which shows how your microcontroller would react in reality with the code youy have written.

3)This is the last software you would be needing, which will transfer the hex code from the computer to your microntroller. This software comes with the burner, in any case your making your burner, then there will be a reference to download the corresponding software also. If your using avr usb-asp burner , just google it and you can get it easily.
When you connect the cable (either usb or serial cable ) to the computer, you need install the hardware software( as it will consider itself as a driver). This software also comes with the burner. Just install this driver software as would do to install any normal driver software for your computer. After you have installed the software, copy paste the avr usb-asp GUI window and paste it in atmel avr studio folder.

This completes all the necessary hardware and software part to burn the avr microntroller. My next post would be tomm plz check in to know how to write a code and the basics of coding.

Microcontroller tutorials 1

Hiii,

I guess I was posting too many ckts and stuff like that , now I will be starting of with microcontroller tutorial. This would be a completed tutorial of about 4-6 posts , where I would be teaching you( infact telling you) how to program microcontrollers with ease and all the problems that you would be facing when you start with programming.

There are different kind of micrcontrollers like AVR, 8051, PIC, ARM n stuff like that. Each of these has its own speciality and each being manufactured by different companies. Now in my blog I will telling you only about AVR microcontrollers as its the most cheap and an easy microcontroller to get in your local place. The cost of burner of 8051 is a lot more than compared with PIC and AVR . AVR burners are cheap than compared to PIC. Most of the hobbyist use AVR as it satisfies thier need for the projects easily.

This is the end of my first microcontroller tutorial, check my nesxt post to know what all will be needing to program a microcontroller.

Friday, April 17, 2009

Tactile Bump Sensors





button switch

These are mechanical touch sensors that are used to detect environment. They are used when you need to stop the bot after it touches some thing.

These are generally used with some whiskers like wire to detect from a far distance and mostly used in beam bots as they take very less power and give also very less power.I have seen some bots which use them for sensing the obstacles rather than using IR sensors or any other sensors as they are easier to use than ny other circuit designed sensors.

The other two types of switches are the magnetic reed switch and the membrane switch, which is much like a long button actuated switch.

Tuesday, March 10, 2009

Sensors to be used in Line follower

Hi evryone out there , I hope evryone is fyn and njyoing robotics , last 4 months had been a very tough job for me participating in ROBOCON , though we were not successful , I learnt a lot from this compt.
The first thing I would like to share is

Which Sensors to be used to detect black line??

I tried different circuits which even removes ambient light effect ( I will be posting the ckt oif it ) and IR sensors .Though I liked IR sensors the most , I was amazed to see the results when I used LDR sensors and White light . I used white light as my transmitter and LDR with a black tape covered as my reciever. The results were very good but the opnly problem was this is more sensitive to ambient light than IR sensors , but the change in ouput voltages were arnd 2 volts where as ir sensors always gave a change in output voltage of .89 .

If u want you can use LDR sensors with out a potmeter and opamp which I showed you in my ir sensor ckt.Give a try with ldr reciver ckt by replacing the transmitter and reciver with white led and LDR sensor

4 amp Motor Driver ckt

This is a 4 amp motor driver ckt which i have used in my recent robotics competition ROBOCON where i was driving a power window motor which used to give arnd 25 kgcm torque.
Thinking abt all the financial crisis we had, I choose this ckt which reduces to dig our pocket .

As i have explained in my previous motor driver ckt that there will be two channels in a motor driver IC, each channel giving arnd 1amp in case of l2938d and 2amp in case of l298 . Now i drove both the channels in parallel and hence i was getting 4amp current, this is the most simplest of all motor driver circuits which need more current to drive motors.


W1 and W2 are the inputs, by varying the inputs with 1 and 0 we get different ouputs which drive a motor. Remember to use a heat sink and dont touch it when you turn on the power of it.
The diodes at the motor end are only needed as protective fly back diodes , to protect the motor driver ic , from the current which starts flowing from the motor in back ward direction because of switiching ON and OFF at most of the times. These diodes protect the flow of current to motor driver IC.