Go Down

Topic: Remote Lights Control with Arduino Yun and DeviceHub (Read 390 times) previous topic - next topic

LiviuDeviceHub

Controlling the lights around the house from your phone, tablet or PC

https://youtu.be/NtPb7X4sf7U


What you will need for this project

1 Arduino Yun
1 433Mhz RF link kit
1 433 MHZ Remote Controller

software applications: DeviceHub



Arduino Yun Set up?
The Yun light set up is as simple as 1-2-3.



A easy set up of 433 MHz with Arduino Yun
All we need is a Arduino Yun and 433 Mhz RF link kit

The wiring of the components is fairly easy

Receiver:
The GND Pin(-) of the receiver must be connected to the GND Pin(-) of the Arduino. The VCC Pin(+5V) of the receiver must be connected to the+5V Pin of the Arduino. The Data Pin of the receiver must be connected to the Pin2 (Interrupt 0) of the Arduino.

Transmitter:
The GND Pin(-) of the transmitter must be connected to the GND Pin(-) of the Arduino. The VCC Pin(+) of the transmitter must be connected to the +9V Pin or Vin of the Arduino. The Data Pin of the transmitter must be connected to the Pin 7 of the Arduino.



Yun Light Set up?
To setup of the Yun Light, we just need to connect the power cord of table light to 433MHz power outlet as show below:



Code/ API

Device Hub/ThingSpeak/ IFTTT
The IFTTT is very awesome to make things connect together. And it's launched a channel for makers. In my project I also use the IFTTT's DO button do control the Yun Light. Here I use two IoT platform to use the IFTTT's maker channel: DeviceHub and ThingSpeak.

The first step is to register on these platform and create a Device as a entry point for your data on the cloud.

For the DeviceHub you can do that here: https://dashboard.devicehub.net/register  and follow the wizard there to create your device. Note that every device has a unique ID(UUID) and an associated API key for the project making the Sending/Receiving data secure and reliable.

After you have one device and add an Actuator in it. Now you can set up the IFTTT by using below code and relay the action done with the IFTTT DO button.

1) Go to https://ifttt.com/maker

2) Click "Connect"

3) Click "How to trigger events"

4) Copy the URL under "Make a POST or GET web request to:"

Channel :
Code: [Select]
Maker

URL:
Code: [Select]
https://api.devicehub.net/v2/project/"paste_project_id_here"/device/"paste_device_id_here"/actuator/"paste_actuator_name_here"/state

Method: Post

Content Type:
Code: [Select]
application/json

Post{"state":"TOGGLE", "apiKey":"paste_api_key_here"}


That's how you setup IFTTT and use its DO button app to control the Appliance.


IFTTT Set UP for DeviceHub



We could also turn on the yun light when current weather condition change. Such as the examples below:


If sunset, Then turn on Yun Light

Link: https://ifttt.com/recipes/320578-if-sunset-then-turn-on-yun-light


if sunset, then turn off Yun Light


Link: https://ifttt.com/recipes/320579-if-sunrise-then-turn-off-yun-light

References
DeviceHub API documentation https://devicehub.net/devhttps://devicehub.net/dev

Happy automating!


Originally posted by Tony Zhang on hackster, see full tutorial and integration with other platforms

wadevcamp

Why did you use TWO IoT platforms instead of one?  (Sorry if its a dumb question -- I'm a noob)

Adosindos

The entry of details make us feel better when they see the description to follow forever.

Go Up