icon

DIY A Simple Three-axis Accelerometer Data Logger

1 36382 Easy

Background 

ChatGPT has gained immense popularity recently, and the system has even been down due to a significant surge in usage. This aroused my interest in Machine Learning. I learned that TinyML enables the deployment of ML models on edge devices with limited resources, such as MCUs. So I decided to explore it by embarking on a simple project. 

 

Thought

The first step is to collect and store data for future model training on TinyML. I just got an accelerometer+gyroscope module, so I plan to make a simple data logger, which will gather and save the three-axis (x, y, and z) data of hand movements to a microSD card and display them on an OLED screen in real-time. 

HARDWARE LIST
1 ESP32-E IoT Microcontroller
1 0.96" OLED Display
1 MicroSD Card Reader
1 ICG 20660L Accel+Gyro 6-Axis IMU Module
1 MicroSD Memory Card
1 3.7V Lithium-ion Battery
1 3D-printed Housing
1 Switch

Connection Diagram

 

ESP32-E to Accel+Gyro Module  

3.3V to 3.3V
GND to GND
SCK to SCK
MI to SDI
MO to SDO
D12 to CS        

 

ESP32-E to MicroSD card reader
5V to 5V
GND to GND
MO to MO
D6 to SS
SCK to SCK
MI to MI

ESP32-E to 0.96" OLED display
3.3V to 3.3V
GND to GND
D5 to SCL
D7 to SDA
D2 to D/C
D10 to CS

 

Housing Design 

To build the 3D model of the housing, we need to design the hardware layout and measure dimensions first, then draw the model on SolidWorks.

The housing of the data recorder includes a cover,  base, and main body(box without a top).

Meanwhile, we need to reserve the Type-C port, switch and SD card slots, and 4 holes for M2 screws on the housing.

Slice and print the 3D model.

Solder Hardware

The ESP32-E IoT Microcontroller, ICG 20660L Accel+Gyro 6-Axis IMU Module, MicroSD card reader, and 0.96" OLED display need to be soldered according to the connection diagram.

The OLED display uses I2C for communication by default, and here we need to change the position of the resistor to use SPI.

Connect the battery and switch to the ESP32 maincontroller.

Assembly

For the sake of convenience, I design a base that allows the whole device to be fixed onto the arm with a strap. And the main body box is connected to the base by magnetic adsorption.

Embed two magnets into the base, and install another two on the corresponding position of the box bottom and fix them with hot glue. Then they can attract each other.

Fix the battery on the bottom of the box using double-sided tape, and then fix the maincontroller on the battery with the Type-C port aligned with the reserved slot.

Install the switch with hot glue.

Fix the display, SD memory card, and acceleration module to the cover plate.

Finally, put the cover on and screw to fix it.

The effect display is shown below.

Upload Program

Then upload the program. 

In the program, the three-axis values are recorded and saved to the MicroSD card, and displayed on the LCD in real time.

Data Collection

Insert the MicroSD memory card into the corresponding slot to store data.

The main body can be attatched to the base easily.

Power on the device, and record different movement trajectories such as square, triangle, circle, and cross (or X).

 

 

Read the data in CSV format from the MicroSD memory card.

I just simply test the device by gathering hand movement data. It can also be used to measure the g-forces exerted on your body when you do your favorite sports.

I will continue to try using the data for TinyML training and generate a neural network model.

 

Thanks for reading, feel free to leave your opinion about this project.

 

License
All Rights
Reserved
licensBg
1