Disco Robot | Self-balancing two-wheeled robot

- Group Project -

Brief (in brief)

Use a virtual PID controller to self balance a two-wheeled robot. The robot must be controllable from a phone via Bluetooth whilst self balancing. Finally, the robot must be able to recognise music and then dance to the beats.

Photo credits: Joseph Shepherd


Our aim for the dancing in this project was to use spectral analysis to generate our own dance moves based on the frequencies of the music played. This would make for a robot that could dance to whatever music we played. To achieve this, we first had to write the necessary code for the basic functions, such a remote control and beat detection.

The really tricky part proved to be tuning the PID controller. We tried all manner of mathematical techniques, such as looking at the frequency of the oscillations and following rough guideline. In the end, I found that the ideal values had an extremely high integral factor.

Photo credits: Joseph Shepherd


The final competition was split into to two parts. The first was to try and complete a driving course whilst self balancing. The robot was slightly difficult to control due to the perturbations introduced not being gradual. We could have improved this by slowly increasing the power of the control when a control is inputted. Otherwise, however, we completed all the objectives will few problems.

The self balancing worked well and the dynamically generated dance made it quite fun to watch as it was pretty unpredictable. Despite the challenges with coding the dynamic dancing, the idea was well received and the robot won the dance off competition.

The project taught me a huge amount about processing both systems and control. It also massively improved my confidence in coding in python. We had to be a little inventive and this was really enjoyable. Despite the hours I put into tuning the PID controller, I really enjoyed using the physical device to teach myself about how PID feedback actually works in real life.