4 Oct 2011

A few weeks ago, Ben was putting together a proof-of-concept for what turned into the MQTT powered video wall. He needed a button to trigger the publishing of an MQTT message. We happened to have a Staples Easy Button lying around that was ripe for the hacking.

Big Red (usb) Button

A short time spent with scalpel and soldering iron and I had a pair of wires sticking out the bottom of the button that could be plugged into an arduino; which was good enough for Ben’s demo.

Big Red (usb) Button

But then this week Dale was wanting a button to use as a part of a Watson talk next week. Rather than just hand him the button, an arduino and a guide to wiring them together, I decided to be more helpful.

I knew the base of the button had some empty space once the batteries and speaker were removed and I had a spare Freeduino Nano awaiting a project, so it was back to the scalpel and, this time, hot glue gun.

Big Red (usb) Button

So we now have a button with a usb connection that can plug straight into a laptop to do stuff. Unlike RIG’s Big Red Button it doesn’t emulate a keypress as it doesn’t appear as a HID device to the laptop – I’ll save that for another day.

At the moment, the sketch on the arduino simply writes ‘hit’ to the serial port when the button is pressed, so it needs something to run on the laptop to get the message and act accordingly. Which is trivial enough with python:

import serial
PORT="/dev/ttyUSB0"

def buttonPressed():
 print "Do your magic here"

s = serial.Serial(port=PORT, baudrate=9600)

while True:
 l = s.readline()
 if l[:3] == 'hit':
  buttonPressed()

Big Red (usb) Button

  1. JerryOctober 4, 2011

    Hi Nick
    Nice one! Average time spent by UK children watching TV is a worry – http://www.bbc.co.uk/news/education-12334962 – I’m starting a home project to add MQTT to the TV in the lounge via CurrentCost sensor or Arduino, should have a Pachube feed up soon. Is this a first :- )?

  2. pingback from Big Red (usb) Button - The USBsJuly 31, 2012

  3. leave a comment

    You must be logged in to post a comment.