Close

Service Architecture

A project log for DIY Device Cloud

Tools and information to build an internet of things that doesn't suck. Do it yourself!

tdicolatdicola 05/18/2014 at 22:520 Comments

Here's a deeper look at the services for the DIY device cloud:

This diagram shows a simple device cloud 'hello world' application that turns an LED on from a web page over the internet.  You can see in the bottom left a web page which is hosted on the broker server.  When a button is clicked (1) it communicates to a python web application which is hosted by gunicorn (python WSGI web app server) and nginx (main web server).  That web application talks directly to the MQTT broker on the server (2), which will inform any connected clients of MQTT messages.  A device runs a device service which is just a simple python script that talks to the broker (3) and turns on/off the LED with GPIO libraries (4).  The device service is hosted by the excellent supervisor tool so it will automatically run in the background on the device--all the messy details about properly running a background process are abstracted away by supervisor.

This diagram highlights the two main extension points I see where you can plug in your own code to build your device cloud:

The ansible deployment scripts for both the broker server and devices take care of setting up all the services, configuring them, etc.  You only need to place your web service and device service code in a certain location and follow a few simple conventions.

I made a video of creating this simple hello world application and will post it shortly when Youtube is finished processing it.

Discussions