For this year's holiday card my employer enlisted the aid of the Animal Care Center Boroughbreds to wish you “Happy Holidays” in a way only they can. We gave them control of our Twitter account and between the hours of 12 PM and 4PM, for 3 consecutive days, they sent out season’s greetings in their own words, with their own four paws. Check it out:
About the Build
The creative team approached me with the idea to build an oversized keyboard that would enable dogs to craft a tweet to the masses, in hopes of spreading adoption awareness.
The build itself was fairly simple. The hardware leveraged is as follows:
1 Arduino Yun
15 pressure sensing matts
15 10k ohm resistors
Plenty of 22 AWG wire
While the Yun recorded the keys pressed, that build also had a software application that was written to store, process and manage the incoming data as well as integrate with the Twitter API.
Lastly, the event was broadcast live using 1 mevo camera and of course our team of social creators-the ACC Boroughbreds.
Initially we envisioned the keyboard to resemble the slim keyboard of a mac notebook with the slightly raised keys. However, given the fact that our social team (the ACC Boroughbreds) were not fully house broken, we decided to wrap the keyboard within vinyl, which would make for easy cleanup.
Our first prototype, as seen in the images below, made use of two old dance dance revolution pads. I began by stripping off the enclosure affixed to the pads, and proceeded to attach each lead to a unique pin on the Arduino Yun board.
I used the 10k Ohm resistors to force all pins low. Furthermore, each circuit was naturally open until its respective button was pressed.
Stepping on one of the buttons closed the circuit, set the pin high and was immediately read by the application. Because the application, like any Arduino program, runs in a loop, it was imperative to ensure that the HIGH signal was only captured once. (Unlike if you open a word document and hold down the "A" key.)
After each pin was read, and before exiting from the loop, if any pins were HIGH it resulted in a HTTP/1.1 POST to a local server along with a delimited string of words pressed. The server, listened for incoming traffic, extracted the words within the message and retained them within Redis until there were an appropriate amount of characters to tweet.
Using the Live Stream Memo cam, we captured the entire event in real time and streamed it within the Twitter platform for the ACC followers to monitor.
Because this was a pretty straight forward build there were very few things that I was able to take away. That being said, sometimes the simplest of projects do not always go without providing a lesson, as was the case.
At the time of this build, I was not aware of a mechanical issue known as Button Bounce. As I have learned, it is a major issue that rears its head when using any mechanical switches (this project utilized 15). For those unaware of button bounce, it is exactly what it sounds like. Recall any slow motion video you have seen of two objects colliding at high speeds. You may have witnessed that they have a moment where they separate due to opposing forces, before they collided once again. In electronics this can cause havoc with counters, clocks, and or anything else that requires precision.
It became apparent that this would need to be corrected lest we would erroneously POST more words than expected.
The good news is there are a few ways to handle this either via software or hardware. For this project I opted for the software approach, but also picked up a few debouncing IC's for any future hardware projects.
The software approach was to find the optimal duration to delay the reading of a switch. This allowed time for the bounce to occur before latching in the current state of the switch.