Arduino and ESP8266 Wi-Fi Enabled Ultrasonic Distance Sensor
View and Edit Project In Cirkit Designer
Circuit Documentation
Summary
This circuit involves an Arduino UNO, an HC-SR04 Ultrasonic Sensor, and an ESP8266 NodeMCU. The Arduino UNO serves as the main controller, interfacing with the ultrasonic sensor to measure distance and communicating with the ESP8266 for potential wireless data transmission.
Component List
Arduino UNO
- Description: A microcontroller board based on the ATmega328P.
- Pins: UNUSED, IOREF, Reset, 3.3V, 5V, GND, Vin, A0, A1, A2, A3, A4, A5, SCL, SDA, AREF, D13, D12, D11, D10, D9, D8, D7, D6, D5, D4, D3, D2, D1, D0
HC-SR04 Ultrasonic Sensor
- Description: A sensor used for measuring distance using ultrasonic waves.
- Pins: VCC, TRIG, ECHO, GND
ESP8266 NodeMCU
- Description: A low-cost Wi-Fi microchip with full TCP/IP stack and microcontroller capability.
- Pins: D0, D1, D2, D3, D4, 3V3, GND, D5, D6, D7, D8, RX, TX, A0, RSV, SD3, SD2, SD1, CMD, SD0, CLK, EN, RST, VIN
Wiring Details
Arduino UNO
- 5V connected to VCC of HC-SR04 Ultrasonic Sensor
- GND connected to GND of HC-SR04 Ultrasonic Sensor
- GND connected to GND of ESP8266 NodeMCU
- D9 connected to TRIG of HC-SR04 Ultrasonic Sensor
- D8 connected to ECHO of HC-SR04 Ultrasonic Sensor
- D1 connected to RX of ESP8266 NodeMCU
- D0 connected to TX of ESP8266 NodeMCU
HC-SR04 Ultrasonic Sensor
- VCC connected to 5V of Arduino UNO
- GND connected to GND of Arduino UNO
- TRIG connected to D9 of Arduino UNO
- ECHO connected to D8 of Arduino UNO
ESP8266 NodeMCU
- GND connected to GND of Arduino UNO
- RX connected to D1 of Arduino UNO
- TX connected to D0 of Arduino UNO
Code Documentation
Arduino UNO Code
void setup() {
// put your setup code here, to run once:
}
void loop() {
// put your main code here, to run repeatedly:
}
HC-SR04 Ultrasonic Sensor Code
void setup() {
// put your setup code here, to run once:
}
void loop() {
// put your main code here, to run repeatedly:
}
ESP8266 NodeMCU Code
void setup() {
// put your setup code here, to run once:
}
void loop() {
// put your main code here, to run repeatedly:
}
This documentation provides a comprehensive overview of the circuit, including a summary, detailed component descriptions, wiring details, and the code used for each microcontroller.