Create Your Own Smart Light Using Electric Imp

by andrea.reginato in Circuits > Remote Control

1119 Views, 10 Favorites, 0 Comments

Create Your Own Smart Light Using Electric Imp

preview.png

Create your own smart light using Electric Imp. Learn how to control and monitor your lights from mobile, tablet and desktop in 15 minutes. $44 in hardware. Entry level.

Hardware

To complete this tutorial you need the following components.

Software

In order to connect Electric Imp to the internet follow the official Getting started guide. To fully understand this tutorial you need to know the Electric Imp's concepts behind Agent and Device entities.

Hardware Setup

components.png

This schema represents the led, resistor and pushbutton setup. With this setup each time you press the button, the LED is turned on and off.

Software Setup

step-1.png
step-2.png
agent-url.png
step-3-direct.png

Open Lelylan Dashboard and create a new device by following 3 simple steps (if you are new to Lelylan, you can sign up for free).

  1. Set a meaningful name (e.g. bedroom light).

  2. Choose the device type. For this tutorial choose Basic Light. What is a type? A type defines what a device is by defining its properties, functions and statuses. For this tutorial you do not need to now more about.

  3. In order to communicate with the physical device you need to connect Lelylan with the Electric Imp agent. Every agent has a unique url that can be found in your Electric Imp Ide. Copy and paste it into the Custom URI field. In this way Lelylan will forward all requests coming from the dashboard (or APIs) to the Electric Imp.

  4. Get the Device ID and Device Secret. Once the device is created, click the settings link (placed under the device name) and get the device ID and device secret. You'll need them in the next section.

Code

Once the (virtual) device is defined on Lelylan you need to make it communicate with the Electric Imp. Copy the Electric Imp Agent and Device sketches below and change the and with your device credentials.

You Are Done

step-5.png

Access Lelylan Dashboard and control your connected light from mobile, tablet and desktop. If any problem occours, let @lelylan know.

Learn More

Nothing else to do. Everything should be up and running.

If you want to better understand how the code works checkout the code explenation code explenation section.