Design of Bluetooth Pedometer Based on 51 Single Chip Microcomputer

Publisher:心若清泉Latest update time:2021-10-13 Source: eefocus Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

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);

}

}

}

Reference address:Design of Bluetooth Pedometer Based on 51 Single Chip Microcomputer

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

Latest Microcontroller Articles
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号