📜 ⬆️ ⬇️

Do-it-yourself visitor

It's hard enough to find someone who would not watch the wonderful Soviet film “Kin-Dza-Dza!”
I think that many had a desire to assemble a visitor - a device that allows us to distinguish chatlan from patsaks.



Now I will tell you how to assemble this wonderful device. Comic, of course :)

There is nothing difficult in blinking LEDs and peep piezo-speakers. The most interesting and difficult in this problem is always to get the same result for each person. Many ideas were passed over in my head, but in the end it was decided that people should somehow be tagged. Of course, first and foremost, you need to label yourself so that you can proudly be a chatlanin, before whom you must do “Ku!”
')
image

However, such a label should be invisible to others. The decision came quickly enough. I took the remote from the TV and made sure that it punches perfectly through the T-shirt. So it was decided to use a TSOP17xx-type remote receiver in the visitor, and hide a small board with an infrared LED under the T-shirt, which should blink accordingly, similar to the way the LEDs in the remote controls flash.

Make a "label"


I quickly sketched a fee for this label:



In the center of the microcontroller ATmega8A. In fact, this is very unnecessary, and some ATtiny would suffice here, but nothing was simpler in my presence. Yes, it would be possible to do without a microcontroller at all, but it is much easier to adjust the timings. On top of the two holes under the infrared LED, which is turned on through the transistor, and two more holes are scheduled so that you can thread and hang the device around your neck.

The firmware is nowhere easier:
int main (void) { //   C3   DDRC |= (1<<3); while (1) { //   50   ,  -    _delay_ms(50); int t; //   100  for (t = 0; t < 100; t++) { //   PORTC |= (1<<3); //   11  _delay_us(11); //   PORTC &= ~(1<<3); //   11  _delay_us(11); } } } 


The blinking of the LED will occur continuously while the power is on. I use a pause of 11 microseconds, which gives a frequency of about 45-46 kilohertz. It is worth experimenting with this value, it depends on the type of remote control and greatly influences how well the signal will be caught through a T-shirt.

Alas, for such a bright (if you can say so about invisible IR light) glow, a sufficiently large current is required, so you have to hide the batteries in your pocket. Two AA batteries are enough, but for complete reliability it is better to take three or even four.

Here's what happened:




If you take pictures of yourself in the dark and without a flash, you can see how it shines through a T-shirt:



The human eye is, of course, inaccessible. By the way, it turned out to be much more convenient to fasten the label on an ordinary plaster.

We do the visitor himself


So, in the visitor we should have:


The fee turned out this:



The algorithm works as follows:
  1. The user presses a button that simply powers up.
  2. For half a second we are waiting for the signal from the remote control
  3. If the signal was, light the orange LED, otherwise the green
  4. In an infinite loop, we issue a corresponding squeak until the power stops.


Respectively code:
 //   #define LED_GREEN_ON PORTC |= (1<<2) #define LED_GREEN_OFF PORTC &= ~(1<<2) #define LED_ORANGE_ON PORTC |= (1<<1) #define LED_ORANGE_OFF PORTC &= ~(1<<1) #define SOUND_0 PORTD &= ~(1<<5) #define SOUND_1 PORTD |= (1<<5) #define SIGNAL (!(PINC&1)) int main (void) { //   - DDRC &= ~1; //  PORTC |= 1; //    LED_GREEN_OFF; LED_ORANGE_OFF; //    DDRC |= (1<<1) | (1<<2); //    DDRD |= (1<<5); //     ,     _delay_ms(50); int t; int chatlanin = 0; // 500     for (t = 0; t < 500; t++) { //  -     -,   ,   ! if (SIGNAL) chatlanin = 1; _delay_ms(1); } //    if (chatlanin) { LED_ORANGE_ON; } else { LED_GREEN_ON; } //    while (1) { //    if (chatlanin) { SOUND_1; _delay_ms(1); SOUND_0; _delay_ms(1); } //    else { SOUND_1; _delay_ms(7); SOUND_0; _delay_ms(7); } } } 


The fee of the visitor with the battery turned out to be this:


Sorry for the dirt on the board, my ultrasonic bath broke down.

Then I quickly sketched a 3D model of the case to print it on a 3D printer. At that moment I didn’t really try, so it turned out to be quite collective:



Now you can play friends! Of course, provided that they do not read Habrahabr. The reaction is usually very positive :) Video with a demonstration of the device in operation:

Source: https://habr.com/ru/post/229459/


All Articles