The early-arriving future disappointment
The geek and DIY responsibility
Well, to be fair, intelligent houses are popping up. They might not be mainstream yet – and still lacking for standards connecting devices from different vendors – but we have all the pieces we need to make intelligent houses happen.
So, I started working on an ambitious and still very home made project: To prototype some little, cheap gadgets that could help me control the devices that I already own. Yes, that’s important: having an intelligent house shouldn’t be expensive, since we don’t do it because we need it, we don’t do it because we want to, we do it because we can.
So, before showing how you could start seriously controlling some devices, let me introduce you to Arduino:
You probably already know it, but just in case, “Arduino is an open-source electronics platform based on easy-to-use hardware and software. It’s intended for anyone making interactive projects.”
In other words, Arduino is a micro-controller capable of running programs written in C and interacting with the physical world by using inputs and outputs.
You can connect different gadgets to your Arduino board (sensors, lights, servos, engines, etc), and you can also extend its functions by using “shields”. This last detail is a key factor – thanks to Ethernet or the WIFI shields, you can connect the board directly to a network (even internet).
Turn the lights on (Arduino’s “Hello World”)
Let’s start with the most basic program you can write and deploy on an Arduino board, and add on to it until it’s an Internet of Things project. Remember: Arduino is mostly for prototyping and not for building real devices or products.
The following code will make the led blink:
Remotely controlling the led
- Develop a lightweight web server that can run on an Arduino board (some Arduino boards are extremely limited in regards to memory and processor)
- Code a web application that routes the http requests to some handlers
- Fill the handlers with some code that turns on and off the lights.
Yes, it seems to be trickier, and you might be remembering Doc. Brown: “I’m sure that in 1985, plutonium is available in every corner drugstore, but in 1955, it’s a little hard to come by“.
Done! Nobel will do it for you (actually, it’ll finish coding the empty handlers, and you’ll need to complete these with the logic you want).
Step by Step
Assuming you already have the Arduino software on your computer and you know how to deploy your programs…
- Acquire an Ethernet or WiFi Shield for your Arduino board (Nobel won’t do that for you)
- Mount the shield properly (it’s just making the inputs and outputs match)
- Build the circuit on top of the shield (remember, shields extend your board functionalities while allowing you to preserve the original ones)
- Install Nobel on your computer: https://github.com/nohorbee/nobel#installation
- Write the RAML for your API (remember, it’s just turning on and off a light):
- Save your RAML file and scaffold your application:
1nobel -s myAPI.<a href="http://raml.org/" target="_blank" rel="" title="RESTful API Modeling Language" >raml</a> -n ledController
1nobel -s myAPI.<a href="http://raml.org/" target="_blank" rel="" title="RESTful API Modeling Language" >raml</a> -n ledController -il [path_to_your_arduino_libraries_directory]
if you need Nobel to install the required libraries for you (only the first time)
- Place your own code as indicated on the example documentation: https://github.com/nohorbee/nobel#put-your-own-code (remember that your led is not connected to the pin 9 but to the 13 in this case).
Your Arduino board is now literally exposing a REST API capable of handling the states of your led.
Build your own projects
Now go for it! Build your intelligent house – DIY style! And let’s not limit ourselves to nice menus for turning lights on. Here are some ideas (I’m working on some of these already):
- Build a mobile app that uses your GPS to detect when you are going back home and turns your air conditioner on when you are only 15 blocks away.
- Build a pet feeder that you can control from a web application.
- Would you dare to warm up the car from your couch?
- Build your own remote controlled robot
Have fun and Happy Hacking!