Christmas, driven by Octoblu ... All is merry and bright!

3:35 PM
Christmas, driven by Octoblu ... All is merry and bright! -

I have been for some time a fan and user of Octoblu. So if I, Octoblu Supremo saw Chris Matthieu, tweet a photo of Octoblu office Christmas tree with a comment of "Who is for adding some #IoT on the tree?" I could not resist, challenge.

I have decided, if and that the tree Christmas would be in the Citrix office in Cambridge, UK soon with an Internet connection.

was to be

My first step a suitable "thing" connected to find. The criteria included (i) must be something interesting, as do show different colors, and (ii) must be secure office, so house chopped network was a resounding "NO!"

I opted for a cheap battery-powered tree-topper decoration with red, green and blue LEDs with a variety of flashing patterns. I have over the flashing does not matter really, but the fact that it could told me that the LEDs would probably be wired in a way that I could go individually by an Arduino.

Building The Star , the next step was the tree-toppers to hack itself. that the battery unit is meant to be removed and the chip, the flashing of the case is to find out from the wiring of the LEDs (rotated to all wired common anode with 6 rings of 5 LEDs with a common cathode per monochrome ring).

My tool of choice with LEDs for connection, switch, etc. is the fantastic Arduino family. [1945003IndiesemFall], I used an Arduino Uno to have 6 PWM outputs, done that fit well to the six LED rings, so that I can control the brightness of each LED ring individually. A back-of-the-envelope calculation struck a 150R resistor would give me sufficient brightness, but keeping up with the maximum current sinking limits of Uno. I did a quick bit of firmware for the Arduino together, the commands through the USB serial interface, the brightness for each LED color.

Arduino and Raspberry Pi The next step was to get the internet connected. I decided to use a Raspberry Pi, which was already set up with node.js and other bits and pieces for connection to Octoblu. I adapted an existing script node.js, I have a flash for the control using (1).

Although there are already a blink (1) Plug-in for Gateblu, I prefer to run standalone daemons that speak directly to Meshblu. In this case, I simply replaced the code, color commands to the flash (1) through its library sending commands, the color send commands to my Arduino via serial interface.

  conn.on ( 'message', function (data) {console.log ( 'message received'); console.log (data); console.log (conn.options); var color ; color = parseColor (data.on, data.color); var = rgb color.toRgb () var m = "RED" + rgb.r + " n"; console.log ( "SERIAL:" + m); serialPort.write (m): m = "GREEN" + rgb .B + " n"; console.log ( "SERIAL:" + m); serialPort.write (m): m = "BLUE" + rgb.b + " n"; console.log ( "SERIAL" + m); serialPort.write (m);});  

Putting all this together gave me a Christmas tree decorations, the color take orders over Meshblu. The final step was to put this in a Octoblu flow, so it did something interesting.

I with the tree shows the outside temperature (something that actually could be a useful tool for my colleagues make this project) to begin decided! The river picture the scheduler nodes are used with a minute schedule below. This triggers the weather node the current temperature in Cambridge search. The output of this goes to a generic function node that has a simple JavaScript function that chooses a color based on the temperature - colder temperatures is more blue and warmer more red. The color name is sent my Raspberry Pi and Ardunio on generic Meshblu device node.

Octoblu Flow

Illuminated tree topper This worked well, but the temperature does not change very fast at the moment, so I decided to force only a periodic color change things to make a little more interesting. I have a few nodes are added to the stream every few minutes to change the color, 30 Seconds flow from the main weather offset to ensure that there would be a period of a different color.

a nice thing about Octoblu is that it is very fast and easy to change things, so what do I do the LEDs today, do not necessarily what they have to do tomorrow.

I now have a "Software Defined Christmas!" Maybe later I will change the flow, so that the tree indicates a color representing days remaining for Christmas or has some sentiment analysis of Twitter activity ...

The IoTree

Previous
Next Post »
0 Komentar