MQTT Driven Arduino Beaufort Scale Blinking LED
Categories: Linux Code | Weather Station
A few months ago I successfully achieved the goal of publishing my weather station data to my local MQTT server. Now I had to decide what I was going to do with it.
Inspired by the Energy Monitor Orb concept (@andysc, @tobyjaffey, @knolleary and others) and with great help from Toby's tutorial at http://sensemote.com/lamptutorial.html I dipped my fingers and brains into the Arduino world.
The Sparkfun Inventors Kit and another Arduino Ethernet Shield got me on my way. I purchased all the gear from the great people at Little Bird Electronics (http://littlebirdelectronics.com/ @littlebirdceo) . Wow - heaps of fun stuff and thankfully we (in Australia) aren't paying a premium over the $US prices.
Although I do have solar generation and energy consumption figures available via MQTT, I decided to use wind speed as it was changing more often during my testing. Following on from that I found out more about the Beaufort Scale and decided to colour the LED according to the different levels of the Scale.
The Arduino Circuit is basically the same as the one that Toby has in his tutorial.
The Arduino code is below (from https://gist.github.com/4590724) .
The forumula for the Beaufort Scale actually gives you the middle of the km/h range hence the need to round the values. The PDF linked below has calculations for m/s, mp/h, etc as well.
It's just a start - but great fun. The next step is to package it up with some switches so that I can go between different MQTT channels that I'm publishing eg temperature, energy use, barometric pressure or even tides which I'm now publishing.
Use this code and any way you like. I've been helped by many, I hope this can help and inspire others.
Thanks also to my usual MQTT inspirations - @andypiper, @andysc, @ralight, @knolleary .
Links Used for my Project
MQTT / Arduino
The internet of things: trigger an LED on an Arduino with MQTT, Mosquitto, Ratchet, and HTML5 WebSocket API
A Simple Example (Arduino, MQTT, m2m.io)