16299 Final Project: Dancing Penguin Robots
by alinache in Circuits > Arduino
393 Views, 1 Favorites, 0 Comments
16299 Final Project: Dancing Penguin Robots
We programmed an ELEGOO Penguin bot so that it will listen to any played song in real time and dance to its tempo!
Supplies
- ELEGOO Penguin Bot Kit
- Computer with Arduino + Python software
Assemble Robots
After obtaining Penguin Bot kit, follow the instructions in the kit until completion to assemble the robot.
Download Manual Book, Tutorial, and Code
From the ELEGOO Penguin Bot website, download the Manual Book, Tutorial, and Code through clicking the "ELEGOO Penguin Bot V2.0 - link 1" link on the site. This will download a zip file onto your computer.
Here is the link to the website: https://www.elegoo.com/blogs/arduino-projects/elegoo-samrt-robot-penguin-bot-tutorial
Open Penguin Bot Source Code
First, open the Arduino application on your computer. After downloading the zip file, unzip and go into the "ELEGOO Penguin Bot V2.0" directory. Then, go into the "Penguin Bot" directory. Open the "PenguinBot.ino" file. This is just to see what the penguin bot can originally do and give intuition on how to move the motors.
Open Tempo Detection Code
We used VSCode, but use any Python IDE and open + run the attached "tempo_extractor.py" file. Make sure to download the appropriate dependency packages. When running, the program should let you play a song out loud, and your computer will listen and output a tempo (in bpm) and output that number. It does this via analyzing the downbeats (the first beat of every measure) of a song.
Downloads
Play Music of Your Choice
Any song you want. Consider experimenting with different songs that involve a range of contrasting tempos.
Dancing Robot
The tempo extractor script should communicate with the the penguin bot serial and the outputted tempo should be forwarded so that its arduino program can read the tempo. Now, the robot should be able to dance to the tempo of the song!
We use the Python script to detect a tempo (bpm), we set the encoder motor speeds. Our error is the difference in tempo (bpm) and the rpm of the motors. With a PD controller we optimize until the robot moves on rhythm. This notion of "on rhythm" is respect to a the downbeat of a song.
Conclusions
Through the process, the most difficult aspect was getting the tempo extractor script to communicate with the penguin bot. We eventually found that the best solution was to use a Windows computer instead. We also had to spend additional time coordinating "happy" vs "sad" looking dances for the robot to move to. Overall, though, the project was an incredibly fun experience, we thought the robots were very cute, and we were very proud of our work.
Additionally, here is the link to our final presentation slides: https://docs.google.com/presentation/d/e/2PACX-1vS-3IZ6naaRPUbKnM9rfsxEU0Sqv72ilMH9_9DLdpEud7a80ccxNiT9QNOzubYebL3vsdVaHtXMlwQj/pub?start=false&loop=false&delayms=3000
Our progress video files were too large to upload on this instructables page, but you can hopefully view them on the presentation slides.
Improvements
There is some lag between playing the song and the robot dancing to its tempo as the Arduino program must process what the new tempo is and the robot needs to then change its movement speeds accordingly. A great future improvement, we recommend, would be to improve this lag (make it smaller). Furthermore, it would be awesome to incorporate both robots in "partner" dances as an extension project.