Candy Cane Dispenser

Wanting to keep going with the interactive theme, I decided to do a candy cane dispenser. This is pretty much a straightforward build as I reused a vending machine motor and its spiral dispenser. A little engineering needed to be done, but it was one of my easier projects.

First, a little aside before I get to the project. I have a digital background, so my go-to is always to grab an Arduino (sadly, I almost never use my first love, PIC microcontrollers, anymore) and code something up for what I want. So I am always amazed when I see a pure analog solution perform a task for a fraction of the cost and complexity of a microcontroller design. The thing I was very impressed with was the vending machine motor. There is a NO (normally open) momentary push button switch that can power the motor when it is pressed in (this means that it makes a connection between the two sides of the switch ONLY when held down; once you release the button it goes back to being disconnected see here). There is also a “trigger” input that can turn the motor as well. To operate the motor, a 12V supply is applied to the trigger for a fraction of a second (think 100s of milliseconds), and the motor is powered as long as you hold the trigger down and it starts turning. Part of what it turns is a little ‘D’ shaped rod (see the arrow in the picture below). At some point, the NO push button is depressed by the round part of the rod (overriding the button your finger was pushing). You can stop applying power through the trigger at this point as the momentary switch continues to supply power as long as it is depressed. As the rod turns, it eventually gets to the flat part; when that happens, the push button releases and stops powering the motor. This technique allows the motor to make a single revolution every time consistently. Here is a quick image:

With the hard work of figuring out how to have a single rotation done, I just needed to figure out how to kick it off. After a few false-starts, I ended up with a simple light-up doorbell like this as a trigger. The doorbell is connected to a 555 timer in monostable one-shot mode. The timer’s output is normally grounded, but when someone presses the doorbell, it triggers the 555 to start outputting 12V to the motor’s trigger. This powers the motor long enough for it to do its partial turn and allow the momentary switch button on the motor to be depressed by the D-shaped rod. Then it continues in the way mentioned in the paragraph above.

Using my new favorite lightweight and waterproof material, coroplast, I framed out the display itself. The walls have cavities in them where I was able to store the electronics and power supplies. Basically I shoved a 12V wall-wart in there, the 555 timer, the doorbell connection, outlets to plug all of that in, as well as power the C7 Christmas light bulbs coming out of the ceiling. I then hang a a single power plug from within the cavity to below display that is used to plug the whole display.

The back panel is slid vertically into place so that we can lower it to add more candy canes. The panel is framed out with normal indoor trim and held into place with a little piece of wood that rotates to allow the panel to stay in place until I am ready to lower it. (TODO: show a picture)

Here are some pictures of the setup:

The candy cane machine has been a HUGE hit. We buy canes in bulk and have to fill it numerous times a night on nice weather days. What is a pain is that the back of the display is not see-through, so I can’t tell from the house if it needs a refill or not. There are many times we would go down and it would be completely full, or completely empty, with no rhyme or reason. Knowing something had to be done, I decided I needed a little camera to keep track of the number of canes left. I used a Raspberry Pi Zero W (an ultra cheap mini-PC with built in WiFi for ~$10) and installed MotionEyeOS on it. This is a Linux based operating system that is designed with homemade security cameras operations in mind. To use something cheap and small, I bought a used webcam from a laptop bezel and wired up the connection to work with the USB on the Pi. I then installed the camera vertically in the back of the dispenser and ran the USB cord for it into the hollow cavity with all of the other electronics and the Pi. This has been a LIFE SAVER! I setup motion detection, so I get an email when it detects motion (the candy canes moving), and I can check in throughout the night to see if we need to run down or not. I highly recommend a way to know how many canes you have if you decide to make something like this for yourself. Here are some images of it.

And finally, to spice things up during the middle of Covid 2020, we decided to use the dispenser to hand out Candy for the kids at Halloween. The only Halloween Candy Canes we could find were straight ones, so we cut ribbons and taped a pair of canes together and hung them from the ribbon. Now the kids didn’t need to interact with us. We sat back and refilled when needed. To make it a little more Halloween oriented, we changed the backdrop to be a graveyard. I think it turned out nicely.