This project was developed as the final activity for the Microcontrollers Project class at PUC-Rio, Brazil. It showcases the integration of Arduino and MediaPipe to create a humanoid dancing robot that mimics human movements. The project was conceived as an idea aligned with this year's class theme, Interactive Art.
Watch the robot in action in the video below:
DemonstrationVideo.mp4
- Humanoid robot capable of imitating human movements.
- Motion capture powered by MediaPipe for precise tracking.
- Controlled via Arduino, ensuring smooth and responsive movements.
- Fully 3D-printed components for a customizable and modular design.
- Themed around Interactive Art, blending technology and creativity.
- Arduino microcontroller (e.g., Arduino Mega or Uno).
- 12 Servo motors (SG90 and MG90S models).
- 16-Channel 12-bit PWM and Servo Shield for Arduino
- Power supply for the servos and Arduino.
- Camera for motion capture (any standard webcam, including built-in laptop cameras).
- Structure and pole to securely hold the robot in the air during operation.
- Structural components: 3D-printed parts (see below).
Warning
While the Arduino Uno may work, it is recommended to use an Arduino Mega due to its larger SRAM (8 KB vs. 2 KB on the Uno), which provides better performance and stability for memory-intensive tasks.
- Arduino IDE for microcontroller programming.
- Python 3.8 or later.
All 3D-printed files can be found in the /3D_Files
directory.
Tip
Since the 3D files of the robot are symmetrical, you can simply open the SLDPRT files and mirror them to create both sides of the robot. Afterward, save the mirrored parts as STL files and you're ready to print!
- Connect the servos to the PWM Servo Shield board.
- Install the Adafruit-PWM-Servo-Driver-Library
- Upload the provided Arduino code using the Arduino IDE.
- To install the Python dependencies, run the following command:
pip install -r requirements.txt
Before running the project, make sure to correctly configure the Arduino's serial port. The serial port may vary depending on the operating system and the connection to the Arduino.
- Open the main Python code file, main.py.
- Locate the following code snippet:
try: arduino = serial.Serial("COM5", baudrate=9600) # Change port according to your device
- Replace 'COM5' with the serial port of your Arduino.
- Ensure that the robot is fully printed and assembled correctly, and that each servo is connected to the correct pwm port.
- And make sure the camera is connected and communicating with the code.
- Execute the main.py file to start motion capture and servo control.
- MediaPipe captures keypoints of human movements in real time via a camera.
- By analyzing the angles of the joints, it detects pre-programmed poses and synchronizes them with the music's rhythm.
- The Python code running on the computer detects the beat of the music and establishes the rhythm.
- This timing determines when each pose should be sent to the Arduino for execution.
- The Arduino receives pose data via serial communication.
- It moves the robot’s servos in sync with the rhythm to perform the correct movements.
- The robot's frame is constructed using 3D-printed parts.
- This provides a lightweight and modular structure for easy customization and assembly.
We would like to extend our heartfelt thanks to everyone who contributed to the development of this project. Your support, ideas, and dedication were essential in bringing this robot to life.
Thank you all for your hard work and collaboration!