We regularly hear about fridges reporting that they're empty, plants tweeting about lack of water or even huge buttons just waiting to be pressed. This is the Internet of Things (IoT) revolution that is unfolding while you're reading this post. More and more devices and physical objects get equipped with network connectivity out of the box.
Companies are struggling to get in the driving seat with a platform that will power it all. For Internet of Things devices to become really ubiquitous they need to be cheap, very small and use little power. They also need to be super simple to develop so that every developer can jump on the IoT train.
So what is the state of Internet of Things today? How good have the building blocks of IoT become? We tested this by building our own E-Paper keylock for our office front door with an off the shelf IoT controller and our V Tablet device. The result was a nice Lockitron clone with a wall mounted keypad.
Based on our experience, we think that the wait for Internet of Things is over. It's already here.
First we need a small, cheap and low power embedded IoT controller - this is the board that will drive the complete setup. We've checked a couple of different solutions (good examples include Electric Imp, Pinoccio) that fit the requirements and in the end decided to go with the awesome Spark Core.
Spark Core is a small WiFi enabled board communications module (similar to other contenders) with a set of GPIO interfaces that can be used to hook up analog and digital inputs. It connects to a cloud service trough which you access and program the board.
We chose Spark Core over others due to small size and affordable price. Wide programming language support (you can do even assembly if you want) is what finally won us over, but that doesn't mean you have to develop anything - you can access device IO ports via the restful API that they provide. Best of all Spark Core uses the same awesome ARM Cortex M3 micro controller from STMicroelectronics that we used before, so we knew what we're getting into.
We always had a bit of an issue with our front door. It can only be opened with a press of a button which is located at the door. People regularly get up just to open the door. There is a bunch of off the shelf wireless door locks to solve the issue but we wanted to see just how hard would it be to develop our own from the scratch.
Smallish package from Spark.io contained the Spark Core board and a breadboard for prototyping (great idea!). First things first, we connected it up to our Wi-Fi (you configure the settings with a phone app). The demo app worked as we could turn on a LED that we connected to the breadboard.
Our door is opened by a push button that is connected to access control system deployed in our office. The push button is a switch in the simplest form possible, with two lines running to the control box. Our Spark Core will need to connect the two lines together.
We scoured our electronic component stash and found a relay switch. The relay was connected to the Spark Core using three IO pins to prevent any issues with current (maximum current load is limited) and with a diode in parallel to prevent spikes rushing back from the relay coil after it got turned off.
Two control cables that run to the door push button got split and Spark Core setup was connected in parallel. That was it for hardware part.
Firmware is uploaded to the Spark Core using their cloud service. You get a simple online editor with a couple of examples ready. We took the LED control example and just changed it to control three LEDs. That was literally it. For anything more complex check out their online docs.
Click "Flash" in the upper left corner and code gets deployed on your Spark Cores. To execute we do a HTTP get request to the correct URL. In our case we could open the door by running (in terminal):
me@my_computer:~# curl https://api.spark.io/v1/devices/SPARK_UUID/open_door -d access_token=YOUR_ACCESS_TOKEN
That's all nice and good, but not very user friendly for the non-haxor people in our office. With a help of a web app we wrapped that call into a bookmarklet that team members simply drop into their browsers.
We built a web connected door lock in less than a day for ~35 USD in parts. But since we do have a bunch of Wi-Fi enabled E Paper devices in our office we didn't stop there - what if we add a proper entry keypad to our office doors?
A full blown E-Paper keypad, which can be mounted on the wall without any power infrastructure.
Let's recap. I took us less than a day to create a new keylock which can be controlled from the web and additional 15 minutes to add a E-Paper keypad. And except for the lack of proper casing for our Spark Core, there is nothing that screams prototype about it - we're using the setup daily.
Internet of Things is very real. The tools that are available right now make it super easy for anybody with basic programming and hardware skills to create their own smart gadget. This means that there will be a huge influx of new gadgets that will be connected, because frankly, there is no reason why they wouldn't be connected. Today we're laughing at the notion of connected refrigerators, while tomorrow we won't know how we survived without them.
This also means that investing into Internet connected solutions now will pay dividends later on. We were able to use a our own V Tablet device (a web browser based e-paper device) and tap into the ecosystem of IoT devices. Perhaps it's high time we all think about what else around us will become connected in the next year, two, three and how we plan on interacting with that.