This year, kids being eternal little disease carriers, I thought it would be interesting to make a remote candy dispenser. I thought about making it fully automated, but it’s surprisingly difficult to single-select candy, and very easy to make something that jams and ends up dispensing smooshed candy.
So I went with an easier plan: a long PVC tube the right diameter for Snickers bars to slide down. (Not the Snickers Peanut Butter ones. They’re chunkier and didn’t fit. I had to eat those. Aw, phoo.)
The pipe was a piece of 8′ long PVC 1 1/2″ inner diameter tubing that I got from a home improvement store. It worked just fine. Well, more on that later. In testing, it worked just fine.
My intent was a SCARY FACE, so I went to Thingiverse and found one. It’s a Weeping Angel mask, printed in two pieces, which each barely fit on my Prusa Mk3S. They each took about 14 hours to print in PLA, partly because they had so much support structure.
I tried to use meshlab to cut the mouth out before printing, but my old laptop didn’t deal well with a shape that had like 687880435 faces. Soooo I gave up and printed it out as the stock Thingiverse design.
Once that was done, I drilled a hole through the mouth and used a Delta scrollsaw to cut the mouth out.
Here’s something interesting about scrollsaws. If you move really fast, aggressively cutting, they work well. The moment you slow down, the blade heats up, and then you’re still moving the blade through the material but you’re no longer meaningfully cutting. You’re just melting a hole that refills on the back side, so you can go any direction you want regardless of the blade tooth orientation.
What this meant was I’d cut a section of the mouth out, then it’d start melting, and I’d back out a different direction into the central area I’d already cut out, wait a moment for everything to cool, and take another run at it.
This did work eventually. It was a dumb way to do things.
The handrail from the house down to the steps is maybe a 20 degree angle, so I used FreeCAD and modeled an adapter that on one side was a nice cylinder that pressed onto the PVC, and on the other was a square opening just a bit larger than a Snickers bar, and used FreeCAD’s sweep feature to smoothly transition from one shape (round) to the other (square) along a curved path. The result came out really nicely.
Here are two different sizes, when I was briefly trying slightly narrower tubing (in which the Snickers totally jammed.)
(plumeria flower for scale.)
Then I had two halves of the mask and the elbow to attach to each other, and the back side of the mouth was quite uneven, and I needed to attach an electronics package to the back of the mask.
It turns out that you can use a soldering iron and a roll of filament just like a tig welder on PLA. I used my Metcal with a STTC126 tip, a slightly curved tip running at 775F that I strongly prefer for SMT soldering.
I sanded the joint surfaces on the two halves of the mask, put the two halves of the mask together, and quickly ran the soldering iron along the joint on the front. It left a visible line, but not much of one. If I’d spent some time with filler putty, I could have made this go away. On the back I progressed more slowly, while adding in filament, and made quite a thick weld. I attached the adapter the same way: butted it against the back of the mask, made a few spotwelds, then started adding filament.
Like gas and tig welding, you get the material hot and semi-molten, then add the filler, and move along. (I didn’t get a stack-of-dimes weld, though.)
Here’s a picture of the back, with the halves welded together, the adapter welded on, and some LED’s on thermal carriers, which I attached to the mask by simply welding a couple of pieces of filament to the mask back, putting the PCB holes over the filament, then bending the filament over and sticking it to the mask again. It’s a loose fitting, but it’s quite robust, and it’d be easy to tighten up if needed.
For more fun, I stuck a photodiode onto a breakout board we used to sell for AS5040 chips. It soldered in where I used to have an LED for the magnetic alignment indicator, and with some luck, a bias resistor across where the VCC cap used to go gave me a resistive divider using the photodiode, where Vcc, Vss, and the middle node, all were attached to separate but adjacent holes that served for the magnetic indicator interface, so I could solder wires in and have a nice solid proto board.
On the other side I used a spectacularly bright 20mA white LED, forming a nice optical tripwire circuit.
I drilled holes in opposite sides of the PVC just above the adapter and taped them both in, and then when a snickers bar broke the beam, the Arduino received an interrupt and went on to do something.
In this video it drives an LED with a 4% pwm cycle, and when triggered, it ramps up to 100%, then back to 4%, then flashes a couple of times. Here’s a video. I hope it works.
I freely admit I was inspired by a mechatronic display, Enma-Do The Hell God, in the town of Noboribetsu, Hokkaido. It’s super cheesy.
So I also wanted it to go RAAAAAR. And while I did get that to happen, it required a 12V supply to drive the H-bridge that drove the speaker. (I did this by setting up two PWM pins attached to the same Timer, one in inverting mode, so when I set up TCCR3A/B and rapidly shift values to them from a stored array, it drives the speaker quite well.) But that’s an aside, because I didn’t deploy that for lack of having a 12V supply I wanted to leave outside.
One of the above pictures shows the LED’s being triggered by a couple of TIP120 darlington transistors. They worked okay. I ended up using a dedicated two-channel constant current LED driver that could put about 400mA through each LED.
Here it is rigged up with one eye not yet functioning because my wiring was rubbish, but this got me convinced that the project was viable.
Then I did a better wiring job, got both eyes working, and ziptied it to the handrail, and was in business. Candy went in the top, dropped out the mouth, the eyes flashed, kids screamed, it was great.
Except sometimes the candy got stuck halfway down and I don’t actually know why. I ended up putting a ziptie around the bottom of the tube just above the adapter, a second around the railing, and a third connecting them, so it could move but wouldn’t fall down, and then I’d tip candy in the top and if it slid, great, and if it didn’t, I’d lift it up until it did. Sometimes that was a greater than 45 degree angle. I have no idea why they jammed so badly. It wasn’t a result of the holes I drilled for the opto, either: they were jamming about halfway down.
The other problem, as you can see from the picture, is that the LED’s were vastly, vastly too bright. You could hardly see the mask. Kids didn’t see where the mouth was.
These are old Cree XPEW LED’s and even at the minimum PWM (like 0.3% duty cycle) they were still too bright.
I needed some regular indicator LED’s sold as ultrabright, 40mA LED’s, not these giant monsters.
If I do this again, I’ll put in a boost circuit so I can drive the 12V sound system from a USB-type battery, and maybe figure out if it’s possible to add a vacuum assist to accelerate the candy down (without shooting it out the end like a full vacuum cannon), plus less aggro LED’s.
But it did look pretty great from the side with some auxiliary lighting to pick out the face details.