English | Português
Position Control With IMU
This example demonstrates how to use an IMU sensor to detect hand position (UP, DOWN, SIDE) and display it in real-time using a Python GUI.
The firmware.ino file contains the Arduino firmware for the IMU sensor (LSM6DS3). It uses an ESP32-C3 microcontroller to read the Z-axis acceleration from the LSM6DS3 Gyroscope Accelerometer Module (SPI/I2C) and sends the hand position via serial:
- UP: Z acceleration > 0.5
- DOWN: Z acceleration < -0.5
- SIDE: Default position
The hand-imu/ directory contains a Python application that visualizes the hand position in real-time.
- Navigate to the hand-imu directory:
cd hand-imu- Install the required dependencies:
pip install -r requirements.txt- Update the serial port in
app.py(line 8) to match your device:
PORT = "/dev/cu.usbmodem1101" # Change to your port- Run the application:
python app.pyThe application will display images corresponding to the detected hand position:
UP Position:
DOWN Position:
SIDE Position:
pyserial- Serial communication with ArduinoPillow- Image processing for the GUI


