Hi, I'm Aharon

Electrical Engineer and Musician

Aharon Sebton

Hi, I'm Aharon

Electrical Engineer and Musician

Dancing Hexapod

Dancing Hexapod

The inspiration for my final project in my Principles of Robotics class stemmed from Boston Dynamics’ video of their dancing robots. I proposed the creation of a hexapod (six-legged) mobile robot that could accurately detect the tempo of a song or audio file being played, and perform a set of dance moves that are synchronized to the beat. As a stretch goal, I wanted the hexapod to move toward the audio source before dancing, just as a human would at a concert. The following initial flowchart depicts the desired behavior of the robot:

Program Flowchart

Program Flowchart

The hexapod used in this project is powered by a 7.2V rechargeable battery pack and controlled by the Ardino UNO and Lynxmotion SSC-32U control boards shown below. A single serial connection between the Arduino and the SSC-32 allows the Arduino to offload the burden of simultaneously controlling the motors to the SSC-32 while it analyzes the audio samples it takes in.

Control Boards

Control Boards

Each leg has two servo motors to control its “shoulder” (stride) and “elbow” (lift) joints, for a total of 12 motors. The SSC-32 can also provide power to the ultrasonic sensor mounted on the front of the robot. For this project, however, the extra SSC-32 power ports were used for two electret microphones.

Hexapod Overhead View

Hexapod Overhead View

I created a C++ script with distinct functions for the Arduino to establish serial communication with the SSC-32, acquire an audio signal and estimate its tempo, and execute modular “dance moves” in a customizable routine. Arduino libraries were used to assist in SSC-32 communication, performing a fast Fourier transform (FFT), and working with vectors.

The audio processing algorithm aimed to estimate the tempo of the audio in real time, but memory limitations on the Arduino UNO did not allow for this. Instead, I implemented the following algorithm:

  1. Capture and store audio samples from a microphone periodically
  2. Apply a Hamming window to the audio signal to improve clarity in the frequency domain
  3. Apply the Fast Fourier Transform to the windowed audio signal. The result is the frequency spectrum of the sample.
  4. Determine the highest peak of the frequency spectrum. This is the most prevalent frequency in the signal.
  5. Transform the peak frequency (f) to a reasonable one, if needed.*
  6. Set the delay between robot frame transformations accordingly. (Delay T = 1/f)

* Sometimes, the most prevalent frequency detected is actually a harmonic of the true tempo of the audio signal. To achieve an accurate estimate of the true tempo, it may be necessary to multiply or divide the detected peak frequency by an even integer. To simplify the determination of whether this is necessary, I only tested the algorithm on audio signals with tempos in the 1-3 Hz (60-180 BPM) range; most musical pieces fall within this range. Any detected peak frequency outside of this range was multiplied or divided by 2 until a value within the proper range was reached.

More information about this project is available on GitHub.