Confetti Bot | The MagPi #136

Want a party to go off with a bang? Then you want a device that fires confetti, as David Crookes explains in the brand new issue of The MagPi, out now.

If you’re going to celebrate, then you should do so in style. So what better way than sending a stream of confetti flying through the air at a press of a button? That’s the premise behind the Confetti Bot, a small cannon that shoots small pieces of coloured paper (biodegradable, of course) skywards with a decent amount of power. With a Raspberry Pi 3 B+ at its heart, it’s a relatively inexpensive way to get a party started.

The main device includes a 3D-printed enclosure with the motor, motor driver and Raspberry Pi wired togethe
The main device includes a 3D-printed enclosure with the motor, motor driver and Raspberry Pi wired together

The device was created to mark the public launch of Viam, a software platform for smart machines. The company’s project manager, Fahmina Ahmed, wired a button and a motor together to pop confetti in celebration of the milestone. 

Developer advocate Hazal Mestci then suggested taking the device further. “I thought we should make this project presentable and fully functional and provide a step-by-step tutorial for Viam users to follow,” Hazal says.What emerged was a device that uses Raspberry Pi 3 B+ and an L298N motor driver to turn a GPIO motor when the button is pressed to trigger the release of confetti. “I chose to use Raspberry Pi due to its versatility and ability to function as a compact and affordable computing platform,” Hazal says. “It provided the necessary computing power to control the button, motor and other hardware components involved, and its GPIO allowed me to program and control the actions of the Confetti Bot.”

Tight squeeze

The device is connected to a 12V battery to make it portable, and the components are placed within an enclosure designed with the assistance of senior robotics engineer Jeremy Hyde using the 3D CAD package SolidWorks. “Fitting all the components inside was the hardest part,” Hazal says. “I had to design multiple versions of the enclosure and test the prototype many times. I was also unaware that all confetti cannons are not the same size so, even between brands, sometimes the clasp wouldn’t hold the cannon strongly and the cannon would turn with the motor without popping anything. The cables to the battery are still hanging out, so hopefully a second version will enclose everything.”

Party time

The software was written in Python, making use of the Viam Python SDK. “Viam’s compatibility with a variety of hardware components allowed seamless integration,” Hazal explains. “I didn’t have to write backend code to activate the specific motor I was using, and I didn’t have to understand the nits and grits of computing boards to be able to get a reading from a pin. 

The motor driver 
is an inexpensive but important 
part of the build
The motor driver is an inexpensive but important part of the build

“Thanks to the Python SDK, most of the boilerplate code was already dynamically created for me. In the Viam app, as you add your components to your config, the Code Sample tab automatically gives you working code to get your resources. So it initiated the board and the motor as I added them, and imported all relevant libraries for me.”

Although the Confetti Bot works well as it is, Hazal says it can certainly be improved, and she has one particular idea in mind: “I want to incorporate a camera and machine learning capabilities so that it can automatically release confetti when a person approaches my desk,” she says. “It will surprise them on a good day and scare them on a bad one.”

The MagPi #136 out NOW!

You can grab the brand-new issue right now from Tesco, Sainsbury’s, Asda, WHSmith, and other newsagents, including the Raspberry Pi Store in Cambridge. It’s also available at our online store which ships around the world. You can also get it via our app on Android or iOS.

You can also subscribe to the print version of The MagPi. Not only do we deliver it globally, but people who sign up to the six- or twelve-month print subscription get a FREE Raspberry Pi Pico W!

The free PDF will be available in three weeks’ time. Visit the issue page for more details.

No comments
Jump to the comment form

Leave a Comment