Some time ago we got a Jelly Belly machine at work. Since we are tinkerers in nature, we decided to mod it a bit. Since feeding coins into the machine felt a bit boring, we installed a RaspberryPi Model A, a stepper motor and a wifi module inside. Here’s the result!
As usual, we decided to document the task. So, if you are interested in how this thing works, continue reading.
The build process
First of all, we opened up the thing and decided to ditch the coin feeding mechanism, since we will not be needing that anymore. Here’s the whole thing taken apart
After careful measurements and pondering we decided to order a stepper motor driver and a motor for the project. We decided to go with this one. I soldered the kit together, and tested it with the stepper example of the Pi4J library. It worked fine! Then we got some gears from Hobby Point, to make the rotary wheel turn.
We attached the motor to the frame of the candy machine with the help of some precisely cut holes, nuts and bolts.
We testfitted the Pi, stepper driver and the wifi dongle in the frame, but it was a bit too tight fit. So what we needed to do was to remove the USB socket from the PCB and move it around a bit. At the same time we removed the unnecessary LEDs from the stepper controller board to get some more space.
Once again, a bit nerve wracking process, but with a bit of patience, everything turned out okay.
After the modications, we put everything together. I coded a quick and dirty API for turning the motor. The Pi4J stepper script was too slow to start because of the sluggish Java Virtual machine on a slow Pi, but luckily I found a stepper motor driving script for Python, and modified it to work with our controller. It started rotating the motor instantly when I ran the script. Success.
Then we tested everything worked. Spoiler alert: It did.
After multiple tests we found out that in some rare occurences some candy can get stuck, so we added a film which prevents the candies to accidentally go in wrong places and become lodged between the rotating gears.
Next up was fitting all that stuff inside the case. Because metal casing isn’t always the best one possible in regards of conductivity and short circuits, we decided to wrap everything electronic in duck tape, or as we call it here in Finland, “Jesus tape”. (I guess the name is related to the fact that you can revive/fix almost everything with duct tape)
A relatively tight fit, once again, but hey, no wasted space.
After that we put the pieces back together, and did a test run, which you can see in the video at the top of this post. So, once again, a small fun project was complete :) Stay tuned for more stuff like this! Huge thanks to my friends Tomi and Mika!
Here’s the money shot