Thursday, 5 July 2012

ATmega8 based line follower robot

This project is a microcontroller based line follower robot by using ATmega8 development board from "ROBOGENISIS". This development board consists of an on board USB programmer, motor driver and some other peripherals like LEDs, buzzers. This board is best for beginners.This can be programed using WinAVR,programers notepad.

ATmega8 microcontroller consist 3 ports:
  •    PORTB an 8 bit I/O port
  •    PORTC a 7 bit I/O port .But pin PORTC.6 is also RESET pin for the MCU so it cannot be used for input but remaining 6 pins can be used as inputs.
  •    PORTD an 8 bit I/O port
  In this board the ATmega8 works at 12 MHz crystal.
An on board L293D is used for driving motors. Separate power supply is provided motor driver and logic supply for MCU. Motor driver control pins are internally connected to the higher nibble (D7, D6, D5, and D4) pins of PORTD.

To get familier with basics of line follower click here.

I connected the sensors to PORTC lower 2 pins left sensor to C1 & right one to C0. Connect two motors to the motor output ports.


#define F_CPU 12000000
void main()
  DDRC=0xc0;//input for sensors make sure that all sensors are active high
                                        //( high    for wight)
  PORTC=0xff;//internal pull up
  DDRD=0xff;//motor control pins
  PORTD=0x00;//motor halt
  unsigned char sensor;
     sensor=PINC & 0x03;//masking for lower 2 bits
       if(sensor==0x03)// both are on white
  else if(sensor==0x01)//left sensor on black line
   PORTD=0x66;//left turn
  else if(sensor==0x02)//right sensor on black line
   PORTD=0x99;//right turn
   PORTD=0x00;//robot stop

similarly for 8051 the code will be:


void main()
  P1=0xff;//input for sensors make sure that all sensors are active high ( high    for  Wight)
  //sensors are connected to lower two pins                                    
//in 8051 to make a port input you need to write one's to the respected pins
  unsigned char sensor;
//assume that motor control pins are connected to either upper or lower 4 bits of PORT2
       if(sensor==0x03)// both are on white
  else if(sensor==0x01)//left sensor on black line
    P2 =0x66;//left turn
  else if(sensor==0x02)//right sensor on black line
    P2 =0x99;//right turn
    P2 =0x00;//robot stop


Wednesday, 4 July 2012

TV remote controlled robot

The most cheapest way of controlling  the devises through wireless is IR remote.Every one in the world will have a TV remote which works based on RC5 protocol or some equivalent protocol.I searched over the internet for a perfect TV remote signal decoder compatible with all sensor like TSOP  and other cheep TV sensor.I all ways thought of making such TV remote signal decoder.

But recently i found a TV signal decoder in Hyderabad.compatible with all most all TV remotes except for DVD,AC remotes.Actually it is a handmade one.I found it in a hobby shop.I bought for 295 Rs. i made some modifications regarding the power supply for direct 5V Vcc to the decoder module.
This  one outputs a 5 bit address,6 bit data,a toggle bit and a valued data bit.
One important thing is the output form the decoder module will produce active low logic
if we press "2" on the remote the 6 bit data will be"111101"
if we press "4" on the remote the 6 bit data will be"111011"
if we press "0" on the remote the 6 bit data will be"111111"

I made a robot using that module.

I used a ATmega8 development board with ob board programmer for driving the motors as per the logic.
I removed the address pins on the decoder module and i connected the 6 bit address to the PORTC of ATmega8 and an L293D is used for driving motors which is internally connected to PORTD  higher nibble on the development board.

Tuesday, 3 July 2012

home made 8051training board

Every beginner of microcontrollers all ways think of buying a prototyping board for practicing.Why don't you make your own board for working on your projects.I made a simple 8051 development board for prototyping my projects.You can make one by just spending less then 100 rupees.

For that you need very little equipment.
  • pin heads                                                                                                     
  • 40 pin IC base(i didn't get a 40 pin so i used a 42 pin) 
  • a 7805 voltage regulator
  • crystal (11.0592Mhz or 12.0Mhz as per your requirement)
  • 10kohm resistor
  • 10kohm resistor 9 pin array
  • 10uF electrolytic capacitor
  • 33pF disc capacitors
  • some connecting wires
  • a special PCB that consists of all row holes will be connected


first take a PCB with all its row holes connected as shown in the figure
 Cut the PCB as per the need of your size of board.First of all take a look at the pin diagram of AT89S52 microcontroller. The EA/VPP(pin 31) must be connected to VCC. The PORT0 must be pulled up through external pullups.So use the 9 pin 10K resistor array for pull up such that common pin to VCC and remaining 8 pins to PORT0 pins.
The power on reset circuit for 8051 will be as shown in the figure

 Connection of external ceramic crystal to the AT89S51

arrange all the components as shown in the figure below. step by step

cut the PCB like this

place the 40 pin IC base(i used 42 pin as 40 pin is out of stock)

take some pin heads
place them as per the port pins
and place the remaining required components like crystal,reset circuit,7805 voltage regulator for supply

your home made prototyping board for AT89S51.
for programing the  MCU you need a separate ISP programmer.
so many of them are available in the market. 
if you use P89V51RD2 microcontroller you just need a max232 IC and a serial cable to program it