Blink over HTTP Arduino IoT with Fedora 22 POC

Internet of Things, its a very new thing to us but when we think of it, we had access to internet for a long amount of time and we come across "things" in day to day life,they have been making our life easier each day.
Let's say for example a light bulb, it consumes energy and produces light which helps us everyday.Technology and improvements has stripped down the consumption of resource to bare minimum and optimizing the output , Now we have a era where the mobile industry and teleco industry booming and the speed of internet being unimaginable as ever before. Hence, the idea of making things smarter by connecting them to internet and analyzing  petabytes of historical and real-time data and automating their operation.This will result in a smarter way of living. IoT affects almost all the major areas of the industry viz Agriculture, Healthcare,Home Automation and many more.

This post is POC of how easy it is to smartly control light on an Arduino without ethernet shield but over  HTTP .The idea is to let you control a bulb or series of lights in your house with the tap from an application with a proper internet connection ofcourse.

Things you will need:
1.Arduino UNO with its USB.
2.Arduino IDE (get it here).
3.Smooth internet connection to the system.
4.Root or su access to the dev machine.
5.node.js
6.jonnyfive and narf


Arduino UNO which I am going to use is a micro controller much like the name says, I will use it to control a light. To keep this very simple and keeping the entry barrier low, I will be using the Pin13 of my arduino itself which has a LED and won't be using any ethernet of wifi shield.



Setting up the system:


Arduino IDE :  $ sudo dnf install arduino





Once installed , make sure that you plug in your arduino and check out that your system is detecting it.

Just after inserting in USB to the system , type in "  $ dmesg | tail " in your terminal .It will return you with where your arduino is hooked up.
              

                           

Once you have it here, we should move ahead and set up to communication protocol.

Setting up jonny-five
  • Plug in your Arduino or Arduino compatible microcontroller via USB
  • Open the Arduino IDE, select: File > Examples > Firmata > StandardFirmata
    • StandardFirmata is available in Firmata v2.5.0 or greater
  • Click the "Upload" button.
If the upload was successful, the board is now prepared and you can close the Arduino IDE.




Setting up project folderCreate any folder and copy paste the two files in the folder.

1.index.html[1]
2.LED_Server.js[2]

Setting up node.js


You need to go inside your project folder and making sure that you are in su, type in

$ dnf install npm nodejsOnce you are done , you can go ahead and set up the jonnyfive and narf

$ npm install narf jonny-five


If you get it done with out any error , you can find your server successfully running at


http://127.0.0.1:8079/index.html

After you execute $ node LED_Server.js


If, you are getting an serial port not found error execute

$ npm install serialport

                                                              
              


When done you can find the following screen after execution of 
$node LED_Server.js

                    


The Webpage

                     


 
Now, you can turn on and turn off Pin 13 from this webpage. Best possible use case can be , you forgetting to turn off the lights of your room and you are out on a vacation. This smart solution will let you control your lights from any part of the world!

Since this is a proof of concept , here is how it looks in action


Comments

Popular posts from this blog

Rocket on Fedora

Tales from GNOME Asia 2023

[Test Day Annoucement] Anaconda Blivet GUI