In this lesson, we’ll learn how remote to control a relay switch to turn on/off a led.
2 Hardware Preparation
UNO R3 board
Ethernet Shield W5100
3 Hardware connection
Connect the relay with UNO as following diagram:
4 Add new Device
Log in Cayenne IOT platform, Add new…->Device/Widget
Click Relay Switch, and set the datasheet as followed:
Please note: if V2 was used by other widgets, you can select other pins, then set 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 create a new sketch, please download from:http://osoyoo.com/driver/iot_relay.txt, copy and paste the sketch into Arduino IDE
Choose the Board type Arduino Uno and correct Port, remember to use your authentication token. upload the sketch to Uno board, in your Cayenne dashboard click”Step 2 :Add Actuators” then you should see the Relay Switch was added on your dashboard:
Now you can remote control the replay switch to turn on/off a LED by clicking the button on your smart phone or web browser.
The HC-06 is a class 2 slave Bluetooth module designed for transparent wireless serial communication. Once it is paired to a master Bluetooth device such as PC, smart phones and tablet, its operation becomes transparent to the user.