Yun Light is table lamp that can be control from anywhere in the world without to bough the very expensive product in the market such as Belkin WEMO, SmartThing,Wink etc.. I think it's wasting our money on these hundreds of dollar products, when we can build a smart home by our-self with the open hardware already in front of us. So, I decided to use the Arduino Yun to achieve my ideas.See Yun Light in actionHow is the Yun Light work?
OK! First of all, I want to say that I've learned a lots from this project not only to light up a lamp from my hand or smart phone, I'm seeing that the Internet of Things are convenience and increasing efficiency of our life.
The Yun Light can be control from 7 different platform they are Yeelink, Wechat,ThingSpeak,Temboo,Blynk,DeviceHub and IFTTT which use Arduino Yun to commulate with their API. There is a lots of choose in front of us; thus, can use either one of above IoT platforms to control our appliance from anywhere.Arduino Yun Set up?
The Yun light set up is as simple as 1-2-3.
The wiring of the components is fairly easyReceiver:
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 ArduinoTransmitter:
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.
To setup of the Yun Light, we just need to connect the power cord of table light to 433MHz power outlet as show below:
OK, Let's talk about the coding and API usage.Yeelink
For Yeelink,I use the Arduino Yun Bridge library's process method to GET the HTTP request from Yeelink API. In here I just the give the example of how to get the API request from Yeelink, which it follow the same for all other platform. For more detail please view the Code section.WeChat 微信
The Yun Light can be also control from the Chinese most popular SMS WeChat. Here it is the tutorial that you need to follow to make this possible: First follow our official WeChat: ECEFan
Then, we need to create a new device to control Yun Light and don't forget to give your new device a name!
That's it! You've create a new device, now you can start control your new device via our WeChat platform. Try to enter "open" and "close" command in the message bar ^.^
Now it's the time to get to know the API of this service. Thanks the weline.top team make this option available to the public. Here is their API page. When you trying to access their API, don't forget the enter the OpenID of your device.
Next, I want to control my Yun Light from Blynk, First of all we need to download the Blynk app either from App Store or Google Play. Don't forget to include the Blynk Library : https://github.com/blynkkk/blynk-library
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:"
That's how you setup IFTTT and use its DO button app to control the Appliance.
For the ThingSpeak part, it's the same setting as the DeviceHub setup; however, we have need to have two DO button: one is to control the Yun Light 'ON' and other is use to control the Yun Light 'OFF'.
We could also turn on the yun light when current weather condition change. Such as the examples below:
For more info about the these platform API please view following pages:
ThingSpeak API (Look specially for "Get Last Entry in a Channel Feed" section)
Any questions are welcome!