Sunday, 10 June 2012

Computer Controlled Wireless Robot

The main objective of this project is to design a robot that can be controlled wirelessly from a computer serial port.



It consists of 2 modules

1. Transmitter


The transmitter consists of 8051 module with a serial port and interfaced to a RF Transmitter module. The microcontroller reads the commands sent by the computer from the serial port, interprets for the direction of the robot and sends the command to RF Transmitter and an acknowledgement back to Computer. We have commands such as "Left" - L, "Right" - R, "Forward" - F, "Reverse" - B, "Stop" - S.

For example, if a code "R" is sent from the Computer serial port the microntroller sends "0x01" to RF Transmitter and a string "Right" back to the computer indicating the direction the robot is going to move.

To Interface 8051 with RF Transmitter, we use a Encoder IC HT12E. A0 to A9 on HT12E represents the address and we have it set to 0x00. Data pins D3 to D0 on the encoder is interfaced with P1.0 to P1.3 of 8051. TE pin of encoder is "Transmission Enable" which enables  transmission of data only when it is "Active Low". In our case, the transmission enable is controlled programatically with P1.4 of 8051. The complete circuit is below.


8051 Microcontroller interface with RF Transmitter HT12E
8051 Interfacing with RF Transmitter and Encoder HT12E

2. Receiver


The 8051 interprets the commands received by RF receiver and sends appropriate signals to H- Bridge for the control of the robot.

The receiver consists of

a. RF Receiver
b. Decoder Chip HT12D
c. 8051
d. H-Bridge L293D
e. DC motors.

To Interface 8051 with RF Receiver, we use a DecoderIC HT12D. A0 to A9 is complementary to Address set on Encoder and hence it is 0x00. Data pins D3 t0 D0 are interfaced to pins P1.0 to P1.3 of 8051. Whenever data is received, Pin 17 of the decoder goes high. We use a switching transistor to invert it to "Active Low" to enable us to interface it with "Active Low" INTO Interrupt of 8051. So whenever data is received, INT0 is triggered. The microntroller reads the data from the P1.0 to P1.3 and sends appropriate signals to H-Bridge via P0.0 to P0.3 to control the motors.


8051 Microcontroller Interface with RF Receiver HT12D
8051 Interface with RF Receiver and RF Decoder HT12D

Tuesday, 8 May 2012

GeoLocation Tracking with GPS and GSM

The main objective of this project is to design a system where the location of the client module can be remotely sent to a customer on demand in human readable address


It consists of 2 main modules

1. Server Module

  • GSM modem : The server GSM modem will take the request from the customer in the form of a SMS to track the client module
  • Server Application : The server application keeps polling the server GSM modem for any request from customer or response from client module. For any request from customer, it will send a request to client module to send the Geo Location data. In case of response from client module, it will Reverse Geocode the Co Ordinates using Yahoo&Reg/ Google&Reg reverse geocoding service and send an SMS with the location in a human readable address

2. Client Module

  • GSM modem : The client GSM modem is used to receive and respond to location request
  • ARM processor : When there is request on the location, the ARM processor takes the raw data from GPS receiver and converts them to Geolocation Co-ordinates and sends the same to Server module using client GSM modem

Note:

  • In this project we wanted to send the location as human readable address and hence Yahoo® / Google® Reverse Geo Coding is used. In case only Geo Co ordniates is required to be sent, it will not require a Server Module
  • Below are the examples of Rest Webservices of Reverse Geocoding. The XML is parsed in the Server Application program
        Google® : http://maps.googleapis.com/maps/api/geocode/xml?latlng=12.971891,77.641154&sensor=true

        Yahoo® : http://where.yahooapis.com/geocode?q=12.971891,77.641154&gflags=R&appid=[yourappidhere]
  • The processor in the client module required 2 serial ports one for GSM modem and the other for GPS reciver. Hence ARM processor was chosen over 8051

Monday, 16 April 2012

LCD Interface with 8051 Microntroller


C Code


#include <regx51.h>
#define LCD_COMMAND 0
#define LCD_DATA 1
#define LCD_RS P0_0       //Edit it per your circuit design
#define LCD_RW P0_1       //Edit it per your circuit design
#define LCD_EN P0_2       //Edit it per your circuit design
#define LCD_PORT P2       //Edit it per your circuit design

char *message_1 = "electronicsprojs";
char *message_2 = ".blogspot.com";

/*Function Prototypes*/

void LCD_delay(unsigned int);
void LCD_putc(int,int);
void LCD_puts(unsigned char*);
void LCD_init();

main()
{
 LCD_init();
 LCD_putc(0x80,LCD_COMMAND); //Write to Row 1
 LCD_puts(message_1);
 LCD_putc(0xC0,LCD_COMMAND); //Write to Row 2
 LCD_puts(message_2);
 LCD_delay(1000);
 while(1);
}

void LCD_init()
{
 LCD_EN = 1;
 LCD_RS = 0;

 LCD_putc(0x38,LCD_COMMAND); //Use 2 lines 5X7 matrix
 LCD_putc(0x0C,LCD_COMMAND); //Display on Cursor on
 LCD_putc(0x01,LCD_COMMAND); //Clear Screen
 LCD_delay(256);
}

void LCD_delay(unsigned int i)
{
 while(i>0)
  i--;
}


void LCD_putc(int character, int type)
{

 LCD_delay(10);
 LCD_RS = type;  //1 : Write Data, 0 : Write Command
 LCD_RW = 0;
 LCD_PORT = character;
 LCD_EN = 0;   //Latch data with a low to high pulse
 LCD_delay(10);
 LCD_EN = 1;
}

void LCD_puts(unsigned char *string)
{

 while (*string)
 {
  LCD_putc(*string++,LCD_DATA);
 }
}


Sunday, 1 April 2012

Infrared Beam Break Detector

This purpose of this article is to design a circuit using Infrared signals to detect a beam break which can be used in multiple real world applications. The IR receiver used is TSOP1738. Below are some of the main requirements of Infrared Transmiter signal properties as described in the datasheet
  • Carrier frequency should be close to the  center frequency of the bandpass (38kHz)
  • Burst length should be 10 cycles/burst or longer
  • After each burst which is between 10 cycles and 70 cycles a gap time of at least 14 cycles is neccessary

Design


1. Carrier Frequency (f1) : The center frequency of TSOP1738 is 38kHz

f1 = 1.44/((Ra1+2Rb1)C)
f1 = 38kHz

Let
Ra1 = 1k
C = 0.01uF

With that Rb1 = 1.394k or
Rb1= 2k variable resistor


2. Burst and Gap frequency (f2) : Let burst cycle equals gap cycle be equal to 40 cycles (burst between 10 and 70 cycles and gap greater than14 cycles)

f2 = 38k/ 40
f2 = 950
f2 = 1.44/((Ra2+2Rb2)C)

Let
Ra2 = 10k
C = 0.01uF

With that
Rb2 = 70.789k or
Rb2 = 100k variable resistor

Note:
1. BC547 is used at the output of transmitter as switching transmitter to boost the voltage increasing the range.

2. When the Infrared beam is broken, the output of TSOP1738 goes high. Using switching transistor 2N2222, the signal is inverted to High to Low which can be directly interfaced to External edge triggered interrupts of 8051 (EXT0 and EXT1)

Infrared beam break detector transmitter receiver circuit

Saturday, 31 March 2012

Global Positioning System – How does the receiver calculate the range from satellites?

It is now clear from the previous discussion that the receiver has to calculate the distance of the GPS antenna (range) w.r.t each of the satellites that it is tracking1.

The GPS satellite signal structure plays a major role in this range estimation. GPS transmissions utilize Direct Sequence Spread Spectrum (DSSS CDMA) modulation technique in which each satellite is associated with a unique code (called the Pseudo-random code or PRN code). The data from each satellite is first encoded using this PRN code and then transmitted using BPSK modulation.

There are two types of codes that a GPS satellite uses – the coarse acquisition or the C/A code and the precise P code. Most of the commercial GPS equipments only utilize the C/A code for position determination (More on the signal structure in future blogs). For the moment let us just note that these codes are a special category of PRN codes called the “Gold codes” which have exceptional auto-correlation and cross-correlation property. These properties mean that –

  • The PRN code of a satellite has very little or no similarity with the shifted version of itself
  • The PRN code of any one satellite has very little or no similarity with the PRN codes (even shifted versions) of all other satellites

Hence in order to decode the data from the satellite, the receiver must produce a replica of the PRN code (which acts like a key to the locked data), which not only matches with the satellite Id but also matches the time shifts incurred due to propagation from satellite t user. Let us see this in more detail.

Consider the following case in which the satellite has transmitted the signal at t = t0 s. But due to the propagation delay, it has reached the receiver after a delay of td seconds –

The task of the receiver is thus to generate the replicas of the PRN code for the satellite with all possible shifts and determine that amount of shift for which the incoming PRN code matches the generated code (i.e. has the&nbsp; maximum correlation).
Now, if the time at which the satellite has transmitter the signal is known (t0) and the satellite clock and receiver clock are in perfect synchronization, then the shift required to match the incoming signal would exactly provide us with the propagation delay td. The range or the distance is immediately determined as this ∆t multiplied by the speed of light c (approximately 3 x 108 m/s).

But, the story is not that simple. The satellite clock is a very high precision atomic clock and the clock at the receiver is a low precision clock. Hence the propagation delay thus obtained suffers from what is called “user clock bias”.  One good thing about this clock bias is that since all the satellites are perfectly synchronized (or in other words, their errors can be estimated to high degree of accuracy), this user clock bias is a common error to all the satellite signals. This clock bias is the fourth variable in the range equations that needs to be estimated.


The range information thus obtained does not truly provide us with the geometric range of the satellite to the user but contains
  1. Geometric range from satellite to user
  2. User clock bias factor
  3. Offset between the system time and satellite clocks
  4. Other delays due to atmospheric errors (ionospheric and tropospheric)
Hence this range is referred to as “Pseudo range” rather than actual range.


Let us assume that the satellite clock bias can be accurately estimated and the atmospheric errors can be neglected (as of now). We can thus construct the range equations from the pseudo-range measurements from (at-least) four satellites as:

R1=√((x1 - xu)2 + (y1 - yu)2) + (z1 - zu)2) + ctu

R2=√((x2 - xu)2 + (y2 - yu)2) + (z2 - zu)2) + ctu

R3=√((x3 - xu)2 + (y3 - yu)2) + (z3 - zu)2) + ctu

R4=√((x4 - xu)2 + (y4 - yu)2) + (z4 - zu)2) + ctu

Where,
  • R1 to R4 are the pseudo-ranges from four satellites being tracked
  • (x1,y1,z1) correspond to the position of satellite 1 in x, y, z coordinates (and similarly for other satellites)
  • (xu,yu,zu) correspond to the position of user in x, y, z coordinates is the range due to user clock bias
Solving these equations for a Least-Square solution yields us the estimations of the user position.
The GPS system not only provides us with accurate position information but also accurate velocity and time information as well. Hence the complete GPS solution is called a PVT solution (Position, Velocity and Time). We shall discuss more on how each of them is extracted in future blogs.
1Tracking is a process of continuously monitoring the satellite signal parameters and extracting information from them

Saturday, 17 March 2012

Sending SMS using AT Commands

This article describes sending a SMS from a Microcontroller through a GSM modem using AT Commands. through RS232. AT commands can be sent to a GSM modem via a computer serial port or from the serial port of a 8051 Microcontroller.

Computer serial port


1. Connect your GSM modem to the computer serial port. New systems nowadays dot not have serial port, hence you would need to buy a USB to serial converter and connect the GSM modem to it.

2. If you are using Windows XP® OS, open Programs -> Accessories -> Communications -> HyperTerminal

3. Select the COM port you have the modem connected to.

4. Check the port settings, make sure that the baud rate matches with that of the GSM modem and and also that the Flow Control is set to "None".

5. Type the AT Commands below in the HyperTerminal Editor

AT+CMGF = 1 and Enter
AT+CMGS="+919449XXXXXX" and Enter
"Electronicprojs.Blogspot.com" and Hit CTRL+Z

6. In Windows 7® OS though, there is no hyperterminal program inbuilt. You will have to download a similar one. There are many good free programs available.

7. You would need to note that in this case we are connecting the serial port cable from Female pin (GSM Modem) to Male pin (Computer). Hence no crossing is required. In other words, we should use a straight cable.

8051 MicroController Serial port


1. 8051 SFR's are programmed for a baud rate of 9600.

2. Send the AT commands in #5 above through code. For Enter use escape character "\r" and for CTRL+Z use ASCII 0x1A.

3. The serial port cable is connecting from Female pin (GSM Modem) to Female (8051 Board). So you need a have a female to male converter. Also, make sure that the Rx and Tx inside in the converter are crossed. In otherwords, the Rx pin of GSM Modem should go to Tx pin of 8051 microntroller. This is called a crossed cable.

4. Below is the C program using Keil® Compiler for 8051. We added infinite while loop after the sendsms() routine because otherwise we found that the code compiled was sending the SMS in a infinite loop.

Note : Beginners always complain about their code working through serial port of a computer but the same not working through chip. It is very essential to understand the difference between crossed cable and straight cable as well as the pins configurations of male and female connectors before starting.

C program

#include <REGX51.H>
#include <AT89X51.H>

unsigned char *command_AT = "AT\r";
unsigned char *command_CMGF = "AT+CMGF=1\r";
unsigned char *command_CMGS = "AT+CMGS=\"+919449XXXXX\"\r";
unsigned char *message = "electronicprojs.blogspot.com";
unsigned char CTRLZ = 0x1A;

void puts(unsigned char* ptr);
void putc(unsigned char chr);
void sendsms(void);
void initialize();

main()
{
initialize();
sendsms();
while(1);
}

void initialize()
{
SCON  = 0x50;   /*SCON: mode 1, 8-bit UART, enable receive      */
TMOD |= 0x20;   /*TMOD: timer 1, mode 2, 8-bit                  */
TH1   = 0xFD;   /*TH1:  for 9600 baud                           */
TR1   = 1;      /*TR1:  timer 1 run                             */

}

void sendsms()
{
puts(command_AT);
puts(command_CMGF);
puts(command_CMGS);
puts(message);
putc(CTRLZ);
}

void puts(char* p)
{
char *temp = p;  /*temp pointer so that the actual pointer is not displaced */
while(*temp != 0x00)
{
putc(*temp);
temp++;
}
}

void putc(unsigned char chr)
{
SBUF = chr;
while(TI==0);  /*Wait until the character is completely sent */
TI=0;                    /*Reset the flag */
}

Tuesday, 6 March 2012

Global Positioning System (GPS) - Introduction

Global positioning system (GPS) is a satellite based navigation system that provides the user with accurate position and time information. Today we find GPS receivers in almost every field – right from car navigations systems to missile launches, mobiles to aircraft - GPS is becoming an integral part of our lives. Here is an attempt to make the readers better understand the GPS system and to some extent, the techniques involved in its working

GPS consists of a constellation of satellites (at least 24) that are deployed into orbits of 20000km. The data transmitted by the satellites is a Direct sequence spread spectrum (DSSS) signal with each satellite having a unique PRN (pseudo random noise) code of its own. The satellites are identified by this unique code that is a part of the signal that they transmit. The satellites have Ids from 1 to 32.

The orbits are inclined at an angle of 55 degrees to the equatorial plane. The choice of orbit is such that there are at-least 5 satellites visible to a GPS receiver (with an open sky view) from any point on earth. The satellites orbit the earth with an orbital period of 12hrs. Hence the visibility scenario at any point on earth repeats itself every 24 hrs. It simply means that, if at a particular point on earth, I see satellites with Ids 2, 4, 10, 17, 25, and 20 then I would see the same set of satellites tomorrow at the same time.

The basic idea of GPS positioning – Trilateration

Trilateration is the basic theory behind GPS positioning. Let me explain this in very simple terms.Consider a planar (2D) system in which I have three reference points or base stations (BS) which are transmitting signals and a mobile station (MS) or a receiver capable of receiving and decoding the signal from these base stations. The positions of these BS are fixed and are known to the MS.

Let us assume that the data sent by each of the BS has sufficient information such that the MS is able to calculate the accurate range or distance from the BS i.e. if MS decodes signal from BS1, it can obtain its exact distance from BS1.


Now, I know my distance (d1) from BS1 and as said earlier, I know the location of BS1. This means that the position of the MS is anywhere on the circle centered at BS1 and with a radius d1.




Similarly if the MS can decode the signal from BS2 and obtain the distance d2 from it, then the ambiguity associated with the position of MS reduces to the intersection of the two circles (with BS1 and BS2 as centers and d1 and d2 as radius respectively). Hence the position is either point A or point B as shown in the figure. Extending this idea to one more BS reduces the ambiguity to a point that is the intersection of all the three circles thus formed.


Now that you are convinced with the position determination in 2D space, we can extend the same to position determination in 3D space with MS being your GPS receiver and BS being the satellites in orbit. The range information from one satellite would give you a sphere, two satellites would give you a circle and three satellites would give you two points. One of these points, the true position will be towards the surface of the earth and the other will be on the other side of the satellite orbit and is discarded.

NOTE:
  • Even though it seems that only three satellites are essential for position determination, in practice 4 are required due to the low precision clock on the receiver (more about this later)
  • The positioning can also be thought of as a linear system of three unknowns (position co-ordinates x, y, and z) of the receiver, which requires at-least three equations to solve. These three equations are obtained by three satellites.
  • The fourth unknown called the user clock bias requires the range information from the fourth satellite.

Sunday, 4 March 2012

Ultrasonic Transmitter and Receiver


Introduction


Ultrasound is a form of cyclic sound pressure with a frequency greater than the upper limit of human hearing, this limit being approximately 20KHz. Some animals – such as dogs, dolphins, bats, and mice – have an upper frequency limit that is greater than that of the human ear and thus can hear ultrasound. Ultrasonic waves, however, being inaudible to humans, have little or no effect on the ear even at high intensities. Ultrasonics have found wide industrial use like nondestructive testing an object is irradiated with ultrasonic waves; variation in velocity or echo of the transmitted waves indicates a flaw. Fine machine parts, ball bearings, surgical instruments, and many other objects can be cleaned ultrasonically. Metals can be welded together by placing their surfaces in contact with each other and irradiating the contact with ultrasound. The molecules are stimulated into rearranged crystalline form, making a permanent bond. Ultrasonic whistles, which cannot be heard by human beings, are audible to dogs and are used to summon them.

Transmitter


Working

  • The 555 IC is used here as an astable multivibrator
  • It oscillates at a frequency of about 40kHz. An ultrasonic transmitter transducer is used here to transmit ultrasonic sound very effectively
  • A 10k pot is provided to vary the frequency of the astable multivibrator to adjust for maximum performance
  • During the positive half cycle npn transistor SL100 is turned on while during the negative half cycle pnp transistor SK100 is turned on effectively doubling the peak to peak voltage fed to the ultrasonic transducer
Design

f = 1 / (0.693 * ( Ra+ 2Rb)*C))
f = 40kHz which is the center frequency of most ultrasonic transducers
Let C  = 680pF     
      Rb = 10kOhm
Let Ra be made up of two resistors, fixed Ra1 and variable VRa so that
      Ra = Ra1  + VRa
Let Ra1 = 4.7kOhm
Then VRa = 16.47kOhm so that Ra ≈ 22kOhm
Practically we use VRa = 20KOhm variable resistor and tune it

Note : In our case, the closest capacitor to 680pF available in the market was 560pF. We replaced the same in the circuit and it worked with tuning of VRa


Receiver

  • When there is an obstacle the ultrasonic sound is received by ultrasonic receiver transducer. It converts it to electrical variations of the same frequency
  • Ultrasonic receiver also uses a two-stage amplifier, a rectifier and an operational amplifier in non-inverting mode. Output of op-amp is connected to a buzzer
  • These signals are amplified. The amplified signals are then rectified and filtered
  • The filtered DC voltage is given to non inverting pin of high frequency op-amp CA3140. The inverting pin of op-amp is connected to a variable resistor
  • The 9v ouput voltage of comparator is made microcontroller compatible by using a 7805 voltage regulator


Circuit Diagram



Ultrasonic Transmitter and Receiver Circuit
Ultrasonic Transmitter and Receiver Circuit

People Counting Machine with GSM

The main objective of this project is to design a system which counts the number of people present inside a premises with the count being sent automatically as an SMS upon dialing the phone number.


It consists of 3 modules

1. Infrared Transmitter and Receiver
There are two of them say IR1 and IR2. Breaking the beam of IR1 first and then IR2 will increment the count by 1 where as breaking the beam IR2 and then IR1 will decrement the count. The output of IR1 and IR2 are connected to microntroller interrupts INT0 and INT1 respectively. Complete design of IR Tx and Rx can be found here : Infrared Beam break Detector


2. Microncontroller with LCD
The microcontroller used here is 89c51. INT0 and INT1 of the micronctroller is connected to output of IR1 and IR2 respectively. It is connected to a GSM module via a serial port. And the microncontroller is also connected to a LCD which displays the total count at any given point of time. The microntroller increments or decrements the count based on weather INT0 interrupt occurs first and then INT1 or vice versa and continuously displays on the LCD. Micronctroller will also receive a serial interrupt when there is an incoming call in whch time it will read the phone number, disconnect and send the total count as a SMS

3. GSM Module
The microcontroller sends AT commands to GSM module to read the phone number, disconnect and send an SMS to the calling number. Below are the AT commands used.

1. Disconnect a call
ATH  and Enter

2. Read the phone number of an incoming call
  • Set the below AT command only once
  • AT+CLIP=1 and Enter
  • When there is a incoming call, the data from GSM will be similar to below for default settings
    • RING
      +CLIP: "+919449XXXXXX",145,"","",0
      RING
      +CLIP........
    • Read the phone number above into an array and send the SMS
    3. Send an SMS

    AT+CMGF=1 and Enter
    AT+CMGS="+919449XXXXXX" and Enter
    "Hello World" and CTRL+Z

    During programming CTRL+Z requires to be sent as 0x1A Ascii character while the escape character for Enter is '\r'. For better understanding on sending a SMS and C code, refer to Sending SMS using AT commands


    Saturday, 25 February 2012

    Burglar Alert through SMS

    The main purpose of this project is to design a system that would automatically send SMS to a predefined number up on the Infrared beam is broken between transmitter and receiver.


    It consists of 3 modules

    1. Infrared transmitter and receiver
    It consists of 38kHz Infrared transmitter and TSOP1738 Infrared receiver. The transmitter has 40 burst cycles and 40 gap cycles that satisfies the requirement of TSOP1738 that between 10 to 70 burst cycles, there has to be atleast 14 gap cycles. Complete design can be found here : Infrared Beam Break Detector circuit

    2. Microcontroller
    The microcontroller used here is 89c51. When the Infrared beam is broken, there is a high to low signal in the Infrared Beam Break Detector circuit. The micrcontroller is initialized to received edge triggered external interrupt (EXT0). When a interrupt is triggered, the micrcontroller sends the necessary AT commands to send an SMS to a predefined phone number.

    3. GSM modem
    The microcontroller sends AT commands to GSM module to send an SMS to the predefined number. Below are the AT commands used. The AT commands are

    AT+CMGF=1 and Enter
    AT+CMGS="+919449xxxxxx"
    and Enter
    "Burglar Alert!" and CTRL+Z

    Complete explanation and C-code can be found here : Sending SMS using AT commands

    Friday, 24 February 2012

    Light Following Robot

    The main purpose of this project is to design a robot which would follow the path of higher luminescence across all directions.It is based on the principle that resistance of a LDR changes with the amount of light falling on it.


    It consists of 3 modules

    Sensor Circuit


    It consists of 4 LDRs' arranged at each side of the robot (front, back, left, right). The resistance of an LDR will decrease with the increase in the luminescence. This variation is fed to a comparator with a reference voltage set. We use LM324 IC which conveniently has 4 comparators on a single chip. In our case we found that each LDR was having different response the same luminescence. For example, for the same indoor daylight the LDR resistances were respectively 6k, 8k, 9k, 10k. To offset this variation, we are using seperate pot for reference voltage for each LDR. You can use a single pot and use the same reference voltage for all 4 LDR's if you find that LDR's are having the same response (i.e shorting pins 3,5,10,12 in LM324). The 4 outputs of comparator is fed to a port of Microcontroller 8051 via port P0.
    Light Detection Circuit

    Microcontroller


    The microntroller used here is 89c51. The microcontroller gets the sensor inputs via port P0. The micrcontroller will drive the robot only when one of the LDR's resistance (i.e one of front, back, left, right) is below the threshold and consequently the output of the comparator is logic HIGH. The microcontroller will send the signal for the robot to drive in specific direction via port P1. One thing to note is that the robot can move either forward or backward. In case it moves forward and then right, the robot turns right looking into forward direction. Similarly, if the robot moves in the opposite direction i.e reverse and then right, the robot needs to move right looking into reverse direction (or left looking into forward direction).


    DC motors with H-Bridge


    The DC motor driver or H-bridge IC used here is L293D. The H-bridge converts the logic voltage 5v into DC motor specific 9v and also takes care of back emf when the DC motor direction reverses. The microcontroller send the signals to H-bridge via P1 based on which the robot moves in the specific direction (or stops). The DC motors used here is 150RPM, considering that there is not much load, higher RPM motors can be used to get higher speed.

    8051 Microcontroller Interface with H-Bridge L293D



    Path Following Robot with Obstacle Detection


    The main aim of this project is to design a robot that can follow a black path without collisions detect the end of the path and turn back. The black path below the car can be determined using the principle that black color absorbs all radiations and the presence of an obstacle is detected using ultrasonic waves.





    The project comprises of four main blocks

    Infrared Transmitter and Receiver


    IR transmitter consists of a IR led while the receiver used is IR transistors L14G2. When the Infrared rays fall over base of the IR Led, it is turned on. To catch this variation, the collector of IR transistor is fed to a comparators in LM324 IC  as shown in the circuit diagram. We use 4 such Tx Rx modules each at the corner of a rectangle. When the robot reaches the end of the path, only the forward Tx Rx detect white path while the backward Tx Rx module still detect the black path. This case is used to turn around the robot until the forward Tx Rx modules detect black path. In other cases, the robot turns left if one/both of the right Tx Rx module detect a white path. Similarly, the robot turns right if one/both of the left Tx Rx module detect white path. If all of the Tx Rx module detect a black path the robot moves forward.
    Black Line Detection Circuit
    Black Line Detection Circuit

    Ultrasonic Transmitter and Receiver

    Ultrasonic signals are used to detect obstacles in the path of the robot. Ultrasonic signals scores over Infrared signals in that they can detect obstacles of irregular shape as well as that of black color. Complete design of the circuit can be found here :  Ultrasonic Transmitter and Receiver

    Microcontroller


    The  microcontroller used here is 89c51. It is interfaced with DC motor driver H-Bridge IC L293D. The pins P0.0 to P0.3 receive the 4 IR signals indicating weather they are on black or white path. The microcontroller is programmed to drive the robot in either forward, left or right direction. The   microcontroller also continuously monitors the pin P0.4 which is connected to the output of ultrasonic obstacle detection circuit. When the pin P0.4 detects a obstacle, the microcontroller stops the robot. On reaching the end of the path, the microntroller rotates the robot until it encounters the black path and then continues foward. 


    
    Microcontroller Interface to H-Bridge
    Microcontroller interface to H-Bridge

    H-Bridge and DC motors


    The robot is driven by DC motors. To drive the motors we use an H-bridge-L293d which boosts the microcontroller logic voltage to 9v that is required to drive these motors. In our case, we used a 9v, 100rpm DC motor. To achieve higher speeds, DC motors of higher torque and voltage can be used.