This Project aims at measuring the distance using an ultrasonic sensor HC-SR04 and an ESP8266 WiFi module. The measured values are sent to AskSensors IoT platform through WiFi, so the user will be able to access to the data remotely and visualize data stream in real time.
- Prerequisites:
Before proceeding with this tutorial, you will need to create an AskSensors account. it takes less than one minute to get a free account and sign in !
Then, create a new sensor to send data to, here is an example to start with.
- Hardware Needs:
- Build The hardware:
Note:The ESP8266 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 ESP8266 GPIO. However, for production, a 3V3/5V level shifter is needed (check this page). Otherwise, The ESP8266 is compatible with HC-SR 3V3 version.
- Run the code
The provided code has been tested and should work as is. All you need is to set the following parameters:
const char* wifi_ssid = "...................."; // SSID
const char* wifi_password = "...................."; // WIFI
const char* apiKeyIn = ".................."; // API KEY IN
- Visualize data stream
The image below shows how data looks like in a Line graph. Go to your sensor dashboard at AskSensors and select your graph.
Comments