Fitness Tracker With the S3 Mini Pro - QMI8658C 6D MEMS IMU Sensor

by Bits4Bots in Circuits > Microcontrollers

52 Views, 1 Favorites, 0 Comments

Fitness Tracker With the S3 Mini Pro - QMI8658C 6D MEMS IMU Sensor

FitnessTracker.png
Fitness Tracker.jpg
S3 Mini Pro Pinout.JPG

Another cool project using the S3 Mini Pro ESP32.

If you are interested in robotics and embedded software, you’re in for a treat! In this project, I will show you how to create a simple yet effective fitness tracker using the QMI8658C 6D MEMS IMU Sensor. An IMU, standing for Inertial Measurement Unit, is an electronic device that measures and reports acceleration, orientation, angular rates, and other gravitational forces. It is composed of 3 accelerometers, 3 gyroscopes, and depending on the heading requirement, 3 magnetometers. This project not only showcases the capabilities of the IMU sensor but also utilizes the S3 Mini Pro ESP32 built-in 0.85" TFT screen.

Supplies

S3 Mini top.JPG
S3 Mini Bottom.JPG

What You Need

The great news is that the only required component for this project is the S3 Mini Pro ESP32.

  1. https://www.tindie.com/products/bits4bots/s3-mini-pro-v100-lolin-wifi-bluetooth-iot/

This microcontroller is powerful enough to handle our needs while being compact and affordable. Its built-in TFT screen allows for easy display of data without the need for additional hardware.

Key Features of the QMI8658C

The QMI8658C sensor provides crucial data for our fitness tracker, including:

  1. Accelerometer readings: Measure movement in three dimensions.
  2. Gyroscope data: Track rotational movement, helping to determine the orientation and motion patterns.
  3. Temperature sensor: Keep track of your body temperature during workouts.

These features will enable us to track steps, distance traveled, and calories burned, making our fitness tracker a valuable tool for health-conscious individuals.

Set Up Your Environment

logo_arduino.png
Lolin Mini Pro Boards Select.JPG

Before diving into the code, make sure you have the following software installed:

  1. Arduino IDE: This will be your programming environment.
  2. Libraries: Install necessary libraries for the QMI8658C and TFT display, such as
  3. Adafruit_GFX,
  4. Adafruit_ST7735, and the
  5. QMI8658C library


Code Implementation

File Explorer.png

Note: You may need to update the QMI8658c.cpp and QMI8658c.h files from the widely used ALICHOUCHENE/Qmi8658c GitHub repository (or Arduino library) to ensure compatibility with your setup.

Especially if you get this warning: WARNING: library avr claims to run on (ESP32) architecture(s) and may be incompatible with your current board which runs on (esp32) architecture(s).

You can locate the folder by going to File Explorer on Windows, Arduino, Libraries, and then to Qmi8658c. Right click to open with Notepad++ or a text editor of your choice.

I added ESP32 to the library.properties as seen in the architectures=avr


name=Qmi8658c

version=1.0.0

author=ALI CHOUCHENE

maintainer=ALI CHOUCHENE <alichouchene10@gmail.com>

sentence=Interface with Qmi8658c Inertial Measurement Unit

paragraph=This library provides a convenient interface for working with the QMI8658C inertial measurement unit (IMU) on Arduino platforms

category=Sensors

url=https://github.com/ALICHOUCHENE/Qmi8658c

architectures=avr, esp32, ESP32

Understanding the Code

Fitness Tracker.jpg

The code structure is designed to initialize the sensor, read data, and display it on the TFT screen. Key functionalities include:

  1. Sensor Initialization: Setting up the QMI8658C sensor to read acceleration and gyroscope data.
  2. Step Detection Logic: Using acceleration data to determine when a step is taken. This is achieved through a simple threshold-based algorithm.
  3. Data Display: The TFT screen is used to show the user’s current temperature, step count, distance traveled, and calories burned.

Once you have uploaded the code, test your fitness tracker by walking around. The QMI8658C sensor will detect your movement, and the data should update on the TFT screen.

Downloads

Conclusion

FitnessTracker2.png

I hope that you make this project and share your experiences. I believe this fitness tracker project is an excellent way to apply theoretical concepts in a practical manner. It reinforces skills in programming, circuit design, and algorithm development, making it a perfect fit for students interested in robotics and embedded systems. Additionally, the project can be expanded with features like Bluetooth connectivity, step history tracking, or even integration with smartphone applications for data analysis (who knows maybe I'll try those feature in a different project!)

All in all building a fitness tracker using the QMI8658C sensor and ESP32 was a rewarding experience that deepened my understanding of embedded systems and also produced a functional device that can track physical activity.

Feel free to customize the project, add your own features or refine the step detection algorithm to improve accuracy!