Friday, February 7, 2014

Simple Remote control mobile bot


Components RequiredATmega32 microcontroller

  • AVR Programmer Board
  • Crystal
  • Capacitors
  • Motors 
  • L293D IC 
  • +5V supply
  • Battery equivalent to voltage rating of motor 
  • Breadboard
  • Connecting Wires
  • HT12D and HT12E 
  • RF module

Circuit Diagram


Transmitter Circuit:

Receiver Circuit:



Description

  • Enable is directly connected to +5 volt.
  • PC0,PC1,PC2 and PC3 are connected to Input 1-4 of first L293d.
  • PD0,PD1,PD2 and PD3 are connected to Input 1-4 of second L293d.
  • OUT1 and OUT2 are connected to the terminals of first motor and OUT3 and OUT4 are connected to the terminals of the second motor.(L293D -1)
  • OUT1 and OUT2 are connected to the terminals of third motor and OUT3 and OUT4 are connected to the terminals of the fourth motor.(L293D-2)
  • Reset is connected to +5V.
Note:
  • A crystal needs to be connected to XTAL1 and XTAL2 pins to provide the clock pulse in real time.

Source Code


#define F_CPU 1000000UL
#include <avr/io.h>
#include <util/delay.h>

int main(void)
{
DDRD = 0xFF;         //All pins of PORT D as output
DDRC = 0xFF;        //All pins of PORT C as output 
DDRB = 0x00;         //All pins of PORT B as input 
PORTB = 0xFF;      //Initially all pins at high output
PORTD = 0x00;      //Initially all pins at low output
PORTC = 0x00;      //Initially all pins at low output
    while(1)                      //Infinite Loop
    {
PORTB = 0xFF;
        if(bit_is_clear(PINB,0))     //Forward Run
{
PORTC = 0b00001010;
PORTD = 0b00001010;
_delay_ms(100);
}
if(bit_is_clear(PINB,1))    //Reverse Run
{
PORTC = 0b00000101;
PORTD = 0b00000101;
_delay_ms(100);
}
if(bit_is_clear(PINB,2))    //Rotate on axis(clockwise)
{
PORTC = 0b00001010;
PORTD = 0b00000101;
_delay_ms(100);
}
if(bit_is_clear(PINB,3))      //Rotate on axis(anticlockwise)
{
PORTC = 0b00000101;
PORTD = 0b00001010;
_delay_ms(100);
}
PORTC = 0x00; //reset PORTC to output zero 
PORTD = 0x00;              //reset PORTD to output zero
    }
return 0;
}




The given circuit cannot be simulated in proteus because of the absence of RF modules and HT12D and HT12E. So, in order to check the program the following circuit can be useful.





Thank you for reading.
For more tutorial and information, like the Facebook Page. 

Friday, January 24, 2014

Creating Project simulations in Proteus


Proteus is software for microprocessor simulation, schematic capture, and printed circuit board (PCB) design. It is developed by Labcenter Electronics.

  • Go To Proteus

  • Go to File->>New Project or click on New Project in the Start on your home screen of proteus.

  • In the New Project Wizard give a name for your project with the extension “.pdsprj”.
  • Make sure the check on New Project is present. Click on next.
  • Select “Create a schematic from the selected template” and choose “DEFAULT” design template and click on next.
  • If you wish you can also create a PCB layout by selecting “Create a PCB layout from the selected template” and chose “DEFAULT” but if you don’t want, just select “Do not create a PCB layout.” and click on next.
  • If you wish to create a microcontroller based project then you need to select “Create Firmware Project”.
  • We shall be using microcontrollers of the AVR family, ATmega32 controller and WinAVR compiler.
  • Now click on Next and then Finish.
  • If you want to include the hex file of a prewritten program or if you want to write your program in some other compilers like "programmers notepad" or "avr studio" you can skip this option. Later right click on the microcontroller go to "edit properties" and give the path of your hex file in the "program file".   
  • You will get a window with a microcontroller.
  • Right click on the blank area of the window and select “Place->>Component->>From libraries

  • The “Pick Device” window will open up. Just search for the required device in the Keywords.e.g. to search for any type of motor(say dc motor) type “motor”   and press enter and select “Simple DC Motor model”.

  • Press ok once you are finished.
  • Move your mouse over the linkages of the components so that the mouse pointer changes into a pencil then click on it to start connecting the wire.
  • Move the mouse to the other linkage of the component and click to connect the two devices.
  • Complete the required circuit and go to “Source Code” tab to write your program.
  •  After writing the program go to “Build->>Build Project” or press F7 to create the “.hex” file of your program.
  • If everything goes write the “VSM Studio Output” will show “Compiled successfully” else check for errors in the program.

  • Now go to Schematic Capture and go to Debug->>Run Simulation. Alternatively you can also press F12 or run icon in the bottom left corner of the screen.
  • Don’t forget to save your project.


Thank you for reading.
For more tutorial and information, like the Facebook Page.