Introduction: Connecting ESP 32 With Ultrasonic Sensor
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...
Step 1: Circuit Schematic
Ultrasonic sensor - - > ESP32 pins
Echo Pin - - > GPIO5
Trigger Pin - - > GPIO 18
VCC - - > VIN (5V)
GND - - > GND
Step 2: Code for Connecting ESP32 With Ultrasonic Sensor
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.
Step 3: Serial Monitor
Results variation is because I am changing the object position while my sensor is working.