March 29, 2013

Wireless Remote Car using ATMEL 89C52 and L298 H-Bridge

This is a simple remote car using AT89C52, L298 Dual H-bridge and RF wireless Transceiver.

Requisites:

 Hardware:
  1. 1 x AT89C52 Microcontroller
  2. 1 x 89C52 Project board _with crystal, resistor array and reset ckt.
  3. 1 x Programmer (ICSP or any)
  4. 1 x 12V battery (for powering car)
  5. 1 x  9V battery & Connector (for powering remote)
  6. 1 x RF Transceiver (433Mhz)
  7. 1 x HT12E (8 bit address + 4bit data Encoder)
  8. 1 x HT12D(8 bit address + 4bit data Decoder)
  9. 1 x L298 (Dual Full H-Bridge)
  10. 2 x 7805 (5V regulator)
  11. 2 x 12V Geared DC Motor (300rpm)
  12. 1 x Castor wheel
  13. 1 x 750K Resistor
  14. 1 x 33K Resistor
  15. 4 x Micro switch
  16. 7 x LED
  17. Connecting wires
  18. 1 x Metal Chassis or Card board
Software:
  1. Keil uVision3 or later
  2. Proteus ISIS (for simulation)
  3. Programmer application
Car circuit:
Figure 1 Click on the image to see enlarged view

figure 2
In the above circuit (figure 1), Port 0 of AT89C52 is used as input port and Port 1 is used as output port. Port 0 need to have an external pullup. So by default, all port pins of port 0 is high by default. Port 0 has 8 pins (refer figure 2) with which we can have 2^8=256 combinations. But we need only 4 (Forward, backward, left and right) operations. Pin 0.6 is used as an enable for the car to operate, So the switch SW1 connected to P0.6 must be closed for the car to work. Hence 1011 1111.
Pins P0.0, P0.1, P0.2, P0.3 are used.
By default  P0.0 through P0.3 are 1s.
i.e. 1011 1111 (0xBF)
lets asign, (may differ from the  actual program)
forward - 1011 1110 (0xBE)
left - 1011 1101 (0xBD)
backward - 1011 1011 (0xBB)
right - 1011 0111 (0xB7)

The above can be achieved simply using the wired circuit in figure 3.

Figure 3 Click on the image to see enlarged view

void main(void)
{
    P0=0xFF; //Assigning P0 as input
    P2=0x00; //Assigning P2 as output
    SW1=1;
    LE=0;
    RE=0;
    msdelay(20);
    while(1)
    {
        while(SW1==0)
        {
        while(P0==0xBE) forward();
        while(P0==0xBD) left_f();
        while(P0==0xBB) backward();
        while(P0==0xB7) right_f();
        }
    }
}

Instead, if an wireless circuit as in figure 1 is to be developed, the 4 bit data (first nibble) can be received from a decoder to which the same data can be transmitted from an encoder separated by a wireless RF Transceiver set.
Figure 4
The second nibble (1011) is made available in the local circuit itself.

The output port P2 is connected to Dual Full H-Dridge (L298)

The call for forward() will enable both the motors in forward direction. Th

void forward(void)
{
    L1=1;//Left Motor
    L2=~L1;//
Enable forward
    R1=1;//Right Motor
    R2=~R1;
//Enable forward 
    LE=RE=1;
    msdelay(20);
}

 Similarly a call for left() will enable right motor and left motor will be disabled which makes the car turn left.

Remote Circuit:
The remote circuit consists of an Encoder HT12E (4 bit data + 8 bit address) consisting of 4 data pins (AD8-11) and 8 address pins(A0-7). 
Figure 5

 
A0-A7 - Either grounded or left open.
AD8-AD11 - Connected to buttons to control the directions.
This data (AD8-AD11) will be encoded and transmitted via RF wireless Transceiver and is received by decoder HT12D and the corresponding data is outputted at pins D8-D11. This output is then given to Port pins P0.0-P0.3 respectively.

Thus the wired Remote in figure 3 is replaced by wireless remote in figure 1 without any change in the program.

AT89S52 can also be used instead of 89C52


Related downloads:
Datasheets (AT89C52, L298, HT12E, HT12D, BC547, 433Mhz RF Transmitter - Receiver)
C-Program (Also available in above zip)

Disclaimer:
The above article doesn't give you any guarantee and the sole purpose of this article is to share my learning in the way I understood. Any comments to refine this article are welcome with great pleasure. Please report any breaking link by commenting below.

Receive all updates via Facebook. Just Click the Like Button Below

You can also receive Free Email Updates:

dgpride - Study Zone - Free Books - Tamil Lyrics

Copyright © 2008 -2012 dgpride. All rights reserved.

Subject/Topics

2 Marks (26) 8051 (1) AC Machines (7) Animations (1) Anna University Chennai (31) Arduino (4) ARM (3) Audio (1) Basic C Concepts (8) Basic Electronics (13) Basic principles (9) Book list (1) CAD (1) Chemical (2) Circuit theory (6) Civil (2) Cloud Computing (1) Communication (4) Competitive exams (2) Computer Architecture (4) Control system and components (9) CSE (40) Curriculum (4) DC Machines (9) Did you know (14) Digital (13) DLC (4) Documentation (1) DSP (1) EC 2201 (3) ECE (45) EDC (1) EEE (34) EIE (63) Electrical (35) Electronics (43) Electroplating (2) Emacs (1) Embedded basics (19) Embedded C Programming (19) Embedded Linux (5) Embedded System (22) Engineering basics (15) Environmental Science (1) Fibre Optics (1) Filters (2) FPGA (1) GATE (3) General (7) GNU (4) Handwritten (1) Hobbyist (15) How to (8) HTML (3) Humanities (2) IC Engines (7) ICE (5) Industrial Electronics (10) Industrial Instrumentatin (2) industrial process (2) Instrumentation (21) IoT (2) IT (2) Laboratory Manuals (17) LabVIEW (2) Lesson notes (2) LIC (2) Links (9) Linux (8) Magnetics (1) Management (1) Mechanical (5) Mechatronics (9) Microcontrollers (14) Microprocessors (9) Microsoft (1) Motivation (1) Must Know (11) Networks (1) NuttX (1) Objective type (1) Open Source (1) Opportunities (7) Oscillators (2) Part Time (1) Physics (1) Post Graduation (1) Power Electronics (12) Power Plant Engineering (2) Power Supplies (2) Previous GATE Papers (1) Process Control (2) Project (4) Protocol (1) R2008 (11) R2009 (1) R2013 (1) Recruitment (2) Research (2) Robotics (9) RTOS (3) Signal Processing (8) Signals and Systems (4) SMPS (1) Software tutorial (4) Stepper Motor (2) Syllabus (5) Texas Instruments (2) Thermodynamics (2) Training and Placement (6) Transducer Engineering (2) Transformer (2) Transmission (1) Tutorials (48) Two Marks (26) U-Boot (1) University Question Papers (16) Verilog (1) Video (4) Virtual Instrumentation (3) Visual Basic (21) VLSI (11) Web designing (4) Wi-Fi (3) Wireless (6)