Single-chip computer-based navigation for the blind, intelligent crutches, anti-lost, anti-fall, and short-message positioning for the elderly

Function Introduction

  • Using STM32 microcontroller as the main control system;
  • OLED LCD current real-time distance, safety distance, current latitude and longitude information;
  • Ultrasonic detection is less than the set safety distance, the buzzer alarm prompts: below the safety distance!
  • Ultrasonic detection of the current obstacle distance, GPS positioning;
  • The photosensitive sensor detects the strength of the current environment, and the LED lighting indicator is turned on when the light is dark;
  • ADXL345 three-axis sensor detects whether the elderly has fallen;
  • Press the button to set the minimum safe distance setting, the number accepted by SMS;
  • In case of emergency, you can directly dial and hang up the phone;
  • ADXL345 tilt exceeds the time to detect the fall of the elderly, make a call, send a text message and the current latitude and longitude, and display the corresponding prompt on the LCD screen
  • The whole circuit is powered by 5v;

Circuit Diagram

PCB

source code

#include <reg52.h>
#include <intrins.h>
#include <stdio.h>//printf serial output header file

#define uchar unsigned char
#define ushort unsigned int
#define uint unsigned long

#include "lcd1602.h"
#include "uart_trx.h"
#include "eeprom52.h"

#define RATIO 800 //Coefficient, it is recommended to choose 800-1000

sbit key1 = P1^0;//add key
sbit key2 = P1^1;//minus key

sbit beep = P2^0;//buzzer
sbit Fan = P1^3;//fan

unsigned char pmBuf[7] = 0;//data receiving array
uint PM25_Value = 0; //PM = ((pmBuf[1]<<8) + pmBuf[2])/1024*8*ratio
uint PM25_ValueMax = 200; //upper limit initial value

void EEPROM_WRITE()//EEPROM write
{
SectorErase(0x2000);//Erase sector
byte_write(0x2001, (PM25_ValueMax>>8) & amp;0xFF);//store high 8 bits
byte_write(0x2002, (PM25_ValueMax>>0) & amp;0xFF);//store the lower 8 bits
byte_write(0x2009, 111);//store check value
}

void EEPROM_READ()//EEPROM read
{
if(byte_read(0x2009)!=111)//Start up to detect whether the MCU is used for the first time, if it is not the first time, store the data first, and then read, the data will not be garbled
{
EEPROM_WRITE();//storage
delay_ms(100);
}
PM25_ValueMax = byte_read(0x2001)<<8 | byte_read(0x2002);//read the upper limit value
}

void Get_PM(void)//Read the PM2.5 value, the specific meaning of the data frame, please refer to the chip manual
{
    char i = 0;
    char j = 0;
    char k = 0;

COM.RX_Cnt = 0;
    if(COM.B_RX_OK == 1)//Serial port data reception is complete
    {
        for(i = 0; i<8; i ++ )
        {
            if((RX_Buffer[i] == 0xAA) & amp; & amp;(RX_Buffer[i + 6]==0xFF))//judging whether the received data is correct
            {
                goto find2;
            }
        }
        goto end2;
find2:
        for(j = 0; j<7; j ++ )
        {
            pmBuf[j] = RX_Buffer[i + j];//Data acquisition
        }

        PM25_Value = (unsigned int)((pmBuf[1]*256) + pmBuf[2])*5/2048.0*RATIO;//calculate PM2.5 value
        COM.B_RX_OK = 0;
    }
end2:
    return;
}



void main(void)
{
    unsigned int test;

EEPROM_READ();//Start up and read the stored value
    LCD_init();//1602 initialization
    Uart_Init(2400);//Serial port initialization baud rate 2400
  
    LCD_write_string(0,0,"Pm2.5: ug/m3");
    LCD_write_string(0,1,"PmMax: ug/m3");
// display upper limit
LCD_write_char(7, 1, PM25_ValueMax % 1000 / 100 + 0x30);
LCD_write_char(8, 1, PM25_ValueMax % 100 / 10 + 0x30);
LCD_write_char(9, 1, PM25_ValueMax % 10 + 0x30);
    while(1)
    {
if (test + + > 250)//Read once in about 250ms
{
test = 0;

Get_PM();//Get PM2.5
if(PM25_Value > 999)//limit value, maximum 999
PM25_Value = 999;
//Display PM2.5
LCD_write_char(7, 0, PM25_Value % 1000 / 100 + 0x30);
LCD_write_char(8, 0, PM25_Value % 100 / 10 + 0x30);
LCD_write_char(9, 0, PM25_Value % 10 + 0x30);
\t\t\t\t\t
if(PM25_Value >= PM25_ValueMax)//Exceed the upper limit, buzzer alarm
{
beep = ~beep;
Fan = 0;
delay_ms(100);
}
else
{
beep = 1;
Fan = 1;
}
}
if(key1 == 0)//Press the key
{
delay_ms(10);//Debounce
if(key1 == 0)
{
beep = 0;
delay_ms(100);
beep = 1;
while(key1 == 0);
if(PM25_ValueMax<999)PM25_ValueMax + =10;//The upper limit is up to 999, add 10 each time
\t\t\t\t\t\t  //show
LCD_write_char(7, 1, PM25_ValueMax % 1000 / 100 + 0x30);
LCD_write_char(8, 1, PM25_ValueMax % 100 / 10 + 0x30);
LCD_write_char(9, 1, PM25_ValueMax % 10 + 0x30);
EEPROM_WRITE();//Save
}
}
if(key2 == 0)//minus key pressed
{
delay_ms(10);
if(key2 == 0)
{
beep = 0;
delay_ms(100);
beep = 1;
while(key2 == 0);
if(PM25_ValueMax>=10)PM25_ValueMax-=10;//The upper limit is at least 0, every time minus 10
\t\t\t\t\t\t  //show
LCD_write_char(7, 1, PM25_ValueMax % 1000 / 100 + 0x30);
LCD_write_char(8, 1, PM25_ValueMax % 100 / 10 + 0x30);
LCD_write_char(9, 1, PM25_ValueMax % 10 + 0x30);
EEPROM_WRITE();//save
}
}
delay_ms(1);
    }
}


Component list

Single-chip computer-based navigation for the blind, smart crutches for the elderly, anti-lost, anti-fall, and short message positioning
Name Model Quantity
MCU STC89C52 1
IC seat DIP40 1
Universal board 9*15cm 1
Crystal oscillator 11.0592M 1
Electrolytic capacitor 10uF 1
Electrolytic capacitor 1000uf 1
Ceramic capacitor 22pF 2
Resistance 10K 3
Resistance 1K 4
resistor 2K 1
LED red 5MM 1
LED Green 5MM 1
Buzzer Active 1
Transistor S9012 1
Keys 5
Display LCD1602 1
Pin header 16P 1
Row mother 16P 1
Human infrared Module HC-SR501 1
female row 3P 1
Temperature Sensor DS18B20 1
Smoke Sensor MQ-2 1
Analog to Digital Converter ADC0832 1
IC seat 8P 1
GSM module SIM800c 1
power socket 5MM 1
Power cord 5V2A 1
Self-locking switch 1
relay 1
Small water pump 1
wire Several
Solder wire Several

References

references
[1] Wang Debao. Application research of GPS in urban control network [D]. Shandong: Shandong University of Science and Technology, 2005.
[2] He Limin. Embedded systems from the perspective of modern computers (4) 40-year development history of embedded systems [J]. Single-chip Microcomputer and Embedded System Applications, 2016,16(04):77-79.
[3] Kang Guixia, Liu Da. FPGA Application Technology Tutorial [M]. Beijing: People’s Posts and Telecommunications Press: 201306.229.
[4] Piao Dehui, Yi Yinggang. Introduction to the MCU circuit of the LCD driver board (Part 1) [J]. Home Appliance Maintenance Technology, 2012(11): 53.
[5] Duan Tingkui. Exploration on the Practical Application of Global Satellite Positioning System (GNSS) in Engineering Surveying [J]. Science and Technology Innovation and Application, 2021(05):182-184.
[6] Song Ge, Huang Hesong. Encyclopedia of 51 MCU Application Development Paradigms [M]. Beijing: People’s Posts and Telecommunications Press: National Information Technology Talent Training Project Series, 201206.558.
[7] Luo Xiaoqing. The Principle and Application Tutorial of SCM [M]. Beijing: People’s Posts and Telecommunications Press, 201409.180.
[8] Shen Qingyang. Practice and application of single-chip microcomputer [M]. Beijing: Tsinghua University Press, 2002.
[9] Du Shenhui. Design and realization of temperature and humidity detection device [M]. Beijing: Mechanical Industry Press, 2004.
[10] Lin Jia. LCD1602 Program Design Based on 89S52 [J]. Computer Knowledge and Technology, 2012(26): 6376-6378.
[11] Liu Guangwei. Design and implementation of temperature, room temperature and humidity monitoring system based on single-chip microcomputer [D]. Qinhuangdao City: Yanshan University, 2012.
[12] Chu Fuqiang, Dong Xueren. Research on Network Access Technology of SCM [J]. Instrumentation Users, 2006(05):4-5.
[13] Chen Yingjun. Design of Temperature and Humidity Monitoring and Alarm System Based on SCM [J]. Journal of Guangdong Institute of Petrochemical Technology, 2013(04):42-46.
[14] Liao Liyuan. Design of measurement system based on strain gauge torque sensor [D]. Shanghai: Donghua University, 2013.
[15] Liu Jiuqing. Greenhouse Environmental Engineering Technology [M]. Jilin: Northeast Forestry University Press, 2002.
[16] Wang Mingxi, Cui Shimao. Preliminary study on the performance of sunlight, temperature and humidity in greenhouses [J]. Agricultural Engineering Technology (Greenhouse Horticulture), 2008(05):19-21.
[17] Zhang Yinghui. Design of keyboard interface for single-chip microcomputer [J]. Information Technology, 2004(07): 68-69 + 91.
[18] Zhang Youde, Zhao Zhiying. Application and experiment of the principle of single-chip microcomputer [M]. Shanghai: Fudan University Press, 2003.
[19] Zhao Zhiyun. Greenhouse Intelligent Monitoring System [D]. Jiangsu: Jiangsu University of Science and Technology, 2010.
[20] Zhang Hongwei. Design and Implementation of Intelligent Environmental Monitoring System Based on STM32 [J]. Journal of Daqing Normal University, 2020(05):32-35.
[21] Wang Shiwei, Yang Yue. Design of multi-model steering gear debugger based on STM32 [J]. Journal of Jiujiang University (Natural Science Edition), 2020,35(02):33-36.
[22] Pengcheng Zhao, Meijun Ni, Chao Chen, Chenxi Wang, Pingping Yang, Xiahui Wang, Chunyan Li, Yixi Xie, Junjie Fei. A Novel Self-protection Hydroquinone Electrochemical Sensor Based on Thermo-sensitive Triblock Polymer PS-PNIPAm-PS[ J].
[23] Jian Wang, Jing Chen, Xiaofu Xiong, Xiaofeng Lu, ZhengLiao, Xiaobo Chen. Temperature safety analysis and backup protection scheme improvement for overhead transmission line in poweroscillation condition [T]. Electric Power Systems Research, 2019, 166.
[24]Fuji Electric Co.Ltd.;Patent Issued for Seiconductor Device And Method Of Outputting Temperature Alarm (USPTO10,164,626)[J].Electronics Newsweekly,2019.
[25] VERSID, INC; Patent Issued for Refrigeration Unit Temperature Alarm Using Thermal Properties of Food to Eliminate False Alarms (USPTO 9752810) [J]. Computers, Networks & amp; Communications, 2017.
[26]Fuji Electric Co.Ltd; Patent Application Titled “Semiconductor Device and Method of Outputting Teperature Alarm” Published Online (USPTO 20170077919)[J]. Technology & amp; BusinessJournal, 2017.
[27]su Yuanping, Xu Lihong, Goodman Erik D.Multi-layer hierarchical optimization of greenhouse climate setpoints for energy conservation and improvement of crop yield[J].Biosystems
[28] Huang Songmao. Design and Implementation of STM32-Based Home Environment Monitoring System [D]. Lanzhou, Gansu. Northwest Normal University, 2018.: 23-30.
[29] Li Dalin. Design of intelligent vehicle interior temperature monitoring system [J]. Shandong Industrial Technology, 2014 (12): 80-81.
[30] Guo Wen, Wang Haitao. Development and Application of Intelligent Infusion System. Medical and Health Equipment, 2012