We continue with our series of articles, which give you a unique glimpse into the world of Prusa Research’s development, design and programming. In our last article, we explained how we tackled an improved Mesh Bed Leveling routine. This time, we’ll explain how we made the heatbed virtually silent. Silent operation is one of our customer’s (many) requirements. However, 3D printers consist of various parts, which obviously make noises when they move, but there are some that can produce sounds even when they’re completely still. So it’s not just about motors, fans, bearings, but also the power supply or the heatbed. Let’s focus on the last two.
The heatbed kept producing a sort of clicking/chirping sound, which was somehow related to the status LED turning on and off. We analyzed this behavior and found out that the heatbed acts as a loudspeaker. It reacts to sudden switching on and off of the passing current (heating) with mechanical resonance – sound. This is pretty much the same behavior you can find in your headphones.
We used a studio microphone to record the sound of switching on and off:
The switching power supplies used in our 3D printers operate in two modes – high and low power. They can switch between high and low power modes internally to save energy. This switch generates a quiet, yet audible, click.
Our task was to design an algorithm for controlling the heating of the heatbed with the intention to eliminate (or at least suppress) sudden abrupt changes. At the same time, the power supply should remain in the high power mode during printing.
One possibility was to increase the switching frequency of the heater to the point, the heatbed will no longer be able to react mechanically – the chirping/clicking would stop.
However, this approach has at least two technical limitations:
The MOSFET responsible for power switching has to “survive” the increased frequency. And the switching power of the heatbed is not negligible – it’s around 80 W.
The frequency must be hardware-generated to avoid wasting precious CPU cycles of the 8bit microcontroller.
The CPU we’re using is an ATmega2560, which has pulse width modulation (PWM) circuits derived directly from the processor clock. The clock can be divided by predefined dividers: clk/1, clk/8, clk/64, etc. The hardware-generated PWM always has 256 steps – e.g. 16 MHz / 256 = 62.5 kHz.
Our experiments with a switching frequency of 62.5 kHz in spring 2019 showed that with this frequency, the heatbed is silent. Because of its design, it isn’t able to emit 62 kHz as mechanical resonance, on the other hand, the MOSFET started overheating. Decreasing the switching frequency below 16 Hz resulted in the power supply switching between low and high power modes – the clicking was back and it was especially noticeable at 110 V / 60 Hz.
The first solution
The first solution was based on a trick: we wanted to trick the human perception. Here’s the deal: once you focus on the chirping sound, it’s very difficult to forget it. The more you listen to it, the worse it gets. If it was possible to make a completely irregular chirp, this noise could be interpreted by the brain as white noise (albeit quite strong). We thought that this way, the sound would be much less irritating.
The experiments started with irregular PWM at a basic frequency of 30 Hz. It turns out that while this frequency almost perfectly maintains the power supply in the high power mode, the chirping of the heatbed is still audible and pretty much equally annoying.
The second solution
The second option was considerably more demanding, implementation-wise. The principle is again very simple and combines two ideas: we wanted to maintain the basic switching frequency so that the power supply does not click, and to ensure that the switching is not sudden – we wanted to make it gradual. However, gradual switching in digital technology is not very easy to realize. PWM is used as an approximation in this task.
And this is precisely the principle of how we made the heatbed quiet. The basic slow PWM of 30 Hz has its leading edges “broken” by 62.5 kHz with increasing duty. This simulates a gradual increase in voltage of the heatbed. The falling edges are exactly the opposite – the voltage drop is simulated. These sequences with fast PWM are called soft edges.
Detail of leading and descending soft edges:
The whole algorithm, of course, has to use the hardware circuits of the CPU almost exclusively in order not to compromise its performance.
With the soft edges lasting 230μs, the MOSFET temperature measurements confirmed that the transistor does not overheat – the temperature is the same as with the original “unbroken” 30Hz PWM.
Implementation and test results
The first implementation appeared in firmware 3.8.0-RC1. It used the simple principle of finite automaton running on the basic frequency of 62.5kHz. It ensured the generation of soft edges and long sequences when the heating is switched on and off.
During the testing, we encountered two problems:
There was a mistake in the calculations – the basic switching was at 15 Hz, which was noticed by our active beta testers, who were running the printers at 110 V / 60 Hz – their power supply units started clicking.
The second major problem was the computational complexity. Interruptions called at 62.5 kHz frequency, unfortunately, resulted in lower serial line throughput in certain (extreme) cases of fast printing. This happened despite the fact that the whole routine was properly optimized.
The only thing we could do was to revise the algorithm and take advantage of another trick that the ATmega20 processor offers – switching the timer prescaler. The idea is that long sequences, where the heater is either on or off, can be operated with a slower timer (now clk / 8), for instance, 8 times less frequent interrupt handler calls. In the future, clk / 64 can also be used, but at the expense of a slight decrease in the accuracy of the heatbed temperature PID control.
The main challenge of this solution was that although the prescaler can be switched even while the timer is running, it is necessary to fine-tune the sequence of its control register settings. For some changes it is necessary to let the timer trigger the interrupt service routine (ISR) again because otherwise, a pulse will appear on the output pin, which is, of course, something we do not want – it would cause an audible click of the heatbed. The new finite state automaton has appeared in firmware 3.8.0-RC2 for the first time and for all the reasons mentioned above, it is much more complicated. It had to be fine-tuned with an oscilloscope.
This second algorithm brought the required results. It proved to be engineered well enough not to burden the processor with unnecessary calls to the ISR and keep the heatbed along with the power supply unit silent at all times. Immediately, our active beta testers confirmed that after publishing the algorithm and integrating it into Github’s source code, both the heatbed and the power supply unit were silent. After a week of testing it was confirmed that the data throughput had returned to firmware 3.7.2 performance level.
We would like to thank our active beta testers and contributors at Github, namely: wavexx, leptune, vintagepc MakeSomeGood, vertigo235! We believe that the entire process of silencing the heatbed and the power supply unit will enhance the user comfort even further.
Don’t forget to keep your printer updated. The last version of MK3/S and MK2.5/S firmware (3.8.1) is available on our website.