Musical CNC

Stepper motors are one of the basic components used for linear motions systems in general and CNC machines in particular. Stepper motors operate quite differently than the electric motors that most people are familiar with. General purpose electric motors have power applied continuously and rotate continuously. Stepper motors are powered with pulses of power, and move in discrete small steps. Typically 200 pulses are required for each rotation of a stepper motor. Rotor position can be precisely and repeatably controlled by sending a corresponding number of pulses. Rotation speed is controlled by the rate that pulses are sent to the motor.  CNC controller electronics are designed to send trains of pulses at specific rates, and numbers of pulses.

The pulse rates are sent by controllers are typically in the audible range. If you listen to stepper motors run and change speeds, they make make tones that sound musical.

As an illustrative example, with the help of tools on the web, I took a MIDI file for a Scott Joplin rag (the one used as the theme song in the movie “The Sting”), and translated the file into a control file for my CNC machine. The result is that the CNC can be programmed to play the rag, captured in the video embedded above. There are 3 stepper motors on my CNC, consequently 3 notes can be played simultaneously.