I got a bubble machine for a fiver at The Works with the idea that I could control it somehow from a Raspberry Pi Zero W. It turned out to be quite a simple hack, with satisfying results.

Before adding any bubble mixture I turned the machine face down and took the six small screws out of the back so I could get the case open. Inside I found an electric motor, which turns the bubble paddles and drives the bubble-blowing fan and the back of the battery box. There’s quite a lot of empty space inside too, which means it’s not hard to squeeze the Raspberry Pi in there.

I de-soldered all the existing wires and replaced them with a short pair of wires from the battery compartment and another pair from the motor’s terminals. The original circuit included a button at the top of the case, which I’ve by-passed. I used my hot glue gun to fix the button-press in place at the top. I used the motor controller board from my CamJam Robotics kit to connect everything to the Pi, hooking the motor up to the “Motor A” terminals and power from the batteries to the VIN and GND posts (taking care to ignore my badly chosen wire colours). It’ll be interesting to see how much of a battery hog the little motor is.

Pi Zero W and CamJam motor controller in place and connected to power and the electric motor.

I drilled a 10mm hole in the back of the case and elongated it with my Dremel to allow me to pass a Micro USB connector through which supplies power to the Pi. I used one of these extenders so I can use a proper power supply or a USB power pack if I want to take the bubble blower outdoors (and of course I will once summer comes!)

As far as hardware goes that’s it, so I wrote a few lines of python with GPIOzero which supports the CamJam Robotics kit. This made the coding side of the project super-simple, which I like very much. It really did take just a few lines to prove the Pi was controlling the motor and letting me remotely blow bubbles.

Bubbles powered by @Raspberry_Pi pic.twitter.com/WdMxsxC7gt— James West (@jameswest) April 7, 2019

For the final touch I wanted to let anyone set the bubbles going by watching Twitter for the #blowbubbles hashtag. I recycled the code I wrote for the Tea Time Klaxon, so again it was quick and easy to get this going. The complete program is here if you’re interested.