走马观花

Motion data detection module

 
Overview

1. Introduction to project functions


         We are in an era where the Internet of Things and digitalization are booming, but there are still many scenarios in our lives that can be empowered and improved through digitalization. In modern life, health is the first priority, and physical health cannot be separated from exercise. In view of the lack of data analysis links in existing gym fitness scenes, I hope to design a universal detection device for motion data detection, and integrate fitness data into It can be transmitted to the mobile phone for viewing in real time, or the data can be analyzed on the computer, and the analysis results can be fed back to the formulation of exercise plans and other aspects.

   In order to realize the functional design of sports data detection equipment, I analyzed the movement patterns of most of the existing gym equipment and found their commonalities. The motion space of the gym is fixed, so its motion can be described as periodic reciprocating motion, and single-cycle motion can be described in terms of linear displacement and angular displacement. Therefore, the number of exercises, frequency, etc. can be calculated through the ranging sensor and angle sensor, and then combined with the model of the fitness equipment (obtaining the amount of exercise in a single cycle), we can estimate the overall amount of exercise, the number of exercises, and the frequency of exercise in a fitness session. Wait for data. Data can be transmitted to the mobile phone APP through the Bluetooth module , or transmitted to the network through other methods.

   The device is designed as a battery device. When Bluetooth is not connected, the device sleeps and when Bluetooth is connected, the device wakes up. Comes with a charging module, with LED indication when charging .

2. Introduction to motion detection equipment hardware


1.      Hardware functional requirements analysis

What we want to make is a device for detecting periodic motion, and periodicity is judged by angle and distance, so an angle sensor and a distance sensor are needed. I chose the commonly used MPU6050 angle sensor and Vite Smart VL53L0 infrared ranging. Sensor; secondly, the data processing and control core. I chose the very versatile Hangshun HK32F103C8T6 chip as the main control; then there is the data communication part, which can be used to communicate with mobile phones or access the network in other ways, using the Huicheng HC08 Bluetooth module , at the same time, the ZIGBEE communication module interface is reserved , which can be welded to the ZIGBEE module of Zeyao A40 ; finally, there is the power supply and power consumption control part. The power supply uses a 1s lithium battery, the module integrates a charging circuit, and is mainly reduced to 3.3V through a voltage stabilizing chip. Controlled power supply, each functional module is equipped with a power control switch, which can power off unused functions through pin signals.

2.      Detailed explanation of hardware function blocks

2.1  HK32F103C8T6 chip system circuit

figure 1

As shown in Figure 1 , in addition to the most basic crystal oscillator circuit, reset circuit and download circuit, the main control circuit also adds functional circuits for power detection and power-down storage. The crystal oscillator circuit includes an 8M crystal oscillator and a 32.768K crystal oscillator. The load capacitance of the 32.768K crystal oscillator is 10pf . Capacitance smaller than this may cause the crystal oscillator to not oscillate. The power detection uses divided voltage detection and capacitor voltage stabilization filtering. The power-down storage uses AT24C02 memory chip, which uses EEPROM communication.

2.2 Sensor circuit

 

figure 2

As shown in Figure 2 , the VET smart VL53L0 infrared ranging sensor uses a 6Pin interface, which can receive data through the serial port or IIC . The motion detection module can be connected to two VIT smart ranging modules at the same time, and uses the MODBUS protocol to obtain the distance; The angle sensor uses the MPU6050 chip and uses IIC for data acquisition. The troublesome thing is that it is difficult to weld the MPU6050 chip. It is best to use a hot air gun to weld and then use a soldering iron to repair the welding.

2.3 Communication circuit   

image 3

As shown in Figure 3 , the communication part uses the HC08 Bluetooth module, which can be directly used for communication and debugging through its mobile phone APP ; the ZIGBEE module is a reserved communication method and can be used for multi-module network communication, and its software functions have not yet been developed.

2.4 Power supply and charging circuit

Figure 4

As shown in Figure 4 , the motion detection device uses a MicroUSB port for charging, and can perform serial port DEBUG at the same time . The charging chip uses an SGM4056 charging chip, and the step-down voltage stabilizing part uses a 662K chip, and reverse connection protection is added.

2.5 Power consumption control circuit

Figure 5

As shown in Figure 5 , the motion detection equipment uses DTC115EE transistors and SI2333MOS tubes to form a power control switch. The main control can control the power supply of each part according to the real-time operating environment, thereby reducing power consumption.

 

3. Introduction to motion detection equipment software


 

1.      Software code structure analysis

The software first uses STM32Cube for configuration generation, including pin configuration, clock configuration, download configuration, ADC configuration, timer configuration, serial port configuration, etc. (For details, please refer to the attached source code). Then use Keil5 to develop on the generated code , add folders and files, the final code structure is shown in Figure 1 , the added folder contains " APP ", " UART ", " SYSTEM ", " EEPROM ", " MPU6050 " . The " APP " folder contains upper application layer functions, and contains a simple task system designed by myself, which is called in the main function; the " UART " folder contains the underlying function encapsulation of the serial port, which is called by the application layer function; The " SYSTEM " folder contains clock and sleep related functions; the " EEPROM " folder contains read and write functions related to power-off saving; the " MPU6050 " folder contains angle sensor related underlying functions. The main.c file contains a detailed description of the code structure, as shown in Figure 1 .

figure 1

2.      Detailed explanation of software function files

2.1  " APP " folder file

The " APP " folder contains three C files, All_Data , All_Task , App_Function . The All_Data file contains parameter initialization functions, which can be used to store some basic information of the device and save parameters after power-off. The All_Task file contains the basic functions for building a task system, and its h file details its transplantation method. It is an original task system that can be promoted, as shown in Figure 2 . The App_Function file contains the top-level function of each task function.

figure 2

2.2UART ” folder file

The " UART " folder contains six C files. The Uart file contains the lowest-level reading and writing functions of the serial port and supports the printf printing function. The Uart_Comunicate_Profile file contains serial communication protocol related functions. The Uart1 , Uart2 , and Uart3 files each contain data receiving functions for three serial ports . The Modbus_Profile file defines related structures.

2.3SYSTEM ” folder file

The " SYSTEM " folder contains a C file, including clock and sleep-related functions, including key wake-up and scheduled wake-up functions. Scheduled wake-up is not used yet.

2.4EEPROM ” folder file

The " EEPROM " folder contains a C file containing the basic functions for software IIC communication.

2.5MPU6050 ” folder file

The " MPU6050 " folder contains four C files, which can convert the original data of mpu6050 into a three-dimensional angle. This part of the code is transplanted into a flight control code.

 

 

4. BOM list


Please enter content...

 

参考设计图片
×
 
 
Search Datasheet?

Supported by EEWorld Datasheet

Forum More
Update:2025-06-20 04:28:26
  • ESP8266EX——Knowledge Sharing on Clock and RF
  • 【Share your experience】+CC2541_SensorTag
  • Question: When I run the evc project, it prompts me that the sdk cannot run on the emulator device. What is the reason?
  • How to Identify Counterfeit and Refurbished ICs When Purchasing ICs
  • Virtual static random access memory in mobile and portable applications
  • 8962 Cannot debug

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
community

Robot
development
community

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号