Problem: Build an advent calendar that automatically unlocks candy each day.
Solution: Use razor blades… Obviously!
This year, I decided to make my girlfriend April an advent calendar full of her favorite candy. But I had to make sure that she wouldn't be able to just open up a door and take candy whenever she wanted. I needed the calendar to lock each door and only unlock one door each day in December.
My semi-successful solution was to tie each door to the calendar using a piece of string. Then I connected a razor blade to some CNC parts and had the stepper motor move the motor and cut the string, releasing the door for that day.
How To Build
- Arduino UNO
- A4988 Stepper Motor Driver
- NEMA 17 Stepper motor
- CNC Stepper Motor Coupler Connector
- T8 500mm Lead Screw Rod W/Nut Shaft Coupling Mounting Support for 3d Printer Set
- Lots of hardboard
Make the calendar strurcture.
First I cut out a bunch of wood to make the calendar structure. it was supposed to have 26 slots for candy (25 days in December + one bonus day when I showed off the calendar). At the end of the project, only 22 were used because the CNC parts got in the way.
Attatch the CNC parts to razor blades
I didn't want to try controlling 25 separate locks, I wanted it to be simpler than that. I had purchased the following pieces to make a small laser cutter, but haven't gotten around to actually making that yet:
So I attached razor blades to these pieces, with hot glue of course, so that I could just control the stepper motors that would cut some string holding on the calendar doors.
I used a cheap plastic rail that I found at home depot, and some blank circuit boards hot glued to the nut. This worked way better than expected to guide the nut in a straight line.
Wire up an arduino to the stepper motors.
With the calendar setup and the razor blades in place, I needed to put together the circuit to control the motors from my Arduino. I purchased some A4988 stepper motor drivers and used the following blog post to help me wire everything and write the first piece of code. https://howtomechatronics.com/tutorials/arduino/how-to-control-stepper-motor-with-a4988-driver-and-arduino/
Program the arduino
With the calendar setup and the motors and razor blades in place, I needed the code to actually make this thing work.
One big problem I faced with this, is that the Arduino won't be able to know the current date and time after it's been powered down. So I needed a way of telling the Arduino what the current time is, every time it gets turned on / plugged in.
My original plan was to use an Arduino pro mini to keep track of the time that could be connected to a 9v battery. So even when the calendar was unplugged, the pro mini would continue running. Then when the Arduino UNO needed to know the time, it would just ask the pro mini.
After an hour of failing to get the SoftwareSerial library to work, I decided to give up and just use my laptop to sync up the date and time to the Arduino. The consequence of this is that every time we unplug the calendar, the Arduino needs to be plugged into a computer that can run the following script to sync the date: Computer Serial code.
All of the code for the Arduino can be found on github: https://github.com/Sam-Meech-Ward/Advent\_Calendar\_2018
Add candy and tie up all of the doors
Now that the calendar is pretty much completely setup, the only thing left to do is add candy and tie up the doors.
April's favorite candies right now are the herbaland gummy candies, so I bought a bunch of those. To mix things up, I also got some lint chocolates and a fidget spinner.
Putting the candy in the calendar was easy, tying up all of the doors was a long and mundane task. I could never be a sewer, I don't have the patience to thread anything.
Give the advent calendar to a loved one
Because of bad string tying skills, a limited amount of time until December 1st, and an overall lack of planning and experience; the calendar ended up looking like this:
But at least it works… kind of.
That's why you give this calendar to a loved one, they're the ones that appreciate “homemade” gifts.
This calendar is kind of a perfect visualization of any piece of software ever built. Most software engineers start out with a vision for something that's going to look great and work great and end up with code that looks and functions like this calendar.