Introduction: DIY a Simple Three-axis Accelerometer Data Logger

About: Empowering Creation for Future Innovators; Our mission is to form a community with easy access to whether hardware, software and ideas that allow makers and younger generation to achieve their goals and realiz…



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.


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.


Step 1: Connection Diagram

ESP32-E to Accel+Gyro Module

3.3V to 3.3V





D12 to CS

ESP32-E to MicroSD card reader

5V to 5V


MO to MO

D6 to SS


MI to MI

ESP32-E to 0.96" OLED display

3.3V to 3.3V


D5 to SCL

D7 to SDA

D2 to D/C

D10 to CS

Step 2: 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.

Then slice and print the 3D model.

Step 3: Solder Hardware

The ESP32-E IoT MicrocontrollerICG 20660L Accel+Gyro 6-Axis IMU ModuleMicroSD 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.

Then connect the battery and switch to the ESP32 main controller.

Step 4: 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.

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

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

3. Install the switch with hot glue.

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

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

6. The effect display is shown in the figure above.

Step 5: 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.

Step 6: Data Collection

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

The main body can be attached to the base easily.

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

3. And 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.