Connecting ESP 32 With Ultrasonic Sensor

by Rachna Aggarwal in Circuits > Electronics

1074 Views, 1 Favorites, 0 Comments

Connecting ESP 32 With Ultrasonic Sensor

20200912_182530.jpg

Ultrasonic sensors work by emitting sound waves at a frequency too high for humans to hear. They then wait for the sound to be reflected back, calculating distance based on the time required. This is similar to how radar measures the time it takes a radio wave to return after hitting an object.

Components required: -

1. Ultrasonic sensor - https://amzn.to/3hQFSMB

2. ESP32 - https://amzn.to/3mIKSXm

3. Jumper wires - https://amzn.to/3iqdBxM

4. Breadboard(optional) - https://amzn.to/3kdp4Rt

5. Arduino IDE software

6. Arduino NANO - https://amzn.to/33VwB17

Setting up your Arduino IDE before uploading code in ESP32 is very important : - https://www.instructables.com/id/Setting-Up-Ardui...

Circuit Schematic

ultrasonic terminals.jpg
ESP32-DOIT-DEVKIT.png

Ultrasonic sensor - - > ESP32 pins

Echo Pin - - > GPIO5

Trigger Pin - - > GPIO 18

VCC - - > VIN (5V)

GND - - > GND

Code for Connecting ESP32 With Ultrasonic Sensor

esp+UV.PNG

Steps to follow while uploading code in ESP32 board

1. Click on upload.
2. If no error. At the bottom of Arduino IDE, when we get message Connecting ...,...,

3. Press Boot button on ESP 32 board till you get the message done uploading.

4. After you code is uploaded successfully. Press enable button to restart or start code uploaded on ESP32 board.

Downloads

Serial Monitor

20200912_182620.jpg
20200912_182611.jpg

Results variation is because I am changing the object position while my sensor is working.