Skip to main content

Simple IOT Project - Electric Imp Led Light Controller


Recently I went to IBM IOT Hackathon and got Electic IMP device and thought of playing with it and this is the first application I created LED Light controller using Electric IMP device and REST webservice.

Overview

Skill Level: Beginner

Below are detailed steps on how to connect an Electric Imp with environmental sensors to the Watson IoT Platform in order to visualize and monitor your refrigerator in real time.

Ingridients



  1.   Your WIFI *network name* and *password*
  2.  A computer with a web browser
  3.  Smartphone with the Electric Imp app IOS or Android
  4. A free Electric Imp developer account 
  5.  An Electric Imp Explorer kit - purchase from Amazon 
  6.  Three AA batteries

STEP BY STEP 

Step 1 - What is demonstrated in this example?

Use an Electric Imp to switch on/off light sensor and change the color of light using combination of RGB.

 Step 2 - Connect your Electric Imp to the Internet

 Set Up Hardware

  •  Plug the Imp001 into the Explorer Kit Board
  • .Power up your Imp with the AA batteries.




When the imp is first powered on it will blink amber/red.

 Electric Imp BlinkUp

Use the Electric Imp mobile app to BlinkUp your device
  1.  In the app log into your Electric Imp developer account
  2.  Enter your WIFI credentials
  3.  Follow the instructions in the app to BlinkUp your device
  4. When BlinkUp is successful the imp will blink green and the app will show you the device's unique ID.



For more information on BlinkUp visit the Electric Imp Dev Center 

Step 3 - Connect your Electric Imp


In your web browser log into the [Electric Imp IDE](https://ide.electricimp.com/login) using your Electric Imp developer account.

Click the **+** button to create a new model





In the pop-up enter the following information:
  1.  A name for your code model (ie LED Smart Light)
  2.  Select the checkbox next to your device ID, this assigns your device to this code model
  3.  Click **Create Model** button

Copy and paste the  code into the agent and device coding windows.  The agent.nut file should go in the agent coding window, the device.nut file in the device coding window.





Click **Build and Run** to save and launch the code




STEP 4 - Testing the application

  1.  I have used POSTMAN application to make calls. You can use any browser
  2.  Once you run the application, you will get a url on the console like  https://agent.electricimp.com/aNbU-IPw_nZr?led=1&r=NUMBER&g=NUMBER&b=NUMBER
  3.  The led=1 indicates to switch on the light and led =0 indicates switch off the light.
  4. Enter the desired combination on parameters rgb to get light. For more details on RGB Wikepedia-RGB and to get the color codes RGB COLOR CODES


STEP 5 - Demonstration of the application

POSTMAN CALL



Blue Color LED

You can change r,g,b value to get different color light.

RED COLOR LED



GREEN COLOR LED

 Enhancements

Create a mobile app where user can select the color and change the color of the led as well as switch on and switch off the light

Comments

Post a comment

Popular posts from this blog

Adding loading spinner to JSP Page using pure CSS and JS

I wanted to add loading spinner to the web application that I was working on. This application is a legacy application and I was looking into a way to add the loading spinner whenever the user performs certain actions such as the following Clicks a button which behind the scene performs CRUD operation When user request data  As the web application was based of JSP and I was looking for a way to adding it to the webpage and finally came across the following solution  Create a div  Add the CSS for the div Create a JS function which gets called on button click.  Here is the code HTML JS      CSS

Enabling TLS 1.2 in Java 7

I am working on web application that uses third party API and apparently those guys have stopped using TLS 1.0 and switched TLS 1.2 I was getting the following error Apparently Java 1.8 have TLS 1.2 by default and for Java 1.7 you have to enable it. I have been searching online for few days to enable TLS 1.2. I have tried all the following things but it did not work For each application, enter this command: java ... -Dhttps.protocols=TLSv1.1,TLSv1.2 ... Using JAVA_OPTS, enter the following command in your .profile, shell rc (to affect all Java programs run by the user), or conductor.sh (to just affect Datameer): export JAVA_OPTS="${JAVA_OPTS} -Dhttps.protocols=TLSv1.1,TLSv1.2" This is what I did and boom it worked