When we start working on a project, we start by isolating a problem and then designing a solution for it. For the Internet of things, this means having a device connected to the internet and sending the desired info online. My project being part of the Forget me not challenge meant that I was going to do that. However I have paused to thing about somthings as well as blog about it.
In my design, I have a lot of sub systems connected to the OpenHAB system. I was planning to connect various devices to an Online MQTT server and have my devices send updates to an MQTT server.
The problem with this is that if eveyone decides exactly this, then what happens? If every house has say half a dozen IOT systems and they are all transmitting to the internet and there are half a million homes in a city- Bye bye internet!
The routing algorithms will have to every efficient and might need to compress data themselves as well to allow all that data to go around. This got me thinking… It would be much better if I can localize the IOT traffic that need not be accessed from across the Internet. I would have to partition my design into services with local connectivity and Internet connectivity. Sounds simple? Well its not. When we say IOT that means that everything is connected to the Internet. I came across MQTT in one of Benjamin Kabe of Eclipse’s seminars where it was pointed out that…
MQTT was specifically designed for resource-constrained devices and low bandwidth, high latency networks such as dial up lines and satellite links, for example. Basically, it can be used effectively in embedded systems.
One of the advantages MQTT has over more full-featured “enterprise messaging” brokers is that its intentionally low footprint makes it ideal for today’s mobile and developing “Internet of Things” style applications. In fact, companies like Facebook are using it as part of their mobile applications because it has such a low power draw and is light on network bandwidth.
Now that puts my mind at ease that I am in fact looking at the right protocol. So what else should I be looking at?
Our project uses EnOcean’s sensors which solve many problems, but what happens to all other IOT devices? What happens to my existing stuff? In the Beyond the Phone Challenge, I had built an IOT sensor system where I had built a solution using Apache and MySQL and PHP to store data. Can I use that with this?
Here is a scenario… I have OpenHAB as my aggregator which will be talking to all the devices. Existing IOT devices may need to post to an MQTT server and then my OpenHAB would subscribe to that and there would be some internet traffic for no reason. So what is the solution? Since I can have most IOT systems either as HTTP servers or MQTT Clients, I can talk to them locally. I can have an MQTT server locally and the devices can post to them locally. So what happens to the other HTTP devices? Well since they are essentially HTTP servers waiting for queries, I can write a python script that can make an HTTP query and do a post on MQTT. That way eveything is getting sent over MQTT. The point is to funnel everything to an MQTT broker and then use OpenHAB’s MQTT binding do the rest. If I come across any other devices later with a different interface which my be network based or anything else, it would be a simple matter of connecting it to my RPi and running a python script that will be parse the data to MQTT.
Why am I doing this you ask? Standardization of architecture. When I was drafting my application, I made around 2 dozen version where I changed so many things including end devices. The point it the requirements may change with time and place, and I am not a software guy(why do I keep saying that? I dunno.!) so I want to learning everything about one thing. In this case MQTT and I already know python(and C,C++ and Java and .NET and a bunch of other languages that I use like after a year). So that should work for me…
This text was not really planned and I really made decisions(and researched other stuff) as I was writing it hence if you find there is something you can suggest, PLEASE DO!
Lastly I have not posted anything about what my project is going to be because I am still modifying things and that from my experience is a good thing. Once I have some parts of Humpty-Dumpty ready, I will make a reveal. Right now since it is an India Summer I am going through, I would call this project, “Forget Me Not in The Summer”.
Thanks in advance for your suggestions.(I will need em)