1. Hardware Solution
This design uses the STC89C52 microcontroller as the system control chip, and transmits the data processed by the microcontroller to the mobile phone APP through the Bluetooth module, so that the detection effect can be seen more clearly. The working current of the whole machine is only 1-1.5mA, achieving ultra-low power consumption. The collected steps, distance, calories and exercise status are displayed on the mobile phone APP.
It is mainly composed of 51 single-chip computer minimum system + ADXL345 acceleration sensor + LCD1602 liquid crystal circuit + Bluetooth module circuit + breathing light circuit + power supply circuit; as shown in the figure:
2. Design function
(1) The number of steps is detected by ADXL345, and then the number of steps, distance, calories and exercise status are transmitted to the mobile phone in real time through the Bluetooth module.
(2) There is a dynamic breathing light to indicate walking conditions.
(3) LCD1602 displays the number of steps, distance, calories and exercise status in real time. The exercise status is divided into stand, lie, walk and run.
(4) The mobile phone can display the current walking status, number of steps, mileage and energy consumed in real time via Bluetooth.
3. Design Schematic
(1) The schematic diagram is mainly designed using AD software, as shown in the figure:
(2) The PCB diagram is as follows:
4. Software Design
(1) Program flow chart
(2) Main program source code
void main (void)
{
Init_Timer0(); //Timer 0 initialization
UART_Init();
LCD_Init(); //Initialize LCD
DelayMs(20); //Delay helps to stabilize
LCD_Clear();
Init_ADXL345(); //Clear screen
if(Single_Read_ADXL345(0X00)==0xe5) //The read data is 0XE5, indicating correctness
{
DelayMs(5);
}
else
{
DelayMs(3);
}
led=1;
while (1) //main loop
{
if(ReadAdxl345==1) //Read adxl345 data regularly
{
BuShuCheck(); //Detect steps
sprintf(dis1,"B:%04d J:%4.1fm ",BuShu/2,JuLi); //Print
LCD_Write_String(0,0,dis1);//display
sprintf(dis2,"%7.2fcal",KaLuLi); //print
LCD_Write_String(0,1,dis2);//display
if(statFlag == 0) //Standing state
{LCD_Write_String(11,1,"Stand");}
else if(statFlag == 1) lying down
{LCD_Write_String(11,1,"Lie ");}
else if(statFlag == 2)//Running status
{LCD_Write_String(11,1,"Run");}
else if(statFlag == 3)//Walking status
{LCD_Write_String(11,1,"Walk");}
}
if(ReportFlag==1) //2s
{
ReportFlag=0;
sprintf(dis0,"*B:%04d",BuShu/2); //Report the number of steps
SendStr(dis0,7);
sprintf(dis0,"J:%04.1fm",JuLi); //Report distance
SendStr(dis0,7);
sprintf(dis0,"K:%07.2fcal",KaLuLi); //Report calories
SendStr(dis0,12);
if(statFlag == 0) //Standing state
{SendStr("Stand#",6);}
else if(statFlag == 1) lying down
{SendStr("Lie #",6);}
else if(statFlag == 2)//Running status
{SendStr("Run #",6);}
else if(statFlag == 3)//Walking status
{SendStr("Walk #",6);}
SendStr("rn",2);
}
}
}
Previous article:Design of WiFi temperature and humidity intelligent switch based on 51 single chip microcomputer
Next article:Design of GPS Positioning System Based on 51 Single Chip Microcomputer
- Popular Resources
- Popular amplifiers
- Naxin Micro and Xinxian jointly launched the NS800RT series of real-time control MCUs
- How to learn embedded systems based on ARM platform
- Summary of jffs2_scan_eraseblock issues
- Application of SPCOMM Control in Serial Communication of Delphi7.0
- Using TComm component to realize serial communication in Delphi environment
- Bar chart code for embedded development practices
- Embedded Development Learning (10)
- Embedded Development Learning (8)
- Embedded Development Learning (6)
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- Intel promotes AI with multi-dimensional efforts in technology, application, and ecology
- ChinaJoy Qualcomm Snapdragon Theme Pavilion takes you to experience the new changes in digital entertainment in the 5G era
- Infineon's latest generation IGBT technology platform enables precise control of speed and position
- Two test methods for LED lighting life
- Don't Let Lightning Induced Surges Scare You
- Application of brushless motor controller ML4425/4426
- Easy identification of LED power supply quality
- World's first integrated photovoltaic solar system completed in Israel
- Sliding window mean filter for avr microcontroller AD conversion
- What does call mean in the detailed explanation of ABB robot programming instructions?
- Europe's three largest chip giants re-examine their supply chains
- Breaking through the intelligent competition, Changan Automobile opens the "God's perspective"
- The world's first fully digital chassis, looking forward to the debut of the U7 PHEV and EV versions
- Design of automotive LIN communication simulator based on Renesas MCU
- When will solid-state batteries become popular?
- Adding solid-state batteries, CATL wants to continue to be the "King of Ning"
- The agency predicts that my country's public electric vehicle charging piles will reach 3.6 million this year, accounting for nearly 70% of the world
- U.S. senators urge NHTSA to issue new vehicle safety rules
- Giants step up investment, accelerating the application of solid-state batteries
- Guangzhou Auto Show: End-to-end competition accelerates, autonomous driving fully impacts luxury...
- Dual-band transceiver for 1.3GHz and 2.3GHz bands
- CB5654 Intelligent Voice Development Board (Xuantie 803) Review - 1. Build the Compilation Environment
- When will everyone return to Beijing to work after the New Year?
- Principle and practice of PWM technology for power electronic converters
- CD4066 Analog Switch
- Knowledge about lithium batteries
- MSP430 Main Memory Bootloader Introduction
- END Driver Writing Overview
- I want to use POE to power some gadgets, but I don’t know what power chip to use?
- How to avoid float or double precision errors?