Smart home series – Part 1 – Learning MQTT and buying stuff

Posted by Gjermund Bjaanes on October 4, 2015

Since last time I have worked a little bit on making some progress with my smart house project. I have been doing some reading, as well as some buying.

 

MQTT

As far as I have learned, MQTT is the current preferred protocol for doing communication between small embedded devices. I seems simple and covers a lot of the problems that IoT and embedded devices face.

MQTT logo

MQTT is a publish-subscribe messaging protocol that works well with limited network bandwidth, unstable connections and small devices (e.g. Arduino-like devices).

The protocol is based on one or more devices subscribing to “topics” and one or more devices publishing on “topics”. The subscribing devices get all messages for a specific topic that someone publishes on.

You also need a message broker to control the flow of all these messages. It’s like a little master server making sure everyone get their messages. So in reality, every publisher sends a message to the broker, and the broker makes sure every subscriber gets a copy of that message.

MQTT logo

For instance, let say you have a temperature sensor device publishing on “/temperature/kitchen”. Every minute, the temperature sends out a message on “/temperature/kitchen” with the current temperature. The broker gets that messages and sends out two messages to it’s two subscribers. One log server that saves the temperature for historical view and a light bulb that shows a different hue depending on the temperature it receives (e.g. red for hot, blue for cold).

 

My Plan for MQTT

I am planning on using a first-generation Raspberry Pi as my MQTT broker, and Raspberry Pi 2 for a small multipurpose data server (storing, viewing, statistics, etc.).

I will be using Arduino somehow for the sensor devices, but I haven’t figured out how to create small permanent devices with Arduino yet. I’ll figure that out later!

I highly recommend that you spend some time learning this technology, because it seems to be one of the cornerstones of this particular field. I watched this talk about MQTT, which even have a live demo:

 

Buying

I have bought a lot of stuff the last weeks. I went absolutely nuts on eBay and few electronic shops. I bought soldering tools, sensors, breadboards, wires, capacitors, resistors, storage boxes and some stuff to try to make my own small permanent Arduino device (we’ll see how that goes!).

Stuff bought

I still don’t know exactly what I truly need, but as soon as I really figure that out, I will let you know. For now I am stumbling around in this new landscape of electronics, IoT and embedded devices.

Until next time!


Follow me on Twitter: @gjermundbjaanes