This project shows you how to monitor the distance using an ultrasonic HC-SR04 sensor with ESP32 WiFi Module. The measured data are sent to the AskSensors IoT cloud over HTTP. The AskSensors provides users with graphs to monitor their sensors data streams in real time.
Here are the main steps:
- First, you need to sign up here.
- Create a new sensor as shown in this getting started guide.
- Prepare your Materials:
- Build your Hardware:
Note: The ESP32 GPIOs require 3V3 signals (not 5V tolerent). For quick hack, if you are using the HC-SR (5V version), we highly recommend to add a serial resistor between the HC-SR Echo pin and the ESP32 GPIO. However, for production, a 3V3/5V level shifter is needed. otherwise, The ESP32 is compatible with HC-SR (3V3 version).
- Download the code from Github.
- Modify the following settings:
const char* ssid = "............."; //Wifi SSID
const char* password = "............."; //Wifi Password
String apiKeyIn = "............."; // API Key
- Build your code in Arduino IDE.
- Connect your ESP32 to the computer, upload the code.
- It's all, Now return back to AskSensors and open your sensor dashboard, Select a graph to monitor your data stream in real time.