At the Stripe office, there's a tradition of ringing a gong at meal times. Several months after I started, we outgrew our space and had to split up across multiple floors. Instead of giving up on the gong, I built a cluster of networked robotic gongs! Pressing the button on any Gongbot (or the gongbutton) triggers all of the Gongbots in the same cluster and a message in an IRC chatroom.
Gongbot is based on the Spark Core, connects over WiFi and communicates via an MQTT message broker. It uses a strong servo to swing the beater into the gong. At the time of this writing, we have 3 gongs and a button operating in the office and more on the way.
Step 1: Parts, tools and software
Step 2: Electronics
Prepare the servo
The wires on the servo stick out in a way that prevents it from fitting in the enclosure.
Snip off the connector at the end of the servo cable. Unscrew the 4 screws on the back of the servo and remove the backplate. Be careful not to disturb the innards in the process. Slid the rubber stress relief shoe off the end of the cable. Using your Dremel, grind a notch on the back plate of the servo such that the wire can stick straight out the back. Reassemble the servo.
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
Break out your soldering iron and connect things up as follows:
The wires on the button need not be very long -- just a bit longer than necessary to fit in the enclosure. It's helpful to have a bit of slack on the servo wires so you can get the Core positioned within the enclosure. They can't be too long or there won't be enough space for them to sit behind the mounted servo. Be especially careful with how you position the MOSFET as there isn't a lot of room for it in the case.
Step 3: Flash, configure and test
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 Gong 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. The servo should move a few times over a few seconds. If not, check your wiring and look in the serial terminal log for clues.
Step 4: Final Assembly
Install the electronics
Insert the Core into the bottom of the enclosure, pushing the USB connector through the hole at the back. The USB-side of the Core PCB should be flush with the enclosure wall. Press firmly on the antenna-side of the Core PCB to secure it in place. It should be quite snug but you shouldn't have to force it.
Remove the nut from the button and thread the button through the hole in the front of the enclosure. Hold the button in place from the inside with a pair of needle-nose pliers and tighten the nut from the outside.
Slide 6-32 nuts into each of the 4 slots just inside the main opening of the enclosure. Insert the servo into the enclosure and secure it into place with 6-32 machine screws.
At this point it's probably worth powering up the Gongbot again to make sure you did everything correctly. The servo should move when you press the button and you should be able to faintly see the Core's LED through the plastic on the side of the enclosure.
Attach the gong
Drill two 10-24 clearance holes at the center of the top rail of the gong stand. It may be helpful to use the enclosure to mark off the position of the holes. Attach the Gongbot to the stand with 10-24 machine screws and nuts.
Attach the beater
Find the straight, two-sided servo horn that came with your servo. Drill two tiny pilot holes towards the far end of the beater. The holes should be smaller than your tiny nails and spaced to align with the farthest apart holes in the servo horn. Feed the nails through the servo horn and hammer them most of the way into the beater. Bend the remainder of the nails around the servo horn to secure it in place. I also used some hot glue to help hold things together.
Admittedly this is one of the least elegant parts of this design. It would be hard to do without a tiny #60 drill bit and some very small nails. Feel free to improvise!
Power up the gong, press the button and wait for the movement to stop. Press the servo horn onto the servo such that the beater is pointing straight down. This is the neutral position that the beater will return to after each swing.
You're done -- give it a hit!
Step 5: Advanced Gonging
There's not much point in having a networked Gongbot if it isn't going to talk to anything. I'd suggest: