MCU-based blind navigation smart crutches for the elderly to prevent loss and fall and send short message positioning

Function Introduction

  • Using STM32 microcontroller as the main control system;
  • OLED LCD current real-time distance, safe distance, current longitude and latitude information;
  • When the ultrasonic detection is less than the set safety distance, the buzzer alarm prompts: Lower than the safety distance!
  • Ultrasonic detection of current obstacle distance and GPS for positioning;
  • The photosensitive sensor detects the strength of the current environment and turns on the LED lighting indicator when the light is dark;
  • The ADXL345 three-axis sensor detects whether the elderly has fallen;
  • Set the minimum safe distance setting by pressing the button, and the number to accept SMS messages;
  • When encountering an emergency, you can make and hang up the phone directly;
  • The ADXL345 tilt exceeds the time description to detect the elderly person’s fall, make a call, send a text message and the current longitude and latitude, and display the corresponding prompt on the LCD screen
  • The entire circuit is powered by 5v;

Circuit Diagram

PCB

Source code

#include <reg52.h>
#include <intrins.h>
#include <stdio.h>//printf serial port 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; //Initial upper limit value

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

void EEPROM_READ()//EEPROM read
{
if(byte_read(0x2009)!=111)//Boot up and check whether the microcontroller is used for the first time. If it is not the first time, store the data first and then read it. 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. For the specific meaning of the data frame, please consult 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 completed
    {
        for(i = 0; i<8; i + + )
        {
            if((RX_Buffer[i] == 0xAA) & amp; & amp;(RX_Buffer[i + 6]==0xFF))//Determine 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();//Read the stored value at boot
    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 value
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 every 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)//If the upper limit is exceeded, the buzzer will alarm
{
beep = ~beep;
Fan = 0;
delay_ms(100);
}
else
{
beep = 1;
Fan = 1;
}
}
if(key1 == 0)//Add key press
{
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 maximum limit is 999, adding 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, subtracting 10 every 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
}
}
delay_ms(1);
    }
}


Components list

Smart crutches for blind navigation based on single-chip microcomputer to prevent loss and fall and send short message positioning for the elderly
Name Model Quantity
MCU STC89C52 1
IC holder DIP40 1
Universal board 9*15cm 1
Crystal oscillator 11.0592M 1
Electrolytic capacitor 10uF 1
Electrolytic capacitor 1000uf 1
Ceramic capacitor 22pF 2
Resistor 10K 3
Resistance 1K 4
Resistance 2K 1
LED red 5MM 1
LED green 5MM 1
Buzzer Active 1
Transistor S9012 1
Keys 5
Display screen LCD1602 1
Pin header 16P 1
Female row 16P 1
Human body infrared Module HC-SR501 1
Female header 3P 1
Temperature sensor DS18B20 1
Smoke sensor MQ-2 1
Analog-to-digital converter ADC0832 1
IC holder 8P 1
GSM module SIM800c 1
Power holder 5MM 1
Power cord 5V2A 1
Self-locking switch 1
Relay 1
Small water pump 1
Wire Several
Solder wire Several

This article only briefly introduces one type of physical object function and the key points in the design process for everyone’s reference and study. If you need to customize the physical object or if there are errors or do not understand, you can directly send a private message to the author, or add Huixin biyezhan007

References

references
[1] Wang Debao. Research on the application 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]. Microcontroller 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] Park Dehui, Yi Yingang. Introduction to LCD driver board MCU circuit (Part 1) [J]. Home Appliances Maintenance Technology, 2012(11):53.
[5] Duan Tingkui. Exploration on the practical application of Global Satellite Positioning System (GNSS) in engineering survey[J]. Science and Technology Innovation and Application, 2021(05):182-184.
[6] Song Ge, Huang Hesong. Collection of 51 microcontroller application development examples [M]. Beijing: People’s Posts and Telecommunications Press: National Information Technology Shortage Talents Training Project Series, 201206.558.
[7] Luo Xiaoqing. Microcontroller Principle and Application Tutorial[M]. Beijing: People’s Posts and Telecommunications Press, 201409.180.
[8] Shen Qingyang. Practice and Application of Microcontrollers[M]. Beijing: Tsinghua University Press, 2002.
[9] Du Shenhui. Design and implementation of temperature and humidity detection device [M]. Beijing: Machinery Industry Press, 2004.
[10] Lin Jia. LCD1602 programming based on 89S52 [J]. Computer Knowledge and Technology, 2012(26):6376-6378.
[11] Liu Guangwei. Design and implementation of greenhouse temperature and humidity monitoring system based on microcontroller [D]. Qinhuangdao: Yanshan University, 2012.
[12] Chu Fuqiang, Dong Xueren. Research on network access technology of single-chip microcomputer [J]. Instrument Users, 2006(05):4-5.
[13] Chen Yingjun. Design of temperature and humidity monitoring and alarm system based on microcontroller [J]. Journal of Guangdong Petrochemical Institute, 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 illumination, temperature and humidity performance of greenhouse-type solar greenhouses [J]. Agricultural Engineering Technology (Greenhouse Horticulture), 2008(05):19-21.
[17] Zhang Yinghui. Single-chip microcomputer keyboard interface design [J]. Information Technology, 2004(07):68-69 + 91.
[18] Zhang Youde, Zhao Zhiying. Application and experiment of single-chip microcomputer principles [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, PingpingYang, 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 SeiconductorDevice And Method Of Outputting Temperature Alarm (USPTO10,164,626)[J].Electronics Newsweekly,2019.
[25]VERSID,INC;Patent Issued for Refrigeration UnitTemperature Alarm Using Thermal Properties of Food to Eliminate FalseAlarms (USPTO 9752810)[J]. Computers, Networks & 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-layerhierarchical optimization of greenhouse climate setpoints for energyconservation and improvement of crop yield[J].Biosystems
[28] Huang Songmao. Design and implementation of home environment monitoring system based on STM32 [D]. Lanzhou, Gansu. Northwest Normal University, 2018.: 23-30.
[29] Li Dalin. Design of intelligent 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