In addition to being a computer geek, I’m also a closet electronics geek, equally happy with a soldering iron as with a compiler.
This is one reason I was so excited when Citrix got into the IoT space when we acquired Octoblu. One of the very cool things that the Citrix IoT team has built using Octoblu is the Intelligent Spaces for Meetings experience—a collaboration with Hewlett Packard Enterprise that combines physical devices, such as beacons and presence detectors, with virtual entities, such as Skype for Business sessions to provide a highly automated, contextually-aware collaboration and meeting experience.
A really cool benefit of using Octoblu to power these spaces is that organizations can extend the core automation and experience with additional IoT devices and workflows. We have one of these spaces in the Citrix office in Cambridge and I have the login details for the associated Octoblu account—a recipe for hacking!
The Octoblu engineering team has, of course, already been hacking their intelligent space and recently demonstrated using a BT.TN button to launch an online Skpye for Business meeting. I thought it would be fun to get a Staples Easy Button and wire it up via a Raspberry Pi or similar to achieve the same outcome. However, I’ve not been able to find one of these big red buttons available in the UK so I hunted around for alternatives. I came across a range of similar devices on Amazon with various words printed on the button and a set of recorded sounds appropriate to the printed word that would be played on a push of the button. I decided on this particular version, which has some, er, colourful things to say.
My original plan was to discard all the electronics except for the push button, but on hearing the amusing, if slightly rude, things the device had to say I thought it would be a shame to strip it of its ability to answer back.
So, instead my unidirectional button→Octoblu plan became a bidirectional one with the ability to send a message to Octoblu when the button is pressed and to have Octoblu be able to send a message to the button to cause it to utter one of its delightful musings.
The first step was to take a look inside to see how it worked and how much space I had to play with. I was pleasantly surprised at how easy it was to disassemble the device in a non-destructive manner. Removing three screws allowed me to easily separate the main body from the upper casing and push button. Care was necessary because the two halves are joined by two wires leading to the LED within the button—these broke from the PCB several times during the project.
Next, I decided on an interfacing mechanism. I wanted to make the unit USB-connected to give me the flexibility of using it either with a Raspberry Pi or with a Windows NUC in the office. This meant using an Arduino or similar device with a USB interface. An Arduino Micro would have been a good choice but I didn’t have any to hand and this was a “right now” project. Instead I dug out an old USBmicro.com U421 device— this is a simple 16 pin USB-connected GPIO device that is sufficiently small to fit within the battery compartment of the button, having removed the battery contacts and the central dividing wall.
The next job was powering the device to allow it to play sounds and light up its LED. The unit normally works off two AAA batteries, i.e. 3V. The U421 is a 5V device. It’s probably the case that the button’s electronics would be fine with 5V, but I didn’t want to blow it up and spoil my evening IoT playtime, so I put three diodes in series to drop sufficient voltage to be safe (yes, I know this isn’t exactly elegant, but it works).
For the input function—the physical button push sending a message to Octoblu—I simply cut the trace on the PCB between the push switch contacts and the device’s main electronics and scratched off a patch of PCB laquer to be able to solder a wire directly to the PCB trace and hence connect to the switch contact (the other end of which was ground). This was then connected to a GPIO pin on the U421 using a pull-up resistor.
The output function, simulating a key press to trigger the device to play a sound, was done by connecting a GPIO pin configured as an output to the other side of the severed PCB trace connected to the device’s electronics. I put a 4k7 resistor between the two chips to deal with voltage mismatches.
The button also contains a red LED which is flashed while it utters its questionable critques. I connected this LED to another pin of the U421 to enable Octoblu to control that too.
While writing the software to talk to the U421 (more on that later) I realised that the dumb nature of this unit was forcing me to use a painfully tight polling loop to avoid missing button pushes. Later U421 revisions have a latching feature to help with this problem, but this particular device can only be polled. I worked around this in hardware by inserting a one-shot timer (using a standard 555 monostable circuit with a 22k resistor and 47uF capacitor giving a pulse of around one second) between the push button and the U421 to extend the time button push could be detected by software and therefore allowing a less aggressive polling frequency. The 555 circuit was assembed in free-space (gross, I know) and tucked into a gap beneath the circuit board inside the button device.
The software to drive this is currently in very raw prototype form. I’m currently using node.js with the old v1.x meshblu library to talk to Octoblu and the very comprehensive “usb” NPM package to interface with the U421 over USB. On the button side the script runs a 100ms polling loop to read the relevant GPIO pin. On a state change corresponding to a button push it sends a message to Octoblu. On the sound/LED activation side, it listens for messages from Octoblu and, on receipt, toggles the output GPIO pin down and up to simulate a button push.
In Octoblu, I created a new generic device and copied its UUID and token to the local meshblu.json config file alongside my node.js program. To test both the send and receive function I created a flow that on receipt of a message (i.e. someone has pushed the button) sends it to a delay node that then forwards it back to the generic device 3 seconds later leading to a message back to the node.js program which triggers the button device to play a sound and flash its LED. And it works!
The button needed a field test. Happily, this coincided with our Workspace Services CTO, Christian Reilly, visiting the Cambridge office. The button and its Raspberry Pi were placed next to the whiteboard Christian was intending to use and a small web page with a button used to HTTP POST to the Octoblu trigger was provided to a co-conspirator who was in Christian’s meeting. This test happily demonstrated the button’s ability to exercise its vocal cords in response to messages sent via Octoblu. In fact I believe it got something of a stress test.
Back in the Cambridge office’s intelligent space, I created a new Octoblu flow as part of the intelligent space automation. This allowed me to have the button do two useful things. Firstly it can trigger existing Octoblu flows to launch the online meeting (as in Chris Matthieu’s BT.TN demo) and I’ve also extended this to be able to launch GoToMeeting sessions as well as Skype for Business ones. This all leverages the inteligent space capability to extract meeting URLs from the Microsoft Exchange bookings for the room. The controllable LED in the button is used to indicate whether a launchable session is available. Secondly the button’s ability to speak candidly is utilized to signal the end of a meeting room booking, acting as a less-than-gentle hint to the meeting room users that they need to vacate the space for others to use.
The button is proving popular with users of the meeting room. It’s surprising just how much time is spent setting up online meetings – a single press of a big red button, and all the underlying Octoblu-powered automation, provides a time-saving, easy, and, with this particular button, fun experience.