In this final project, I implemented a way to control a self balancing robot that utilizes a microphone and music notes. I wanted a way to control the robot wireless without adding any other sensors such as WiFi or Bluetooth. Using the Texas Instruments' Fast Fourier Transform (FFT) library, I was able to recognize different notes played from my phone using an piano app and steer the robot.
Using an analog to digital converter, I converted the analog signal received by the microphone. Then, I saved the results into an array. Using the FFT library, I took the FFT of the signal which enabled me to recognize different notes. The main way to recognize the notes was to look at the output array of the FFT and find the maximum frequency found. In order to decrease the error, I made sure that the last 3 notes recognized are the same. After that I implemented a state machine that makes decisions depending on the note recognized by the robot. In addition, I used two array to run the FFT on, which enabled me to keep recording until I have a full array. I kept changing the input array between these two array called 'ping' and 'pong'.
In addition to steering the robot, a specific pattern of music notes makes the robot do a specific move such as spinning. In my implementation, I used a start note that puts the robot to a listening state which counts up until it hears the second note in a specific time frame and continues to listen for the other notes in the same way. If it recognizes all the notes in the expected order and in the expected time frames, it toggles an LED on the robot and starts to do the specific move. Below is a video of me demonstrating. The first try of the pattern recognition didn't work as I couldn't play the notes is the expected time frame.
Overall, I really enjoyed working on this robot and I believe I learned a great deal about mechatronics. I think that the project was successful as I met my goals I had in my mind. If I had more time, I would tune the controller better.
Comments
Please log in or sign up to comment.