Treat Dispenser

I used:

Adafruit tutorial (We followed this pretty exactly; it’s a great tutorial. What follows in this post only focuses on the problems we encountered.)
Circuit playground express
CRICKIT for circuit playground express
Micro servo
Flex PCB material (6″x6″)
Copious amounts of hot glue

The first problem I encountered with this project is the unavailability of a 3xAA holder with DC jack. At the time, these were out of stock on adafruit’s website, and I didn’t want to pay shipping through another vendor for just one item. I figured the local thrift store should have some battery powered toys we could take apart for the battery holder. Happily, the very first one we tried had just what we needed.

Since we also needed a DC jack, we also got to dive into this mess of cords:

I put Mr. cackymonger in charge of extracting the battery casing and “soldering” it to the DC jack.

With that hurdle out of the way, I built the chute and added a slot for the gate, which looked like this:

Getting the gate slot to be the correct width was a pain in the butt. I’d highly recommend taking the time to find an exacto knife and not do it with scissors like I did- the jagged edges left by scissors create too much friction.

I discovered another problem with the gate when I attached it the microservo. The arm was not rigid enough and as the mechanism went up and down, the gate became more and more skewed.

Tightening the paperclip did nothing to help, so I did what I do best and heated up that hot glue gun. By eliminating the give at the top, the gate’s movement was restricted to just the up-down direction I wanted.

One final issue I had was with the sensitivity thresholds I set in the code. For awhile, a certain threshold worked, but I kept needing to increase it periodically. Turns out (and the tutorial says this, I just didn’t read properly) that humidity plays a big role in electric conductivity. We have a humidifer in the house that had run out of water. As the humidity in the room consequently decreased, the PCB material was less and less sensitive. After stabilizing the humidity in my house, my code looked like this in blocks format:

Or in Javascript:

The reason I set such a long pause at the end is because I didn’t want my dogs to just hold their paws and get treat after immediate treat. Here is our dog learning how it works:

Join the Conversation

1 Comment

Leave a comment

Your email address will not be published.