Rostock can play Beethoven music


 

Did you know that CNC machines and 3d printers can be used to play music ?

As long as the machine uses stepper motors and can accept G-code commands you can use it to play simple sounds as explained on
http://en.homeconstructor.de/create-music-with-cnc-milling-machine.html :

Everyone who ever watched to a working CNC milling machine should have noticed, that such a machine creates many different frequencies.
In general you can say: the faster the axis moves, the higher the frequency is.
So it is only logical, to generate different frequencies in a defined sequence, so that you can hear a real music.

Principle

A CNC milling machine must always know, in what position the axes are at the moment. So usually the axes are driven by stepper motors because with a step motor driver you can turn the rotor of these motors by a small, defined angle and the position then is kept.

Conventional stepper motors have a resolution of 200 steps per rotation, that means you must generate 200 clocks to turn the rotor by 360°.

However, to get more precise resolutions, you can use a so-called micro-step capable stepping motor controller, which uses time-shifted sine or square waves to get a better resolution.
When you use such a control for example in the 16th-step-operation, you must generate 3200 clocks (16*200) to turn the rotor of the stepping motor by 360°.

Of course, the stepper motor is mounted on a spindle which has a defined pitch, for example 5 mm per rotation, that means with one rotation of the spindle, the nut moves thereon by 5 millimeters.

In this case, you need 3200 clocks so that the axis moves by 5 millimeters, or in other words: 640 clocks for 1 millimeter.
When the axis now moves at a rate of 1 millimeter per second (= 60 mm/min), then the stepping motor is controlled with 640 clocks per second, which means 640 Hz.
At the double velocity of the axis, a tone with double frequency is generated.

According to this principle, (theoretically) every frequency can be generated.
And depending on how many axes the CNC milling machine has, a certain number of different tones can be played simultaneously.

 

BUT this only applies to cartesian machines. Delta style printers don’t rotate one motor if you tell them to move for example X axis by 10mm. The firmware instead recalculates the movement of each motor so the end result is the movement of the head by 10mm on X axis. The only movement that doesn’t have to be divided between all three motors is Z movement. We can use this knowledge to slightly modify the Gcode and make delta printer a music player.

I used this MIDI to Gcode converter :

http://en.homeconstructor.de/converter-convert-music-in-g-code.html

 

MIDI2Gcode

MIDI2Gcode

Upload your midi file and click “Analyze file” button..

 

MIDI2Gcode

MIDI2Gcode

It is important to select 1 under “Number of axis” and correct steps per millimeter(original Rostock Mini has 44 steps/mm but mine is changed).

Also choose half of your bed diameter or smaller for “work area” settings. Check “I agree…” and click “Create G-code”.

 

MIDI2Gcode

MIDI2Gcode

Now you can save the generated file but don’t forget to change the extension from *.nc to *.gcode.

 

MIDI2Gcode

MIDI2Gcode

I deleted first 19 lines and added a few standard starting lines.

 

MIDI2Gcode

MIDI2Gcode

I deleted first 19 lines and added a few standard starting lines.

 

MIDI2Gcode

MIDI2Gcode

Now use the “Search and Replace” function in your text editor and replace all “X” characters with “Z” character

MIDI2Gcode

MIDI2Gcode

I also replaced “G01” with “G1” command but this is optional

MIDI2Gcode

MIDI2Gcode

 

Now all you have to do is send that file to printer and press PRINT!
Here is the final result :