当前位置:网站首页>Design process sharing of wireless anti loss alarm based on single chip microcomputer
Design process sharing of wireless anti loss alarm based on single chip microcomputer
2022-07-28 12:12:00 【Salted fish brother】
Catalog
Function is introduced
This design uses 51 Single chip microcomputer combination NRF24L01 Wireless module Design , The anti loss device is divided into two parts , It is divided into slave and master , That is, transmitting module and receiving module , Put the slave on the object that is afraid of being lost , And the host is carried on the host , It can realize two functions :
- If the communication distance between two modules is exceeded, an alarm will be given , Inform the host in time , Prevent the slave from losing ;
- Within the communication range of the two modules , The slave doesn't know where it is , The host can initiate a search .
Schematic diagram

Schematic diagram of transmission module

Schematic diagram of receiving module
The difference between the schematic sending module and the receiving module is that the receiving module is less than one button , Everything else is the same , There are single-chip microcomputer minimum systems , Indicator circuit , Buzzer circuit , Wireless module , Serial port circuit . For more information, you can send a private message to the author or add wechat biyezhan007
PCB

Sending module

Receiving module
A physical picture

List of components
- MCU base *2
- Single chip microcomputer *2
- Crystal oscillator *2
- Ceramic capacitor *4
- resistance *4
- Electrolytic capacitor *2
- Four foot keys *3
- Power supply base *2
- LED The lamp *4
- DIP8 base *2
- NRF24L01 modular *2
- Buzzer *2
- triode *2
Source code
// The sender main.c
#include "nRF24L01.h" // Include header file
#include "def.h" // Include header file
void Delay_1(unsigned int s) // The time delay function
{
unsigned int i;
for(i=0; i<s; i++);
for(i=0; i<s; i++);
}
void delay(unsigned int z) // The time delay function
{
unsigned int x,y;
for(x=z;x>0;x--)
for(y=110;y>0;y--);
}
void main(void) // The main function
{
unsigned int flag; // Defining variables
unsigned char t =0,flag_1;
unsigned char TxBuf[20]={0}; // Data temporary storage array
unsigned char RxBuf[20]={0};
a: init_io() ; // initialization
flag_1=0;
flag=0; // The variable is cleared
TxBuf[0]='c'; // send data c
while(1) // Into the loop
{
//SetRX_Mode();
if(KEY1 ==0 ) // Press the button
{
TxBuf[0]=0;
TxBuf[1]=1; // send out 01
}
else // The key is not pressed
{
TxBuf[0]=1;
TxBuf[1]=1; // send out 11
}
nRF24L01_TxPacket(TxBuf); // Send buffer data
SetRX_Mode(); // Set to receive mode after sending data
if(nRF24L01_RxPacket(RxBuf)) // If there is data in the receive buffer
{
nRF24L01_TxPacket(TxBuf); // Send buffer data
flag=0;
flag_1=0; // The variable is cleared
}
else // There is no data in the receive buffer , That is, no data was received
{
flag++; // Timing variable plus
if(flag>=80) // Add to 80
flag_1=1; // The variable is set to 1
delay(5); // The timing resolution is 5ms, meter 80 The next is 80*5=400ms
}
if(flag_1) // If the variable is 1, timing 400ms, Turn on the alarm
for(t=0;t<20;t++) //for Cycle control light and buzzer alarm
{
LED2=~LED2;
LED1=~LED1; // Take the opposite , Achieve the flashing effect
delay(80); // Time delay 80ms
if(t==19) //t Add to 19 when
{
goto a; // go back to while Ahead a:
flag_1=0;
flag=0;
}
}
}
}
// The receiver main.c
#include "reg52.h"
#include "nRF24L01.h"
#include "def.h"
#include "delay.h" // Include header file
uchar count_1,count_2,count_3,count,miao,fen,fen_1,fen_2,fen_3,flag_1,flag_2,flag_3; // Define global variables
void Delay_1(unsigned int s) // The time delay function
{
unsigned int i;
for(i=0; i<s; i++);
for(i=0; i<s; i++);
}
void delay(unsigned int z) // The time delay function
{
unsigned int x,y;
for(x=z;x>0;x--)
for(y=110;y>0;y--);
}
void main(void) // The main function
{
unsigned int flag,f=1000; // Defining variables
unsigned char t ,flag_1;
unsigned char TxBuf[20]={0}; // Buffer data is cleared
unsigned char RxBuf[20]={0};
init_io() ; // initialization
while(1) // Into the loop
{
TxBuf[0] = 0;
TxBuf[1] = 1; // send data 01
SetRX_Mode(); // Set reception mode
if(nRF24L01_RxPacket(RxBuf)) // If there is data in the receive buffer
{
nRF24L01_TxPacket(TxBuf); // Send buffer data
if( RxBuf[0]==0&&RxBuf[1]==1) // If the received data is 01
{
for(t=0;t<10;t++) // The control light and vibration work flash
{
LED1=~LED1;
LED2=~LED2; // Take the opposite
delay(50); // Time delay
}
}
RxBuf[0]= 0;
RxBuf[1] = 0x00; // Receive buffer data reset
flag=0;
flag_1=0; // The variable is cleared
}
else // There is no data in the receive buffer
{
flag++; // Timing begins
if(flag==200) // Time to go 1 second (200*5ms)
{
flag_1=1; // The variable is set to 1
}
delay(5); //5ms Time delay
}
if(flag_1) // If the timeout does not receive data , Just turn on the alarm
for(t=0;t<10;t++) //for Cycle start alarm
{
LED2=~LED2; // Flashing alarm
delay(50); // Time delay
if(t==9) // Blink for one cycle
{
flag_1=0; // The variable is cleared , After returning, judge again whether there is a signal , If there is no signal , Keep calling the police
flag=0;
}
}
}
}
This paper introduces the key points in the design process , For your reference , If you have errors or don't understand, you can directly write to the author , Or add wechat biyezhan007.
Without the permission of the author , No plagiarism or reprint , If you have any questions about reprint, please contact the author of private letter or wechat .

边栏推荐
- 【补题日记】[2022牛客暑期多校2]H-Take the Elevator
- Service workers let the website dynamically load webp pictures
- boost官网搜索引擎项目详解
- Business visualization - make your flowchart'run'(4. Actual business scenario test)
- 2022.07.10 summer training personal qualifying (V)
- China business CDP white paper | love Analysis Report
- [pyGame practice] when the end of the world comes, how long can you live in a cruel survival game that really starts from scratch?
- [diary of supplementary questions] [2022 Hangdian summer school 2] k-dos card
- The principle and use of the wrap file of tolua
- 2022.07.12 summer training personal qualifying (VII)
猜你喜欢

Detailed explanation of boost official website search engine project

程序的存储态与运行态

Image filter from the perspective of convolution

Hcip (condition matching and OSPF packet related knowledge)

boost官网搜索引擎项目详解

移动端人脸风格化技术的应用
![Opencv notes sorting [Hough transform]](/img/80/8f5b0d7e1c5adc39cb5404dcdb1b11.png)
Opencv notes sorting [Hough transform]

使用百度飞桨 EasyDL 完成垃圾分类
![[pyGame practice] the super interesting bubble game is coming - may you be childlike and always happy and simple~](/img/3b/c06c140cd107b1158056e41b954e2e.png)
[pyGame practice] the super interesting bubble game is coming - may you be childlike and always happy and simple~

Will PFP be the future of digital collections?
随机推荐
15. User web layer services (III)
Hcip day 6 (OSPF related knowledge)
[leetcode] 8. binary search · binary search
玩转诗词-领略古诗文之美
[diary of supplementary questions] [2022 Hangdian summer school 2] k-dos card
【补题日记】[2022牛客暑期多校2]L-Link with Level Editor I
Rest style
Style conversion model style_ Transformer project instance pytorch implementation
Code simplification
Why does acid food hurt teeth + early periodontitis
Test platform (V) knowledge points supplement
Service Workers让网站动态加载Webp图片
How to make the characters in the photos laugh? HMS core video editing service one click smile function makes people smile more naturally
Consumer installation and configuration
String function (Part 2)
Globalthis is not defined solution
Ruiji takeout - day01
一些知识概念
Unity遇坑记之 ab包卸载失败
Detailed explanation of boost official website search engine project