
What to hide, we all love to receive and make various gifts and souvenirs. Especially well succeed unexpected presents and signs of attention provided without a reason. And all the more memorable are those made by hand.
This story will be about one of these gifts shown in the photo on the right.
The idea behind this idea is to make an image of a dancing pair of LEDs and resistors. But the idea would not be so interesting if the dancing men did not blink Morse code given phrases, if this blink would not be visible only through the camera of your mobile phone and not with a simple, naked eye, and if they did not symbolically wink at only holding tightly to arms.
')
Scheme, firmware code and comments under habrakat.
Let's start with the scheme:
Where K
1 is just a “virtual” key, the role of which is played by the hands — either they hold each other and the circuit is not open, or not. VD
1 and VD
2 are the most common IR LEDs, the ones that work in the consoles from your TVs. It is their glow that is not visible to the naked eye, but is very clearly visible through the camera of your mobile phone. Ordinary, say, red LEDs can be used instead, but this very effect of surprise and surprise during the presentation of these wonderful dancing men is lost.
On the circuit, although there are many resistors, but only three are critical for operation: R
1 = R
2 = 51 Ohms and R
3 = 10 kΩ. All others must be zero resistance or short-circuited. Capacity C
1 = 0.1 µF.
As for the transmission of messages in
Morse code , then without a microcontroller (Atmel
ATtiny13A ) can not do. That he will issue a series of "points" and "dash" on our LEDs. For this purpose, messages are stored in the program in the form of prepared arrays of numbers, where each bit of the number indicates whether the specified LED will be lit or not. To prepare these arrays, a simple console program was written that accepts a string from a Morse-encoded message in the form of dots and dashes and returns an array of numbers back to the console.
Power of the whole circuit is carried out from all of us familiar, and, perhaps, even our favorite
CR2032 battery.
The microcontroller firmware itself is pretty simple and trivial. I will give only the key function of the timer interrupt handler:
ISR(TIM0_COMPA_vect) { static uint8_t tmp; if (!(PINB & _BV(HANDS)))
Where p1 and p2 are the counters of the currently displayed bit in our messages.
Download the full code of the firmware, a program for converting messages, a diagram and everything that was needed to develop this project here .
And now a few photos of the finished souvenir:
Some of them even see the hand of a happy owner :)
And also, as “guards” you can use these pretty girls from K155LA3 microcircuits :)
Well, or just marvel at the courage of climbers climbing with all their might on the sistemnik:
I apologize for the quality of some photos and thank you for your attention!