Right before Christmas I want to present a short Christmas gift project involving real-time systems, embedded programming, and a little mechanics. The basic ingredients are a big felt pen, large enough to host some batteries, a bunch of old CDs forming the flying wheel, an embedded ATmega microcontroller, 8 small SMD LEDs, and some wires. Glue about four CDs together and mount them on the felt pen as shown in the figure.
If your design spins well, paste the microcontroller and the 8 LEDs to the top disc. The 8 LEDs should follow a straight radial line on the disc as shown in the next image. Now power up the solder station and solder the microcontrollers output pins (I used PORTD, which is PINs 25 to 32) one-by-one to the LEDs’ anodes. Add a common ground to the LEDs’ cathodes, connect battery power to the MCU and you should be fine. Note that this design is gonna drive the LEDs above specification, but this worked fine for me.
Next stage is writing the embedded code for the MCU. Basically, I created a library of characters (inspired from the Commodore 64 ROM characters), which is used by the main program to write a text to the LEDs. Thus, each character is described by 8×8 bits, organized as one byte per column. The program uses a timer to count the current character of the message and the position within the given character.
This way the text appears on the disc when spun fast enough. You still need to measure the average spinning speed, I guestimated it first and the corrected the values based on the speed the text appears to be moving on the disc.
Programming the MCU can be a pain, remember, we didn’t solder any contacts for the programming interface, did we? I used extremely small mini clip jumper wires to attach to the MCU serial programming interface, which, despite being serial, requires five contacts. Using these, I could program the MCU with my embedded real-time program. Luckily it ran without problems and I didn’t have to debug the embedded code.
The results of the project can be seen in the following video.
Merry Christmas/Hanukkah/Kwanzaa to all of you!