8051 Microcontroller Based Ultrasonic Object Detection Circuit

The ultrasonic sensors are used to detect the object, measure the distance of the object and have many applications. This article discusses the circuit of the Ultrasonic Object Detection sensor using 8051 microcontrollers. The Ultrasonic sensor provides the easiest method of object detection and gives the perfect measurement between stationary or moving objects. The sensor measures the time required for the sound echo to return and send the same to the microcontroller as a variable-width pulse.


Ultrasonic Object Detection Circuit

This circuit is designed to demonstrate the detection of an object ahead of the ultrasonic transducer. An ultrasonic transducer consists of a transmitter and a receiver. The transmitter produces a 40KHz sound wave while the receiver detects the 40KHz sound wave and converts it to electrical signals which are fed to the microcontroller.

Block Diagram of Object Detection Circuit

Block Diagram of Ultrsonic Object Detection Circuit
Block Diagram of Ultrasonic Object Detection Circuit

Hardware Requirements

  • Ultrasonic sensor module
  • 8051 microcontroller
  • LCD
  • LED
  • Crystal
  • Transistors, Diodes, Capacitors, and Resistors
  • Transformer
  • Voltage Regulator
  • Magnetic Gun

Software Requirements

Circuit for Ultrasonic Object Detection

Circuit for Ultrasonic Object Detection
Circuit for Ultrasonic Object Detection

Working Procedure

This circuit is designed with an 8051 micro-controller and an ultrasonic sensor. The sensor transmits the ultrasonic sound waves of kHz. When an object or obstacle comes ahead of the sensor, the sound waves are reflected. Then the receiver detects the kHz sound wave.

The circuitry converts the sound signals to electrical signals which are fed to the microcontroller interfaced. The microcontroller receives the signals and actuates the output to take appropriate action. The LCD interfaced to the microcontroller is used to display the status of the module.

This project can be enhanced to calculate the distance of the object and find the location of the object.

Ultrasonic Sensor

The ultrasonic sensor sends a high-frequency sound pulse and calculates how long it takes for the echo of sound to revert back.

Ultrasonic Sensor
Ultrasonic Sensor

The speed of sound is approximately 341 meters per second in air. The sensor uses the speed of sound in air and the time taken by the sensor to transmit and receive the sound to calculate the distance. Thus detects the object and finds the location of the object.

Distance = time X (speed of sound)/2

The sound has to travel from the sensor to object and revert it back so, divide the speed by 2.

Connection

  • Vcc: Input voltage +5 V
  • GND: External ground
  • Trig: Digital Pin 2
  • Echo: Digital Pin 2

The Trig pin is used to send the signals and the Echo pin is used to listen to the returning signals.

Note: when installing, connect the GND terminal first, otherwise, the module may get damaged.

Specifications

  • Input voltage: 5 V DC
  • Static current: <2 mA
  • Output voltage: 5 V high and 0 V low
  • Detection range: 2 cm to 500 cm
  • Dimensions: 3.4 x 2 x 1.5 cm
  • Input trigger signal: 10 us TTL impulse
  • Echo signal: output TTL PWM signal

Advantages

  • Provides precise and noncontact distance measurement within 2cm to 3m range.
  • Ultrasonic measurement works in any lighting condition, hence a supplement for infrared object detector.
  • The burst indicator LED shows measurements in progress.
  • 3 pin header makes it easy to connect to the development board directly or with an extension cable without any soldering.

Applications of the Ultrasonic sensor

Used to develop security systems, interactive animated exhibits, parking assistance systems, and robotic navigation.

8051 Microcontroller

A microcontroller is a highly integrated chip or a microprocessor with all peripherals like RAM, ROM, I/O ports, Timers ADC etc. on a single chip. It is a dedicated chip called a single-chip computer.

The 8051 microcontroller is a popular 8-bit microcontroller. It is based on 8 bit CISC core of Harvard architecture. It is available as a 40 pin DIP pin chip and works with 5volts DC input.

Block diagram of 8051 microcontroller

Block Diagram of 8051 Microcontroller
Block Diagram of 8051 Microcontroller

Salient Features of 8051 Microcontroller

  • 4KB on-chip program memory (ROM and EPROM).
  • 128 bytes on-chip data memory (RAM).
  • 8-bit data bus, 16-bit address bit and two 16 bit timers T0 and T1
  • 32 general-purpose registers each of 8 bits and five interrupts.
  • Four parallel ports each of 8 bits with a total of 32 I/O lines.
  • One 16 bit program counter, one stack pointer and one 16 bit data pointer.
  • One microsecond instruction cycle with 12 MHz crystal.
  • One dull duplex serial communication port.

Pin Description

The 8051 microcontroller is available in 40 pin DIP configuration. Among 40 pins, 32 pins are allotted for four parallel ports P0, P1, P2 and P3, each port occupying 8 pins. The remaining pins are VCC, GND, XTAL1, XTAL2, RST, EA and PSEN.

A quartz crystal oscillator is connected across the pins XTAL1 and XTAL2 with a capacitor value 30pF. If a source other than crystal oscillator is used then the pins XTAL1 and XTAL2 are left open.

Serial Communication in 8051 Microcontroller

The 8051 microcontroller has two pins for transferring and receiving the data through serial communication. These two pins are part of a port P3 (P3.0 and P3.1).

These pins are TTL compatible and hence they require a line driver to make them RS232 compatible. MAX232 is used as a line driver. Serial communication is controlled by an 8-bit register called SCON register.

Applications of Ultrasonic Object Detection Circuit

  • This project can be used for applications like wildlife photography (Motion Sensing Camera Trigger), security area monitoring, etc.
  • We can precisely measure distances with Ultrasonic Object Detection Circuit.
  • This circuit can be used as a burglar alarm.
  • Used to develop security systems, interactive animated exhibits, parking assistance systems, and robotic navigation.

Thus, this is all about making of Ultrasonic Object Detection Circuit Using 8051 Microcontroller. We hope that you have got a better understanding of this concept. Furthermore, any queries regarding this topic or wireless technology-based projects, please give your valuable suggestions by commenting on the comment section below.