Sending Data From HC-SR04 To Thing Speak
Sending Data From HC-SR04 To Thing Speak
Interfacing HC-SR04, sending data to Thing Speak and controlling Servo via
website.
Experiment 2 - Collecting the data from the sensor and sending it to Things-
peak server.
Objective
The distance measured is collected from the sensor and the aim is to now send the data to ThingSpeak
server.
Procedure
• First connect the VCC and GND pins of the sensor with the respective terminals of the ESP32.
• We have to connect the trigger and echo pin of the sensor with GPIO pins ESP32 . We used the
pin 5 as trigger and pin 18 as the echo.
• Connect to the ThingSpeak server through mqtt protocol by using the username and password.
• We have to make a channel on the website where the data can be visualised on a graph
• Since we are writing on the field of the channel the write API keys are included in the code.
• The code is then loaded on the microcontroller and output is then displayed on the serial monitor.
1
Observation
The data collected is send to the server based through mqtt protocol and is displayed on the screen
through a graph. The thingspeak has by default a delay of 15 seconds on plotting the data on the screen.
Conclusion
The data is sent using the MQTT protocol to the ThingSpeak server which acts a database and allows
interoperability as we can use the data from various sensors at one place and use the data.