DIY

Signaling device when moving away from the object

Device signaling when moving away from the object The background of the manufacture of this device is as follows.
The author of this homemade product dines in a restaurant every day. At the same time, he has a working portfolio with him. Once he forgot this briefcase in a restaurant. Fortunately, when he returned, he found it on the spot, but thought about how to make sure that such situations could be avoided in the future.
This project was born as a result.
Tools and materials: -Arduino Nano – 2 pcs; -LEDs – 2 pcs; -Breadboard – 2 pcs; -Resistors 220 Ohm – 2 pcs; -Antenna – 2 pcs; -Piezo speaker – 1 pc; -Receiver 433 MHz – 1 pcs; -Transmitter 433 MHz – 1 pc;
Step one: the principle of operation
This device consists of a receiver and a transmitter based on Arduino microcontrollers. If the signal from the transmitter is lost, the receiver notifies the user (about 100 meters, ideally). You can also configure the device to alert when a distance from 3 to 100 meters.
For the device, the master used Arduino Nano boards. One Nano board is configured as a transmitter and the other as a receiver. The transmitter does nothing except send out the repeating character signal “0”. The second Arduino Nano is configured to check the received signal and flash the LED as confirmation. If no signal is received after 3 connection attempts, the receiver will play a repeating tone through the small speaker until a signal is received from the transmitter again or until the receiver is turned off.
The transmitter/receiver operates at 433 MHz. Transmission distance: 3 meters (without antenna) to 100 meters (maximum) with antenna. There is a designated hole in the transmitter and receiver module for mounting the antenna.
Signaling device when moving away from the object Step two : Assembling the transmitter and loading the transmitter code
The transmitter is assembled according to the diagram below.
Device signaling when removing from the object The code can be downloaded below.

 #include & lt; VirtualWire.h & gt; const int ledPin = 9; char * data; void setup () & # 123; pinMode (ledPin, OUTPUT); vw_set_ptt_inverted (true); vw_set_tx_pin (12); vw_setup (4000); } void loop () & # 123; data = & # 34; 0 & # 34 ;; vw_send ((uint8_t *) data, strlen (data)); vw_wait_tx (); digitalWrite (ledPin, HIGH); delay (25); digitalWrite (ledPin, LOW); delay (500); }  

Step three: assembling the receiver and loading the receiver code
The 433 MHz receiver is assembled according to the diagram below.
Signaling device when moving away from the object Code for downloads for Arduino can be downloaded below. This code notifies when the device is not receiving a signal.

 #include & lt; VirtualWire.h & gt; const int buzzer = 8; //buzzer to arduino pin 8 void setup () & # 123; vw_set_ptt_inverted (true); //Required for DR3100 vw_set_rx_pin (12); vw_setup (4000); //Bits per sec Serial.begin (9600); pinMode (9, OUTPUT); vw_rx_start (); //Start the receiver PLL running} void loop () & # 123; int i = 0; int chk1 = 0; int chk4 = 0; uint8_t buf & # 91; VW_MAX_MESSAGE_LEN & # 93 ;; uint8_t buflen = VW_MAX_MESSAGE_LEN; Serial.println (); if (vw_get_message (buf, & amp; buflen)) //Non-blocking & # 123; for (i; i & lt; 2; i ++) ///loop to check for a received signal & # 123; if (buf & # 91; 0 & # 93; == & # 39; 0 & # 39;) int chk1 = 1; else int chk1 = 0; chk4 = chk4 + chk1; } & # 123; delay (1000); & # 123; if (chk4 & gt; = 1); //if at least 1 signal was received, flash LED digitalWrite (9, HIGH); delay (25); digitalWrite (9, LOW); }}} else //if no signal is received, produce audio tone & # 123; tone (buzzer, 1000); //Send 1KHz sound signal ... delay (1000); //... for 1 sec noTone (buzzer); //Stop sound ... delay (1000); //... for 1sec}}  

Or you can download the code that notifies when you are in the signal range.

 #include & lt; VirtualWire.h & gt; const int buzzer = 8; //buzzer to arduino pin 8 void setup () & # 123; vw_set_ptt_inverted (true); //Required for DR3100 vw_set_rx_pin (12); vw_setup (4000); //Bits per sec Serial.begin (9600); pinMode (9, OUTPUT); vw_rx_start (); //Start the receiver PLL running} void loop () & # 123; int i = 0; int chk1 = 0; int chk4 = 0; uint8_t buf & # 91; VW_MAX_MESSAGE_LEN & # 93 ;; uint8_t buflen = VW_MAX_MESSAGE_LEN; Serial.println (); if (vw_get_message (buf, & amp; buflen)) //Non-blocking & # 123; for (i; i & lt; 2; i ++) ///loop to check for a received signal & # 123; if (buf & # 91; 0 & # 93; == & # 39; 0 & # 39;) int chk1 = 1; else int chk1 = 0; chk4 = chk4 + chk1; if (chk4 & lt; 1); //check to see if any signal is received, play audio tone & # 123; tone (buzzer, 1000); //Send 1KHz sound signal ... delay (1000); //... for 1 sec noTone (buzzer); //Stop sound ... delay (1000); //... for 1sec}}} else & # 123; delay (1000); digitalWrite (9, HIGH); delay (25); digitalWrite (9, LOW); }}  

After assembly on the breadboard, the wizard conducts testing. The first video is testing a device with a code signaling a loss of signal.

In the second video, the device sends a signal within the range of the transmitter.
Then you need to assemble everything on the circuit board and pack it into the case. Naturally, you need to add food.

Source:

usamodelkina.ru

Show More

Related Articles

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top button