Down The Rabbit Hole Of Iot Part Ii, Or, How An Innocent Hobby Leads To Creating An Iot Robo Laser Octoblu Smoke Breathing Kitty On Splunk !
If you are reading this, then you have read Part I and taken the BluOctoPill- welcome down into the Rabbit Hole of IOT!
Go with the Flow
The heart of this demo is the Octoblu framework, an amazing mesh network which is a powerful IoT Gateway between generators and consumers of data. Running in a highly resilient cloud framework, it supports multiple protocols, programming languages and platforms. The basic unit of operation is a “Flow” which is an instance of Octoblu that can do whatever you tell it to and can be created and managed in a drag and drop, web based interface. In the simplest case, you might do something like create a flow which says “When I post ‘#bluelight’ on my Twitter account, change my lights to blue”. What is happening there would be the Octoblu flow scanning Twitter for a post by you. When it sees the data “#bluelight”, it triggers the preset action you described of changing your lights to blue. How did it do that? You are running an instance of the gateway on some device of your own and connected it to your wifi based light. Now any condition, input, data, etc. that you define can control your lights via the Internet.
You can run an instance of gateway on a many different devices such as PC, Mac, Android, IOS, Arduino, etc. Based on the ambitious I/O requirements of this project, we chose to use a Raspberry Pi based on it’s processing capabilities and number of GPIOs (General Purpose Input/Output Pins) for controlling the various devices.
Any pre-defined objects can simply be dropped into the flow and connected with the mouse. Bringing up the properties of any object lets you set the value of it, i’e’ “blue” for the light. The big button is a simple trigger which allows you to start the actions that are linked to it manually. In the light example, clicking on the trigger in the Octoblu web page would turn the light in your room to the color Blue.
In our demo, this trigger was used for testing while during the demo the real trigger data was coming from Splunk monitoring the Datacenter. This is explained beautifully in Jason Conger’s blog on how to trigger an Octoblu Flow from Splunk.
The monitoring of our Citrix Datacenter had 4 basic states and outputs defined as follows:
Green– Everything is normal and running great
Yellow– System is experiencing some issues
Red– Something is really wrong!
Lets take a look at a simple component to make it clear how this works- the SMS message sender. When everything was good and Splunk was providing data indicating the GREEN state, it triggers the SMS node as follows:
So, when the system was normal, I received a text that said “System State GREEN Everything is Good!”. I just had to define the phone number to send to and message payload, that’s it, Octoblu took care of the rest! Now, when the system went into DEFCON5, I received a very different message “STATUS: RESUME GENERATING EVENT – RESUME POSTED TO MONSTER.COM”!
So, taking this simple example, we extended this to all the things that make up the IoT Workspace as follows:
Raspberry Pi B+ with the Pi image running Gateblu with Wifi and Bluetooth adapters
A LIFX wifi lightbulb in the desklamp
FadeCandy controller board running the NeoPixel LEDs
A Phillips Hue Bulb lighting the glass plaques
Two servo motors mounted inside the Lucky Cat to turn the body left/right and the arm up/down
A relay controlling the laser projector mounted in the Kitty’s chest
A relay controlling vibration motors placed inside the mini file cabinet and mounted inside the foam rubber robot figure
A Punch Through Light Blue Bean hacked to be my keychain
An iPad acting as a digital photo frame showing pictures that reflect the system state
All of these devices were defined as nodes and connected through the Octoblu Gateway running on the Raspberry Pi. The difficulty ranged from the SMS example above (drag and drop) to hand coding custom nodes such as one for the servo control using the Johnny5 machine control library (thanks to Moheeb, Chris Matthieu and the whole Octoblu team for their help on this!).
In addition to the software, I worked out all the power supply requirements, logic/power/grounding cabling, relay control, board layout, etc. This included drilling holes in the cat for LEDs in the eyes and repackaging the circuit boards of a mini laser show projector in the body so it would project through a hold drilled in the chest. I learned all kinds of cool new tools in the process like ceramic drill bits, glue guns and soldering tiny things with magnifying lenses! Perhaps the single biggest challenge was somehow getting all this stuff across country to Orlando intact, figuring out how to get it mounted to the desk and actually working by show time!
I dont know what else to include here so please feel free to reach out to me @stevegreenberg to let me know if there is any other info that would be useful. We are also planning to hold a webinar in August to cover this info in an interactive format. In the meantime, enjoy some pictures below of the project and Geek Speak Tonight!
(Click on images to expand them to see more detail)
If you made it this far you are a hero, please let me know and I will buy you the beverage of your choice at our next industry meetup!