At the Stripe office, there's a tradition of ringing a gong at meal times. As we grew, I built a cluster of networked robotic gongs to keep the tradition alive throughout the office (see instructable for Gongbot). The Gongbutton sits in the kitchen to trigger all of the Gongbots.
Gongbutton shares much of the design of Gongbot but is built into a fun big button case and plays a gong sound when the button is pressed. It's based on the Spark Core, connects over WiFi and communicates via an MQTT message broker.
Note that the Gongbutton isn't much fun without a Gongbot to go with it!
Step 1: Parts, tools and software
dfu-util: I installed it via Homebrew on OS X
Gongbot firmware: See the attached bin file or look on github.
Serial terminal: minicom, screen or Putty should all work though I found minicom easiest to work with.
Note that you may choose to build the firmware from source to get the latest version. You should be able to find instructions for setting up a build environment in the Spark documentation. You can find the source and its dependencies at these links: spark-gongbot, spark-core-communication-lib, core-common-lib.
Step 2: Modify the button
The button needs space for the Spark Core with a hole for the USB port. I chose to use the space usually reserved for batteries to fit the Core. Use a Dremel to cut out a slot for the board as shown in the picture. Try to leave the fit somewhat snug to avoid the Core wiggling around too much after assembly. You may also want to drill small access holes for the two buttons on top of the Core to allow for reprogramming.
Carve out space for the USB port in the black rim of the button taking care to align the small plastic notch in the rim. I used a small drill bit to start the hole and a Dremel to carve it out to size. Note that you'll have to take some plastic off the inside of the black ring with your Dremel to get the Core to fit properly.
When done, you should be able to fully reassemble the button with the Core inside and power it up via USB.
Step 3: Electronics
The Gongbutton uses a 1-bit DAC and a simple single transistor amplifier to power the speaker. You can learn a bit more about the design principles at Makezine. I found through trial and error that a 2.2k resistor worked well with the 2N2222A transistor I used. You can do much better than this design as far as amplifiers go though I'm not sure how much it would help given the quality of the speaker. The low pass filtering didn't seem to help the sound quality so I excluded the capacitor from the final design.
The audio itself is a PCM-encoded wave file built into the firmware binary.
Prepare the Spark Core
Out of the box, the Spark Core comes with header pins that are great for prototyping but won't fit in the enclosure. Remove the black plastic spacer at the base of each set of pins then carefully desolder and remove each of the 24 pins from the Core. I found this to be a slow process with a soldering iron and needle nose pliers.
Connect the electronics
Remove the jumpers (little black components with "0"s on them) from the original button board. Connect up the components as follows. Make sure everything fits when the button is assembled!
Step 4: Flash, configure and gong!
Flash the firmware
Follow Spark's directions for setting up the command line client. Connect the Spark Core to your computer via USB. The LED should come on and then nothing should happen. Hold down both buttons on the Core. Release the RST button. When the LED starts flashing yellow, release the MODE button. Run "spark flash --usb core-firmware.bin" from the command line. You should see a series of text and then progress dots while the flashing is in progress. You may get a poll timeout error message at the end of the process -- that's a known Spark bug but not a problem.
Configure the core
Run "spark serial list" to find the serial port or device file associated with your core. On OS X, mine was "/dev/cu.usbmodem1411". Connect to your core using your serial terminal. With minicom I use the command "minicom -D /dev/cu.usbmodem1411".
Press RST. A 2-3 seconds after resetting, press Enter in your serial terminal to start device configuration. You'll be asked for the following:
At this point, the serial port will reset and the button will enter WiFi config mode. Press "w" to write a new WiFi configuration and follow the prompts. If you've already configured the WiFi, you can press RST to skip this step.
The LED on the Core should eventually start pulsing cyan indicating that it is online. Aside from the use of cyan to indicate a connection with the MQTT broker, the other colors should match the Spark documentation. Each time the Core boots up, the LED will transition through the following colors:
With the LED pulsing cyan, press the button. Your gongs should ring!