Personal Projects: Parking Reminder
Curse you San Francisco, you’ve bested me for the last time! At first, I took it in stride. “You caught me fair n’ square,” I thought as I clicked the payment button with a mirthless chuckle. The second time was far more difficult to accept and may even have involved slightly quivering, balled fists. “C’mon, I live right there. I… I thought we were friends!” A few months and seven painful parking tickets later, I came to the only logical conclusion – I’d have to compensate for my financially-crippling inability to remember street cleaning days with a mix of circuitry, firmware, and blinking lights. Thus was born my most recent personal project, the Street Cleaning Day Parking Reminder Device (SCDPRD). Many Mindtribers, inveterate engineers that we are, have appropriately nerdly projects that we work on in our spare time. It’s delightful (though regrettably rare in general) that so many of us here share the experience of working on something at home, thinking, “Hey, this is what I do all day at work,” and then continuing to happily crank away with nary a shrug. It’s always fun to hear about what everyone else is tinkering on and swap ideas while munching away on the office hoard of surplus Halloween candy (‘tis the season). As far as personal projects go, the SCDPRD is not complex, but it offered a great excuse to try out some new hardware and fabrication resources. I wanted a device that could display the current date on an LCD. It should also have LED’s that flash red on street cleaning days and turn yellow the night before as an advance warning. A simple enclosure would also be nice (exposed wiring is never good for spousal approval).The AVR Butterfly was selected as the hardware base. It sports an ATMEL AVR ATmega169PV and a laundry list of peripherals, all for just $20. Specifically interesting for this project were the LCD, a real-time clock, and a joystick that would be useful for setting the date. There’s also a speaker, flash memory, a temperature sensor, and an attached safety pin that makes the Butterfly the fullest-featured nametag of all time (of all time).* Another perk is the included boot loader, which makes it possible to program the micro without any external hardware. This means that one can take a serial cable connected to a PC and simply jam a bunch of jumper wires on the end, festooning it like a jaunty jester’s cap. Connect those wires directly to the Butterfly board, and it’s ready for programming. As for the firmware, the Butterfly comes preloaded with a demo app that exercises all the hardware peripherals, which is such a boon that it should probably be heralded by angelic trumpets. It’s even able to play Für Elise right out of the box (though Ride of the Valkyries would have been even cooler). In the end, the most interesting task remaining was to write routines for determining the day of the week. Since the included firmware only tracks numerical dates, the SCDPRD would need more code to identify the second and fourth Tuesday and Friday of each month (street cleaning days). To implement this functionality, I selected the oft-foreshadowed Doomsday algorithm, invented by none other than Game of Life-Creator John Conway. Of course, a simple incrementing counter would have sufficed, but the Doomsday algorithm offered the distinct advantage of letting me include the word “Doomsday” in the feature list. The algorithm is based on the fact that, for any given year, certain easily-remembered dates such as 4/4, 6/6, and 7/11 all fall on the same day of the week, which is referred to as that year’s Doomsday. Once the Doomsday for a particular month is known, the day of the week of any other date in that month is just a simple addition/subtraction and mod 7 away. Famed Professor and Mathemagician John Conway can allegedly execute the entire algorithm in under two seconds IN HIS HEAD. File that away for the next time you’re foolishly tempted to challenge Algorithm Juggernaut John Conway to a for-stakes game of let’s-choose-arbitrary-dates-and-figure-out-the-day-of-the-week-upon-which-they-fall. With the internals complete, the final step would be dignifying them with an enclosure (they are internals, after all). I decided to try out Ponoko, an online vendor that offers laser cutting and 3D printing with a variety of materials. Of course, a simple foamcore box would have sufficed, but using Ponoko offered the distinct advantage of letting me include the word “laser” in the feature list. Ponoko’s selection of materials, colors, and sizes was excellent, and placing an order with the online interface was quick and painless. Customer service was also very accommodating (thanks Catherine!) when I realized after finalizing the order that I actually had quite a bit of unused material in those acrylic sheets and hey wouldn’t this be the perfect chance to finally make that handsome set of giraffe-themed pencil holders you’ve always wanted hmm?? Each side has a single red-green LED, so I used some diffusion film to spread the light and also to achieve a more uniform yellow when the red and green are on together. There are some quite remarkable films available that can even diffuse a laser spot to a specific shape like an ellipse, a feat so improbable that it would have gotten you burned as a warlock in the not-too-distant past. If you don’t happen to have any leftover engineering samples of high-performance films on hand, a scrap of paper or a piece of non-opaque plastic can also work as a diffuser. By scuffing the surface of the plastic with varying grades of sandpaper, it’s possible to finely control the intensity and shape of the light. This also works when the plastic is edge-lit, which is how even illumination is achieved in LCD monitors.** This was quite an enjoyable project that went smoothly and had a good balance of ME, EE, and firmware. Eventually, it might even pay for itself in an unquantifiable, weird ex pre facto amortization sort of way (which is more than I can say for the ill-conceived, joule-guzzling “aquanarium” project of ’08). And San Francisco, I’m sorry for implying earlier that we have some sort of antagonistic relationship. How could I stay mad at you, what with your acclaimed eateries, your charming hillscapes, your splendid library system? Now, if I could just do something about that fog… *Previous versions also included a light sensor that was later removed for RoHS compliance. When I lamented this fact to the office ceiling, a coworker promptly and awesomely produced a through-hole light sensor FROM HIS WALLET. **When light enters a sheet of transparent plastic from an edge, it is “trapped” inside by total internal reflection. The light can exit from the sheet’s edges, but very little escapes from the sheet’s surface (think lasagna of fiber-optic pastas). The light will escape, however, when the internal reflection is disrupted in some way. For instance, scuffing the surface of the sheet with sandpaper will cause some light to exit from that area of scuffification. This technique is useful whenever light must be precisely transported over a wide area. In an Apple keyboard, for example, clever light guide design makes all the keys glow equally bright using just four tiny LED’s. Thin LCD’s also rely on light guides, such as the one from a Game Boy Advance SP pictured below (hey, it’s a footnote with a picture!). In this case, tiny internal bubbles are used instead of surface texturing. Where the bubble density is higher, more light rays are caught and thrown outward, resulting in more brightness. Even though the actual display has only four LED’s all located along the same edge, a gradient in the bubble density produces even lighting across the entire surface.