Connecting the BS button to Octoblu

This didn’t start out as a sweary project. The original idea was to connect a big red button to Octoblu to allow it to start an online meeting, replicating what Chris Matthieu did with a BT.TN in this video. I thought it would be fun to get an actual Staples Easy Button and wire it up via a Raspberry Pi or similar. 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.

img_9031First 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.

The inspection gave me some key information to plan the build:

  1. The device runs on 3V from two batteries in a compartment in the base.
  2. There is quite a bit of empty space in the unit.
  3. The switch is part of the PCB with a clear trace from it to the main integrated circuit, ideally placed to be cut and soldered to.

img_9047u421Next 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 don’t have any in stock right now and this was a “right now” project. Instead I dug out an old 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.

Next job was powering the device so it can play its 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).

img_9043For the input side of things, the physical button push leading to a message to Octoblu, I simply cut the trace on the PCB between the push switch contacts and the device’s main IC 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 then connects to a GPIO pin on the U421 using a pull-up.

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 IC. I put a 4k7 resistor between the two chips to deal with voltage mismatches.

img_9065While coding up the software to talk to the U421 (more of which 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 about a second of pulse) between the push button and the U421 to extend the time the the effect of the 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 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.

bsflowIn 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 sounds and flash its LED. And it works!



4 thoughts on “Connecting the BS button to Octoblu”

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s