Upload
shubham-kumar
View
68
Download
2
Embed Size (px)
Citation preview
This dev. Board contains- .ATMega-8 microcontroller .L293D H-Bridge motor driver
LUMOS
This dev. Board contains- .ATMega-8 microcontroller .L293D H-Bridge motor driver
Development Board Used
This dev. Board contains- .ATMega-8 microcontroller .L293D H-Bridge motor driver
SENSORS
3 LDR sensors have been used for detection of light sources.
With the change in the intensity of light, the voltage drop across the
LDR changes.
But the voltage generated by the LDR is analog.So we must obtain the
corresponding digital value of the voltage drop,resulting due to a
change in the intensity of light sources.
For this,we may use a comparator IC which gives digital HIGH and
digital LOW output.
Here, we are using LM324 for the same.
This dev. Board contains- .ATMega-8 microcontroller .L293D H-Bridge motor driver
This dev. Board contains- .ATMega-8 microcontroller .L293D H-Bridge motor driver
This dev. Board contains- .ATMega-8 microcontroller .L293D H-Bridge motor driver
This dev. Board contains- .ATMega-8 microcontroller .L293D H-Bridge motor driver
This dev. Board contains- .ATMega-8 microcontroller .L293D H-Bridge motor driver
This dev. Board contains- .ATMega-8 microcontroller .L293D H-Bridge motor driver
Circuit diagram
This dev. Board contains- .ATMega-8 microcontroller .L293D H-Bridge motor driver
Pins 1,7 and 8 can be used for digital outputs.
The digital outputs obtained from the comparator are given to the
microcontroller.
Here we have used PD5,PD6 and PD7 as the input pins of the
microcontroller.
PB1,PB2,PB3 and PB4 have been used as the output pins of the
microcontroller. These ports are internally connected to the H-Bridge IC
at the dev. Board.
PROGRAM We have used Embedded C for writing program for the task.
#include<avr/io.h>
#include<util/delay.h>
void main()
{
DDRD=0b00000000; //set PORTD as input port for LDR sensors
DDRB=0b00011110; //PB1, PB2, PB3, PB4 as output port
int ls=0,cs=0,rs=0;
while(1)
{
ls=(PIND&0b01000000); //set PD6 for left LDR sensors
rs=(PIND&0b10000000); //set PD7 for right LDR sensors
cs=(PIND&0b00100000); //set PD5 for center LDR sensors
if((ls==0b00000000)&(cs==0b00000000)&(rs==0b00000000))// cs and rs& ls oFF
{
PORTB=0b00010000;//go RIGHT
This dev. Board contains- .ATMega-8 microcontroller .L293D H-Bridge motor driver
ls=0;
rs=0;
cs=0;
}
if((ls==0b00000000)&(cs==0b00000000)&(rs==0b10000000))//Rs on
{
PORTB=0b00010000;//go RIGHT
ls=0;
rs=0;
cs=0;
}
if((ls==0b00000000)&(cs==0b00100000)&(rs==0b00000000))//Cs on
{
PORTB=0b00010010;//GO STRAIGHT
ls=0;
rs=0;
cs=0;
}
if((ls==0b00000000)&(cs==0b00100000)&(rs==0b10000000))// cs and Rs on
{
PORTB=0b00010000;//go RIGHT
ls=0;
rs=0;
cs=0;
}
if((ls==0b01000000)&(cs==0b00000000)&(rs==0b00000000))//ls on
{
PORTB=0b00000010;//turn left
This dev. Board contains- .ATMega-8 microcontroller .L293D H-Bridge motor driver
ls=0;
rs=0;
cs=0;
}
if((ls==0b01000000)&(cs==0b00000000)&(rs==0b10000000))//rs and ls on
{
PORTB=0b00000010;//turn left
ls=0;
rs=0;
cs=0;
}
if((ls==0b01000000)&(cs==0b00100000)&(rs==0b00000000))//ls and Cs on
{
PORTB=0b00000010;//turn left
ls=0;
rs=0;
cs=0;
}
if((ls==0b01000000)&(cs==0b00100000)&(rs==0b10000000))//all oN
{
PORTB=0b00010010;//STRAIGHT
ls=0;
rs=0;
cs=0;
}
}
}
This dev. Board contains- .ATMega-8 microcontroller .L293D H-Bridge motor driver
This dev. Board contains- .ATMega-8 microcontroller .L293D H-Bridge motor driver
Points scored
1st Run
T=1;
R=1;
2nd Run
S=5;
Total time=300 s
Run time=58 s.
=>B=121;
D=1;
T=2;
Final score=871.
This dev. Board contains- .ATMega-8 microcontroller .L293D H-Bridge motor driver
-Here Goes Our Bot “LU32”-
Developed BY-
Shubham Kumar,MD. Saeed, Dishant Akshay, Feroz Khan
IIT KGP
2nd
Feb 2013