Drupal and the internet of things

Published by Aljosa
on 4 October 2016

What is Internet of Things (IoT)? A good and straightforward description can be found on Wikipedia “The internet of things (IoT) is the network of physical devices, vehicles, buildings and other items—embedded with electronics, software, sensors, actuators, and network connectivity that enable these objects to collect and exchange data.

In a little simpler words the IoT is a way that everyday objects have the connection to the Internet, allowing them to receive and send data. Those things can actually be almost everything and we can already find them in many branches, like healthcare, energy, transportation, agriculture, in our household, etc. They help us capturing, storing and showing data about things in the real world. This means we can analyse it and make useful deductions from it. For example, when something has to be replaced or repaired. Furthermore, it could even tell us how to reduce costs and waste of something. In healthcare, we know when something's not right with us maybe even before we could feel it. For all those reasons the IoT is becoming more and more popular. There are still some concerns about security and privacy of such things, but I think that with the increasing number of everyday objects connected to the network, people will become used to this.


Coke machine


Before I go further with Drupal and IoT, I would like to mention one interesting thing that I came across when searching for IoT. It’s that the first Internet appliance was already made in 1982. It was a Coke machine at Carnegie Melon University. It was programmed in a way that people connected to it knew if there was a cold drink in it, so they could be sure that the trip to the machine would be worth it.

Inspiration for IoT

This blog post was inspired by the session “Drupal and the Internet of Things” by Eirik Morland in Milan on the Drupal Dev Days 2016. He showed us some practical examples of how the Drupal site communicate with our internet connected devices (Raspberry Pi, Arduino, Tessel). We were shown how we can see that a node has been published/unpublished or if the Drupal site is in maintenance mode or not and how many posts we have on the front page. Of course those were only some basic examples that can be taken further. Anyways, it looked practical and fun. Maybe something more interesting is, how to show the reading of the temperature of our room and see it live on the way home. By knowing this, we could turn on the air conditioner or the heater. In the bottom video you can see the example of a monitoring device for that, which Eric made. There is a warm water in the cup and the cold one in the glass. Also, here you can find the code for a similar thing.


On Eric's site I found an interesting and practical example of a Drupal 8 as a "surveillance backend". Basically he uses a sound sensor to listen to the sound changes. When he makes a noise, in this case snaps his fingers, the webcam on his Mac takes a picture, create a node and post it to the Drupal site. As he writes, this is a very concrete example of the physical world interacting with Drupal. He made a simple surveillance camera with Drupal as a backend. At the bottom you can see the video.


Another simple and not so useful, but to me very interesting example is how he put the Drupal site into maintenance mode with his normal TV remote controller. He clicked on the TV remote, then the Tessel microcontroller read the signal from it, which was analysed to see if the clicked button is the on/off button. Then the request was send to the Drupal site, where he had a module putting the site in or out of the maintenance mode. At the bottom you can see the video of this procedure and here is the code that he used.


Is IoT’s potential enough?

There is a great potential of using the IoT and Drupal can be a great backend for it. As I mentioned, it can be used practically in every part of our lives. I see a great potential for it in the health industry. Not only for the corporations making money, but mainly for the well being of the people connected to it. But, this can be a big privacy issue. People that have access to the incoming data, can practically see all your movements, status, etc. I don’t think that people are ready for such kind of things yet. I know that I wouldn’t like that some unknown person can know exactly where and what I am doing on particular moment. Is this a good reason to connect ourselves to the IoT? Maybe it is, maybe it’s not. After all, almost all of us have a smartphone in our pockets with the GPS or internet connection turned on and we are already exposing ourselves to the leak of such information.

Internet of things


Maybe a simpler and a better idea of using the IoT can be, to connect a device to your home's plugins, that can send data to your Drupal site. Then with Drupal you can make a statistics application on how much electricity, and obvious money, did you spend on a particular device. You will be able to see all the data and charts in one place. You could also implement some notifications if one of the appliances spends more electricity than other or if you are approaching to a limit that you have. In that way you could manage your home's energy more efficiently, replace old appliances that are not working correctly or buy a new, more power saving one.

So everything sound really good. Better healthcare, saving energy and time, managing our lives better... How far will we go? What can be done with the help of IoT? We’ll see. In the meantime, let our imagination have a free way.