Authorized Online Retailers:
In this lesson, we’ll learn how to use HC-SR04 Ultrasonic sensor to measure distances through Cayenne IOT platform.
2 Hardware Preparation
|Ethernet Shield W5100||1|
|HC-SR04 Ultrasonic sensor module||1|
3 Hardware connection
Connect the HC-SR04 with UNO as following diagram:
4 Add new device
Log in Cayenne IOT platform, Add new…->Device/Widget
Click Digital Input，setting the datasheet as followed:
Please note : If V1 pin was used by other widgets, you can select other pins. and change the VIRTUAL PIN in
sketch to the pin number you have selected.
In your dashboard, click “Step 1:Sketch File”, the sample sketch will be displayed, in this example,we creat a new sketch, please download from:http://osoyoo.com/driver/HC-SR04_sensor.txt
Copy and paste the sketch into Arduino IDE ,please remember to use your own authentication token. Upload the sketch to your Uno board, then click “Setp 2 :Add Sensor”, you will find the distance widget was added on your dashboad.
From the dashboard, you can check the results of the distance measurement from the web browser or smart phone.
DownLoad Url osoyoo.com