• Electronic Kid
  • Useful-news
  • Forum
  • Fellowship
  • E-Library
  • All

EEE, ECE & IE Project Updates

EEE, ECE & IE Project Updates

Link to Electronics Hub

Ultrasonic Rangefinder using 8051

Posted: 30 Jun 2014 03:39 AM PDT

We have different ways to measure the distance. One way is to use ultra sonic module for distance measurement. This article explains you how to measure the distance using 8051 microcontroller. This ultrasonic range finder system measures the distance up to 2.5 meters at accuracy of 1 cm.

Ultrasonic Rangefinder Project using 8051 Circuit Principle:

Generally, the distance can be measured using pulse echo and phase measurement method. Here, the distance can be measured using pulse echo method. The ultrasonic module transmits a signal to the object, then receives echo signal from the object and produces output signal whose time period is proportional to the distance of the object.  The mechanism of the ultra sonic sensor is similar to the RADAR (Radio detection and ranging).

radar concept

RADAR Concept

This circuit calculates the distance of the object based on the speed of the sound wave at normal temperature and displays the distance on LCD.

Also Get an Idea about How to Interface 16×2 LCD with 8051 Microcontroller

Ultrasonic Rangefinder using 8051 Circuit Diagram:

Circuit Diagram of Ultrasonic Range Finder Using 8051 Microcontroller

Circuit Diagram of Ultrasonic Range Finder Using 8051 Microcontroller

Circuit Components:

  • At89c51 controller
  • At89c51 programming board
  • programming cable
  • 12V adaptor or DC battery
  • HC-SR04 ultrasonic module
  • 16*2 LCD
  • Pot – 10k
  • Electrolytic capacitor – 10uF, 16V
  • Resistor – 10k
  • 12 MHz crystal
  • 33pf capacitors -2
  • connecting wires

Ultrasonic Rangefinder Project Circuit Design using 8051:

The major components in this project are at89c51 microcontroller and ultrasonic module. The ultrasonic sensor TRIGGGER and ECHO pins are connected to the P3.5 and P3.2 respectively.  LCD data pins are connected to the PORT2 of the controller and controller pins RS, RW, En are connected to the P1.0, P1.1 and P1.2 respectively. Here LCD (liquid crystal display) is used to display distance of the object.  Pot RV1 is used to vary the contrast of the LCD. Power supply pins of controller and ultrasonic sensor are connected to the 5V DC.

Ultrasonic Module:

HC-SR04 ultrasonic module is designed to measure the range of the object in the embedded projects. It offers excellent range detection with high accuracy and stable readings. The operation of the module is not affected by the sunlight or black material.


  1. resolution of this module 3mm
  2. ranging distance is 2cm to 400cm
  3. angle measurement is 30 degrees
  4. trigger input pulse width is 10us
  5. required current 15mA
  6. Frequency 40 KHz

Pin configuration:

  1. Vcc:  This pin is connected to the positive 5V DC
  2. Trigg: The trigger signal is applied to this pin for starting the transmission. This signal must be HIGH for 10us. When a valid trigger signal is applied, it generates 8 pulses of 40 KHz.
  3. Echo: At this pin, module generates the signal whose time period is proportional to distance.
  4. GND:  This pin is connected to the ground.

Working of Ultrasonic Rangefinder Project Circuit:

 When HIGH pulse of 10us is applied to the TRIG pin, the ultrasonic module transmits 8 consecutive pulses of 40 KHz. after transmitting 8th pulse the ECHO pin of the sensor becomes HIGH. When the module receives reflected signal from the object, the ECHO pin becomes LOW. The time taken by the signal to leave and return to the sensor is used to find out the range of the object.

Distance in centimeters = (Time/58)

Object distance in inches = (time/148)

Distance can also be calculated using speed of the ultrasonic wave 340m/s

timing diagram


1. send high pulse for 10 micro seconds on TRIG pin

Initially P3.5 = 0;

P3.5 = 1;

delay_ms (10);

P3.5 = 0;

2. Wait until the module transmits 40 KHz pulses. When 8th pulse is transmitted echo pin becomes HIGH, TIMER0 starts counting, when input INT0 goes LOW and timer counts the time

while (INT0 == 0);

while (INT0 == 1);

3. TIMER0 value is equal to the time taken by the signal to go forward and comeback so we need to take only half time.

Time required = TIMER0 VALUE/2

4. the speed of the ultrasonic pulse is 340.29 m/s or 34029 cm/s

5. distance = speed * time à34029 * TIMER0/2

6. At 12 MHz TIMER0 gets incremented for 1us

Range = 17015 * TIMER0 * 10 pow (-6)

7. Target range = TIMER0/58 cms

How to Operate this Ultrasonic Rangefinder Circuit?

  1. Initially burn the program to the microcontroller
  2. Now give the connections as per the circuit diagram
  3.  While giving the connections make sure that Vcc of ultrasonic module is connected to 5V DC
  4. Switch on the board supply
  5. Place the obstacle in front the ultrasonic module, now you can observe the distance on LCD.
  6. Switch off the board supply.

Ultrasonic Rangefinder Project Circuit Applications:

  • Used to measure the obstacle distance.
  • This system used in automotive parking sensors and obstacle warning systems.
  • Used in terrain monitoring robots.

Limitations of the Circuit:

  • This system is not able to measure longer distances.

The post Ultrasonic Rangefinder using 8051 appeared first on Electronics Hub.

Digital Voltmeter using 8051 Microcontroller

Posted: 30 Jun 2014 01:16 AM PDT

Voltmeter is a measuring instrument, used to measure the voltage difference between two points in electrical network. Generally there are two types of voltmeters – one is analog voltmeter and the other one is digital voltmeter. In analog voltmeter a pointer moves on the scale to represent the voltage. Digital voltmeter directly displays the voltage in digits with the help of analog to digital converter. We have already seen the How to Design a Digital Voltmeter Circuit using ICL7107 in the earlier post. This article explains you how to design a digital voltmeter using 8051 microcontroller.

This project measures the input voltage from 0V to 5V. Here, the input voltage should be DC voltage to get the accurate output on LCD. If you apply AC voltage as input, then will see the continuous running numbers on LCD as AC varies continuously.

Digital Voltmeter using 8051 Microcontroller Circuit Principle:

The major components in this project are 8051 microcontroller and ADC0804. In this project, we use analog to digital conversion process to display the voltage.

Analog to Digital Conversion:

In real world, mostly we find analog data. To manipulate this data using digital systems, we need to convert analog data to digital, so that microprocessor or microcontroller is able understand and manipulate the data.

Interfacing of Physical Quantity to Digital System

Interfacing of Physical Quantity to Digital System

  1. Transducer: Transducer or sensor is used to convert the physical quantity to electrical energy. Light dependent resistor, temperature sensor, humidity sensor, gas sensor etc. are examples of transducers.
  2. ADC (Analog to Digital Converter): ADC converts the input electrical voltage to Digital value.
  3. Digital System: this system reads input digital data and displays the physical quantity on LCD for understanding purpose.

Here ADC IC generates the output digital value based on the input electrical voltage. The 8051 microcontroller reads this digital value and displays it on LCD.

Digital Voltmeter using 8051 Microcontroller Circuit Diagram:

Circuit Diagram of Voltmeter using 8051 Microcontroller

Circuit Diagram of Digital Voltmeter using 8051 Microcontroller

Circuit Components:

  • AT89C51 micro controller
  • ADC0804 IC
  • AT89C51 programming board
  • Variable resistor
  • adaptor or DC battery

Digital Voltmeter Circuit Design using 8051 microcontroller:

In the above circuit, analog to digital converter IC data bits are connected to the PORT1 and control bits INTR, CS, WR, RD pins are connected to the P3.4, P3.5, P3.6, P3.7 respectively. LCD data pins are connected to the POTR2 of controller and control pins RS, RW, EN are connected to the P3.0, P3.1 and P3.2 respectively.


This is an 8 bit analog to digital converter. This IC uses successive approximation method to convert analog values to digital. It can take only one analog data as input. The step size of this IC is varied by varying the reference voltage at pin9. If this pin is not connected, VCC will be the reference voltage.

For every 19.53mV, rise in input voltage the output is incremented by 1 value when the step size is at 5V. The conversion time of this IC depends on clock source.

ADC Features:

  • 0 to 5V analog input voltage.
  • Built in clock generator.
  • Differential analog inputs.
  • Adjustable reference voltage.

Below table shows the different step sizes for different reference voltages.

In the above circuit diagram, pin9 (Vref/2) is left open so that input voltage span can be 0 to 5V.

Step size = Vref/(2 pow(n))

Where n is resolution. For ADC0804 the resolution n=8. The digital output can be calculated using the formulae

Dout = Vin/stepsize.

Vin – analog input voltage

 For example, let the analog input voltage is 4V, then the digital output is Dout=4/19.53mV=204.

Steps to Convert the Analog Input to Digital:
  1. Make CS pin LOW and send LOW to HIGH pulse to WR pin to start conversion.

cs = 0;                            //Make CS low

wr = 0;                         //Make WR low

delay_ms(1);          //delay

wr = 1;                     //Make WR high

  1. Continuously check the INTR pin to weather conversion is completed or not. INTR pin is set to LOW when conversion is completed otherwise this pin is HIGH.

while ( intr );         //Wait for INTR to go low

  1. Make CS pin LOW and send HIGH to LOW pulse to RD pin to read data from ADC.

cs = 0;                                    //Make CS low

rd = 0;                                   //Make RD low

adc = adc_port;              //Read ADC port

rd = 1;

How Digital Voltmeter Circuit Works using 8051 Microcontroller?

  1. Initially burn the program to the at89c51 microcontroller.
  2. Now give the connections as per the circuit diagram.
  3. Connect variable resistor at the input of probes to vary the input analog input voltage.
  4. make sure that maximum analog input voltage should be less than 5V DC
  5. Connect a digital multi meter at the Pot to measure the input voltage.
  6. Now switch on the board supply.
  7. Now observe both LCD and digital multi meter, both displays the same voltage.
  8. Slowly increase the analog input voltage by varying the pot, now you can observe that both multimeter and LCD displays the same voltages so that we can say that voltmeter is working properly.
  9. Switch of the board supply.

Digital Voltmeter Circuit Applications:

  • This system is used to measure the voltage in low voltage applications.
  • Used to measure the toy batteries.
  • We can measure the physical quantities like temperature, humidity, gas etc. using this system with a little modification.

Digital Voltmeter Circuit Limitations:

  • The input analog voltage range should be 0 to 5V.
  • Using this system we can measure only one analog input value at a time.

The post Digital Voltmeter using 8051 Microcontroller appeared first on Electronics Hub.

Remote Operated Spy Robot Circuit

Posted: 29 Jun 2014 11:28 PM PDT

Have you ever tried to design a robot which can capture audio and video information from the surroundings and can be sent to the remote area? This article explains you how design a spy robot which can be controlled by the remote. The maximum controllable range is 125 meters. The remote has four switches to control the robot in four directions. The robot senses the surroundings through the CCD camera and sends to the receiver through the Radio Frequency wireless communication. We have already studied how to establish RF communication in RF Remote Control Circuit for Home Appliances post. This circuit is also designed using such kind of technology.

Remote Operated Spy Robot Circuit Principle:

When we press any key in remote, the HT12E encoder generates 8 bit address and 4 bit data. Then ASK (Amplitude shift keying) transmitter sends 8 bit address and 4 bit data to the receiver. At the remote section DIP (dual inline package) switches are used to set 8 bit address. Receiver receives these 12 bit data and gives it to the HT12D decoder to decode the data. The decoded data is given to the L293D motor driver to rotate the robot motors.

Block Diagram of Remote Operated Spy Robot:

Remote Operated Spy Robot Circuit Block Diagram

Remote Operated Spy Robot Circuit Block Diagram

Circuit Components:

  • HT12E encoder
  • HT12D decoder
  • RF 433 MHz Transmitter and Receiver
  • L293D motor driver
  • Wireless CCD camera
  • push buttons – 4
  • DC battery – 12V, 1.3 Ah
  • 9V DC battery
  • Robot
  • Resistors – 33k,750k
  • SPST switch – 1
  • NOT gates – 4

Also read the related post: DTMF Controlled Robotic Vehicle

Remote Operated Spy Robot Circuit Diagram and Design:

Remote operated spy robot has mainly two sections, one is remote control section used to control the robot and other one is video transmission section used to transmit audio and video information.

Remote Control Section:

Remote Operated Spy Robot Circuit - Remote Section

Remote Section of Spy Robot Circuit

Here HT12E encoder reads the parallel data from the switches and gives this data to the RF transmitter serially. The operating voltage of this encoder is 2.4 to 12V. The RF 434 MHz Transmitter output is up to 8mW at 433.92 MHz frequency. This ASK transmitter accepts both linear and digital inputs and operating voltage is 1.2V to 12V DC. In remote section, SW1 is used to enable the transmission.

Video Transmission Section:

In this section, major components are wireless camera, RF receiver and Robot.

Wireless CCD Camera:  The operating voltage of CCD camera is 12V DC. The supply for this camera is taken from the motors battery. The output signals of this camera are in the form of audio and video. These types of cameras are commonly available in the market.

Remote Operated Spy Robot Circuit - Video Transmission Section

Remote Operated Spy Robot Circuit – Video Transmission Section

RF Receiver:

ASK receiver receives the serial data transmitted by the transmitter and gives it decoder to convert it to the parallel. This parallel data is given to the L293D motor driver IC to control the robot motors. Here LED D5 indicates the valid transmission.

L293D Motor Driver:

L293d is a Dual H-bridge motor driver. Used as a current amplifier since it takes low current control signal and provides higher current signal as output. This output signal is used to drive the motors.

This IC drives 2 motors simultaneously, both in forward direction and reverse direction. Motor 1 direction can be controlled based on logic inputs at IN1 and IN2. Motor 2 operations are controlled based on the inputs at IN3 and IN4. Here the motors are operated with the voltage applied at pin 8.

  • IN1=0 and IN2=0 ->  Motor 1 idle
  • IN1=0 and IN2=1  -> Motor 1 Anti-clock wise direction
  • IN1=1 and IN2=0 -> Motor 1 Clock wise direction
  • IN1=1 and IN2=1 -> Motor 1 idle
  • IN3=0 and IN4=0 ->  Motor 2 idle
  • IN3=0 and IN4=1 -> Motor 2 Anti-clock wise direction
  • IN3=1 and IN4=0 -> Motor 2 Clock wise direction
  • IN3=1 and IN4=1 -> Motor 2 idle

Here Vcc is the voltage applied for the internal operation of IC. VSS is the voltage applied to drive the motors. We can apply a maximum of 36V and 600mA to drive the DC motors. Enable pins EN1 and EN2 of motor driver IC must be high to drive the motors.

How to Operate Remote Operated Spy Robot:

  1. Give the connections as per the circuit diagram.
  2. Arrange the wireless CCD camera to the robot.
  3. Give the wireless camera receiver connection to the computer or TV.
  4.  Now switch on the both robot and remote supplies.
  5. Control the spy robot using remote. Now you can observe the robot surroundings in your computer or TV.

Remote Operated Spy Robot Applications:

  1. This spy robot is used to observe the behavior of wild animals where human beings cannot reach.
  2. Used in army applications to detect the bombs.
  3. Used in industries.

Remote Operated Spy Robot Limitations:

  • This system does not work for longer distances.
  • This is a theoretical circuit and may require some changes to implement practically.

The post Remote Operated Spy Robot Circuit appeared first on Electronics Hub.