Singing 3D printers for Christmas
In connection with an advent Calendar, I have played around with Music from CNC machines. This commonly known hack is automatized by a few websites already. In detail it works as Such: A note from a midi-file is taken and converted into it’s frequency and this stands in relation to the pulling and repelling of the electromagnets in the motors.
This frequency is translated into steps per minute, then revelations per minute and then into distance in mm per minute, so feedrate. This means, a high-pitched tone means higher rotational speeds and higher feedrate. A high-pitched long lasting tone hence leads to a large distance traveled.
This leads to a few problems. A high-pitched long tone in the implementation of Ultimatesolver leads without error-messages to a movement across the borders set in the software and hence to a crash into the physical boundaries. A too high-pitched tone also leads to missing steps since the next magnet is too far when it gets switched on for the rotation to complete. It then jumps back and steps get lost. In the first look this doesn’t sound too bad, but when the printer a few seconds later thinks that the axis is at the other end of the range and gets told to “move back”, it will crash into the boundary too.
To stop this i have written a small script. This script takes the GCode, consisting of a home-command and the following G1 commands that the movement consists of, and transforms it into a GCode that better considers those issues when moving on the x-axis only.
Why x-axis only? One reason: The printers with 3 perpendicular axes like almost all 3D printers except for the Ultimakers and some others these days are based on the Prusa MK1. They have the least weight on the x-axis, meaning the least noise when suddenly breaking and accelerating. This was important since my 3D printer with it’s exchanged super silent TMC2208 stepper-drivers are so quiet that the music is not hear-able over the rumbling of an y-axis for example coming to a stop.
On louder printers or printers like the Ultimakers, it might make sense to use more axes. whoever wants to use my script, can do this on their own risk, download it under CC0 License, modify it and redistribute it.