You are on page 1of 3

Embedded Processor

EXPERIMENT NO .10

To Interface Ultrasonic Sensor with STM32F407 Trainer Board

Title : To interface Ultrasonic sensor with STM32F407 Trainer board


Prerequisites:
1. Basic knowledge of STM32F407.
2. Basic understanding of sensors, signal conditioning.
Objectives:
1. To understand the interface of sensor, STM32F407
2. Display the distance on the LCD/ Serial Terminal
Hardware/Software Required
1. STM32F407 Board, Ultrasonic sensor HC-SR04, 16 x 2 LCD, Breadboard,
Jumpers, DC power supply.
2. Keil IDE
Theory:
1. The STM32F407 board is interfaced with the LCD, the ultrasonic sensor has 4
pins, vcc, Gnd, trigger and echo. The circuit ensures contactless method to
measure distance between transceiver and fluid. We transmit short ultrasonic
pulse of 10microseconds using HCSR-04 ultrasonic sensor. The travel time of
that pulse from transceiver to object and back to transceiver is measured.
Ultrasonic pulse will bounce from liquid level since because change of density
of ultrasonic pulse travel medium (ultrasonic pulse first travel through air and
bounce of object with higher density than air). Because object has higher
density, majority of pulse will bounce off.

S. C. O. E. Department of E & TC (2021- 22)


Embedded Processor

2. The container is marked and distance is noted as actual value. The reading of
the distance calculated using STM32F407 program is noted as measured value.

Two disadvantages exist with ultrasonic method:

There is small window in which we cannot receive pulse with transceiver .This
problem can be solved by placing our sensor higher from maximum distance for
few centimeters allowing receiver to start receiving.

If container diameter is too small, signal could bounce of container’s walls and
could cause false readings.
Procedure: The difference between actual and measured value gives error, the percentage
1. accuracy canthe
Interface beSTM32F407
calculated from these
board withreadings.
the sensor and the LCD.
Upload the program on STM32F407.
2. Note the distance in the container.
3 Measure the distance using ultrasonic sensor
4 Find the error and percentage accuracy
References :

[1] Datasheet of Ultrasonic sensor HCSR-04

[2] Datasheet of STM32F407 board

Observation Table

Actual Value of Measured Value of distance


Error
Sr.no Distance(cm) using sensor (cm)
(cm)
(Scale value) (LCD Display)
1.
2.
3.
4.
5.
6.
7.
8.

S. C. O. E. Department of E & TC (2021- 22)


Embedded Processor

Flow Chart/ Algorithm

Conclusion:
__________________________________________________________________________
__________________________________________________________________________
__________________________________________________________________________
__________________________________________________________________________
__________________________________________________________________________

S. C. O. E. Department of E & TC (2021- 22)

You might also like