Well, sure, you could have put a post-it note with the same message inside that chocolate box 🙂 but it won’t be nearly as cool, especially if your Valentine has a sweet spot for nerds. Come to think of it: of course she does, otherwise what is she doing still hanging out with you?
If you are still reading this, I have to assume that the matter of “why-oh-why?!” has already been settled and you have decided to go a slightly harder but much cooler way of delivering the message: you will build a POV (Persistence Of Vision) display inside that chocolate box which will spell “I HEART U” when shaken (not stirred!).
I would estimate start-to-finish time when you have all the parts ready to be about 1.5-2 hours.
Here are the parts you will need:
- A box of chocolates with a transparent cover. I used the 2012 vintage Ferrero Rocher chocolate box. They failed me in 2013 – their Valentine’s Day gift boxes were neither plastic nor did they have a transparent cover this year
- Atmel ATtiny13 MCU
- 6 x red LEDs
- 1 x tilt switch (a.k.a. ball switch, a.k.a. shake sensor)
- 1 x 14-pin IC socket
- 3 x 22 Ohm resistors
- 1 x 470K Ohm resistor
- CR2032 or similar 3V battery
- a holder for the above mentioned battery
- about 3′ of thin red hookup wire (30AWG is perfect size)
Please see the image with parts that I marked up below and I also have a more extensive explanation of the parts that have been chosen for the project on the POV display post on my blog
Step 1: How does this work?
POV displays use the LEDs uncanny ability to go from OFF to full brightness in a matter of microseconds (try that, incandescent bulb!) coupled to the human beings’ pathetic slowness in reacting to the world changing around us. Visual events happening within approximately 1/30th to 1/20th of a second (33 ms – 50 ms) from one another are all jumbled together in our slow brains and we “see” (i.e. perceive) them as one. So, next time someone says: ” it’s all a big blur to me”, don’t ridicule them. It’s exactly how you waddle through your life, too, even on the clearest of days!
So, the big goal is to light the LEDs 102 times in a very particular sequence while your hand moves the chocolate box and provides the so called mechanical scanning of the columns of the dots that the image is comprised of. Why 102? I decided to base the design on the smallest and cheapest of the Atmel AVR microcontrollers – ATtiny13 and the amount of program storage is already pushing the memory limits of the little chip. After some experimentation I have settled on the pattern that involves 17 columns of 6 dots (LED flashes) – hence 17×6=102 individual flashes that have to be completed in 50ms. This is the very basic calculation which you start any POV display project with: how many events you can “jam” into the time window of one smallest human timeframe – 50ms.
Unlike many (most?) POV displays you’ve come across, our little POV display has another limitation because ATtiny13 has only 5 input/output lines (well, OK, it does have 6 but the last one is used as Reset and if we take is as an I/O, we won’t be able to re-write the program without a high-voltage programmer). Since we cannot have one LED per one output and light all 6 LEDs that make one column at once, we need to scan LEDs over time, i.e. light them one by one but still so quickly that all 102 flashes fit within the mandatory 50ms timeframe. This is why timing becomes very critical in this project and it’s very important to use the brightest red LEDs you can find – certainly go for 5000mcd+ brightness – because each LED only has 1/102 of the frame time to shine and still register in your brain.
There’s also another feature of this project that made it particularly interesting to me. Again, unlike most POV displays out there, mechanical scanning for this Valentine’s POV display is severely limited by our limbs’ construction ( humans are just NOT very well suited to interface with electronics, I tell ya!). Since we don’t have joints that rotate 360º (wouldn’t that be something!), all we can muster is a reciprocal movement back and forth, However, the message we are trying to write should be read only left-to-right. In other words, the message should be only shown on the movement of your (or your Valentine’s) hand from left to right and not on the way back. I guess, “U HEART I” is also kinda sweet but not grammatically correct.
By the way, I keep spelling HEART as a word but I’m sure you understand I actually mean the symbol in the shape of a stylized heart which is possible to show on the screen of your browser but Instructables’ editor is preventing me from using HTML characters, such as ❤ which is what I actually need to show the heart symbol. I am telling you this because, unlike the word “HEART” the actual heart symbol is symmetrical on its vertical axis and it would look OK as a mirror image, and so would the letters “I” and “U”. However, I was thinking of using this display for other messages, too, such as “I HEART NYC” for example and in that case it would have been even more important to eliminate mirroring of the message on the way back.
Ball tilt switch to the rescue! This cheap and simple little device has a dual use in this project. We use it to wake the ATtiny13 from the battery-saving sleep and we also position it just the right way so that it closes contact every time your hand starts decelerating from the way back (right-to-left) and into accelerating on the way forward (left-to-right)
For more detail: Spell out affection for your Valentine with chocolates, LEDs, Attiny13 and Arduino IDE