The Analog Clock Box
Introduction: The Analog Clock Box
Your kid is not able to read an old-fashined analog clock? Your students are confused with that evil European 24 hour time format? Then this box might be a good and simple motivator!
Open the lid, put some sweets or chocolate inside and push any button. The servo-motor will lock the box, and the display will show a clock set to a random time. Furthermore, it shows four times in digital hh:mm notation. Hit the button below the right answer, and you and another time will be presented. Repeat this process with correct answers (literally)three times - and *taadaa* the servo will unlock the lid and hence give access to the sweets.
The provided code is pretty simple - feel free to increase the number of required correct answers - or to replace the entire clock thing by other brain teasers.
Supplies
* 1x Leonardo-compatible "Pro Micro" Board with 8 MHz ATMEGA32U4 CPU @ 3.3 V (sometimessold as "Arduino Pro Micro", just make sure that it is NOT an Arduino Nano or Arduino Micro which have the 328p CPU and run at 5 V
* 1x KMR 1.8" TFT Display (like the one shown here)
* 1x Perfboard with 24x18 holes (70 x 50 mm)
* 1x Battery Holder with Switch for 4x 1,5 V AA batteries, approx. 69 x 65 x 19 mm, like this one
* 1x LD1117v33 Voltage Regulator in TO-220 case like this one
* 1x 100 nF Ceramic Capacitor
* 2x 10 µF...100 µF Electrolytic Capacitor
* 1x 40 Pin Female Dupont Hearder
* 1x 1N4001 Diode
* 4x Microswitches
* 1x SG90 servo motor
* 1x Piezo Butter (~ D 14 mm, H 7 mm)
* 6x M2x8 Screw
* 4x M3x8 Screw
* 4x M4x30 Screw
* 6x M2 Nut
* 4x M3 Nut
* 4x M4 Nut
* Some 0.15...0.25 mm2 Cable
* 3D Printer with some PLA filament (or, alternatively, a 3D printing service)
Step 1: The Circuit
In the provided diagrams and pictures, the perfboard is always shown from front and back. Please keep in mind that the view from front to back is mirrored this way.
The front side is the one which will accommodate the display. The Pro Micro goes to the back. Consequently, the header for the display is only on the front side (and soldered on the back side) and the headers for the Pro Micro are on the back side (and soldered on the front side). Thus, the headers shown with the dotted blue lines are only meant for orientation. I propose the following sequence for soldering:
1. 769
Cut one 3 pin header, one 8 pin header and two 12 pin headers from the 40 pin female Dupont header rail.
2. Solder the 8 pin header to the front, all the other headers to the back as shown in the diagrams and in the first photo. (Do not get confused by the 4 pin header marked with a red dotted arrow. This was an approach of a socket for the piezo buzzer which is skipped at a later stage as the housing became to big - please just do not add it).
3. Add the cables as shown in the diagrams, then all the other elements as shown in the picture.
4. After soldering is finished, push the Pro Micro and the display into their headers.
Please note:
* The slightly darker brown color in the diagram marks solder bridges.
* Instead of the barrel jack shown in the diagram, these red and black lines must be connected to the battery pack. It is best to place a small screw terminal here as shown in the pictures.
* Do not forget the heatsink on the voltage regulator. I bent the whole regulator with the heatsink by 90°. The original heatsink caused some collision here. This is why the pictures show that the heatsink was cut a bit using a metal saw.
* The electrolytic capacitor at the 3 pin header (which will host the servo motor) is a bit of an overkill as the servo is not driven directly by the Pro Micro nor does it have any load - it just rotates a simple flap. However, adding a 50µF...100µF capacitor here could stabilize the circuit, so it should be added.
* The diode is another overkill: Officially, the SG90 has a voltage range of 4.8... 611