This project uses a Freeduino (Arduino clone) microcontroller, Python code, a couple of motors with attached mirrors, and a laser pointer to create patterns (Lissajous Figures) that are in sync with audio played from a computer.

Objective

The basic idea here is to create some laser patterns that are in sync with music (or any audio) input.

Pattern Generation

The patterns, called Lissajous Figures, are generated using a laser and 2 motors with mirrors attached to them. (The laser source can be a cheap laser pointer.) The laser bounces off one mirror, then on to the the next before being projected on a flat surface. The Arduino board controls the speed and direction of rotation of the motors, and by varying these, various patterns can be created.

Motor Control

To control the speed and direction of the motors with the Arduino, we use an H-Bridge. You can read more about this in this tutorial at bildr.org. I am using the exact same configuration here.

Syncing with Audio

To make the lasers dance with the music, the rotation of the motors needs to match the music somehow. Here it is done by analyzing the frequency content of the audio stream and converting that into motor speed/direction information. To split the audio into frequency components, we use the Discrete Fourier Transform. We use Python to do this job, and send the motor speed/direction information via the serial interface to the Arduino, which updates the motors.

Please note that to run the Python code, you need to have scipy, numpy, pyserial, and pyaudio installed.

Source Code

The source for both the Arduino and the Python code can be found here.