In the first two parts of this blog series, I have given you a first insight, how a 3D printer is built and which tools you need to print creative ideas from others on your own printer. The basis for this is in most cases a STL file converted by means of a 3D-SLICER program in so-called GCODE.
Also I have downloaded and printed many such files, but at some point I was annoyed by the volume of the printer, especially when the axes move a lot or changed many direction changes. In the second part of this series, it was already about the modding or upgrade of a Custom firmware using Ultimaker Cura. In this blog, the focus will be on hardware improvement, calibration and PID tuning. For this purpose, I use the print server Octoprint, but I look at a later time.
A warning directly at the beginning of this type of modifications. In some places you work near 230V. This tension is dangerous to us should never be underestimated. If you have no technical education, or not really trust, modifications of this kind can be partially life-threatening!
The Silent Stepper Motor Driver
After my more prolonged research, why my 3D printer was so loud, the built stepper motor drivers were the source of evil. To understand why that is so, I found a very simple but still very clear example. Simply imagine two polygons, one with e.g. 6 pages and one with 10 pages, see Figure 1.
Figure 1: Simple example of motor drivers
A motor driver sends a signal to the motor as far as he should turn and in which direction. For cheap motor drivers, see Figure 1 Red 1, the resolution is rather low, which leads to an unclean print image. However, the motor drivers are high-quality, see Figure 1 red 2, the motors can be controlled more precisely. As a result, the print image is also significantly improved and the temperature of the motors can be significantly reduced. Especially when the motor drivers have a higher resolution and are also high quality, one fixes three problems:
- Motors too loud
- Motors are too warm
- Unclean print image
On the network, you will find a pile of results on the topic "Silent Stepper Motor Driver". Depending on the printer, you will usually find the TMC2208 or TMC2209 variants as preferred drivers. These are available from many manufacturers, but just cheap motor drivers from the Far East do not bring the hoped for improvement. On the contrary, mostly the printer is quieter, but the print image will not be really better. Especially with the TMC2208 is marked with version 2 or 3, with the original TMC2208 only up to version 1.2. You should pay attention to it before buying the new drivers.
For my printer, an AnyCubic I3 Mega S, I decided for the TMC2208 V1.2 of FYSECT, see Figure 2.
Figure 2: TMC2208 V1.2 from FYSECT
It is important to note that I do not use the UART version, but the stepper variant. Again, be sure to pay attention before the purchase, which variant lands in the shopping cart.
At this point will now explain how I conduct modifications with an open device. There are 230V in some places of description, which is life-threatening. Unless they do not understand a specialist or in dealing with this tension, it is urgently to disclose such modifications. Instead, ask a person from the subject to carry out these modifications.
In my printer, so-called A4988 stepper motor drivers are installed, which are to be replaced by the TMC2208. First, the floor must be opened from my printer, which means it best on the side, see Figure 3. Before, the IEC connector should be removed from the printer.
Figure 3: A look into the printer
First, we see the power supply down below, which corresponds to 230V in 24 and 12 volts. As clearly, the connections on the power supply are open, which makes this conversion of dangerous. At the top left you see the heart of the printer, the motherboard with all connections. Left the display and above the SD card reader. If you look at the motherboard more closely, you can see the built-in motor drivers quite clearly, see Figure 4 red border. Before I have removed the fan for cooling the drivers, so that the installation and expansion is easier.
Figure 4: installed stepper drivers
Do not be wondering, I have no original image of the motor drivers because I have built others for a test. But you have to check if the drivers are plugged or soldered to the motherboard, in my case they were plugged. This makes a renovation pretty easy and saves time, as well as inhaling and expansion measures.
If the previous drivers are expanded, you can take a closer look at the old and new drivers, see Figure 5.
Figure 5: Old and new stepper drivers up and down
The built-up chips and electronics components alone show that the new driver, right in the picture, seems to be high quality. It is also important, among other things, which PIN is responsible for something. This also helps the label on the motherboard itself, see Figure 6 to install the modules correctly.
Figure 6: Pin lettering on the printer mainboard
In the old drivers, the label is on the bottom, which is why you have to reflect mirror. With the newer drivers, the caption on the top and a rethink is therefore not necessary. Nevertheless, the conversion should be taken precisely that the pins also stuck in the right place, otherwise you risk a destruction of the motherboard. In my case, the installation was very fast and uncomplicated, see Figure 7.
Figure 7: The new stepper drivers on the mainboard
Thus, the first and quite simple part of the conversion is done, which should definitely check that all drivers were installed correctly. As already mentioned, in my case, the label has helped on the mainboard.
Now comes the dangerous part, since the IEC connector must be connected back to the printer, but not forget the cables outside on the housing to the engines, see Figure 8.
Figure 8: Cable withdrawn outside of the printer
This must be made because now the reference voltage must be set to each single stepper driver. This is measured via any ground terminal on the mainboard and the adjusting screw for setting the reference voltage, see Figure 9. For this purpose, the printer must be switched on, otherwise no voltage is applied to the mainboard.
Figure 9: Measuring the reference voltage of the motor drivers
It is therefore caution if the reference voltage is set to the rotary potentiometer. In the reference voltage, there are so many opinions as users in forums. In my case, I have set the voltage to 1.05V for the X, Y and both Z axes and the extruder to 1.1V. If the print image has an offset in an axis, the reference voltage must be adjusted accordingly. On below 0.8V, so you can find it in various forums, the voltage should not be set. Precisely because the power supply has open connections, make sure not to get to the cables to avoid electric shock, or destroy components.
Finally, the printer must be assembled again, see Figure 10.
Figure 10: Motor driver under ventilation channel
In my case, I have printed a ventilation channel before and installed it with a quieter 12V fan in the housing, over the motor drivers. For mounting the ventilation channel, the mounting screws are used by the motherboard. Thus, the motor drivers should not be too hot. Again, there are various opinions as to whether such a channel is useful or not.
If the 3D printer is assembled again and all plugs connected, the firmware had to be adapted in my case, otherwise the motors would turn into the wrong direction, that the engine direction is inverted. As in the second part of the blog post, I use the adapted Marlin firmware from Knutwurst. So that the engines turn back in the right direction, the firmware with the addition "_TMC" needs, see Figure 11.
Figure 11: Selection of correct firmware "Knutwurst"
The recording of the new firmware is done on the same way as it has already been described in the second blog post, in my case with the 3D slicer program Ultimaker Cura. The printer is now quieter and a problem with incorrectly rotating motors has already been corrected directly in advance.
Octoprint as a print server
As announced in the second blog post, Octoprint should be presented here. Octoprint is a web interface that allows you to control the printer and manage prints. From the basic idea you can imagine how a printer server, uploading the GCODES on the web interface to select it for the print job. Furthermore, we have access to the so-called terminal, which allows direct communication with the printer, via Marlin codes.
Octoprint is primarily offered with an image for the Raspberry PI, the so-called Octopi image, but it can also be installed on all other common operating systems. How exactly is that will be on the corresponding download page of Octoprint Explained. To use Octopi without restrictions, the page recommends a Raspberry PI 3B or higher. But there are also users in various forums reporting on a successful use with a Raspberry Pi 2 or Zero.
Before the question comes up, Octoprint is not the only print server solution for the 3D printing. In fact, there is also the so-called Repetier server. However, this software costs money to use all the features, but unlike Octoprint brings the advantage that several 3D printers can be managed at the same time. For my first approaches, I still decided on Octoprint, because I should use Ultimaker Cura for the slicene and Octoprint then "only" manage the print job. For this blog post, however, the terminal and printer control are important, as we will carry out the other software adjustments here.
The pid tuning from the heat and hotend
At this point it will be a bit technical and we make a small excursus in the world of tax and control technology. As the name of the headline already mentioned, the PID control circuits for the heatbed and the hotend should be adapted. Who is not home now in the tax and regulation technology, I just want to explain that briefly.
A PID controller is, as the name suggests, a control loop to keep a predetermined setpoint as specifically as possible even if possible. In most readings, this is shown as shown in Figure 12.
Figure 12: PID controller, Wikipedia by MRMW
The simplest controller shape is a P controller. For this you can imagine an oven to be heated to 200 degrees. If the 200 degrees are exceeded, the oven is switched off. If he cools down and the 200 degrees are fallen below, he will be switched on again. The temperature curve then resembles a saw, wherein the target temperature is in the middle. The tips up and down are then ideally proportional. The PI, PD and PID controllers improve this behavior if changes need to be performed faster and more precisely.
In the case of 3D printer, in this case, the setpoint means the temperature of the heat and hotend. Due to the travel movement, the fan, ambient temperature and many other factors, the temperature can vary greatly, which could lead to a unclean print image or detachment from the heatbed. With the PID controller and a temperature sensor, these fluctuations are recorded and corresponding "countermeasures" are performed to hold the temperature on the setpoint. In the case of the Heatbed and Hotend, the MOSFET is simply switched on and then switched off again for heating for a certain time.
The tuning of these two control circuits refers to the parameters P, I and D. The P share is exclusively the proportional proportion of amplification.
The I component is the integral share in the control loop, for the temporal control deviation. The D component is the differential proportion to the change of the setpoint.
These three constants are predefined in the Marlin firmware, but are not consistent with the values needed for the printer! In addition, in this case, in this case, the customfirmware "Knutwurst" offers the possibility to adapt these control circular parameters because they were not changeable with the original firmware. In both cases it is important that the printer has the ambient temperature and previously not somehow heated, otherwise the following values from the software do not correct!
Let's start with the PID tuning from the Heatbed. To do this, I open Octoprint and connect to my printer and the Pi, see Figure 13.
Figure 13: Connect Octoprint with printer
Then I open the terminal, see Figure 14, here already some information displayed. The abundance of the information may scare at first, but only information that the printer with the Raspberry Pi will replace and visualize.
Figure 14: Open the terminal
Thereafter, the terminal is entered the command from code 1. I would like to explain this command with the parameters so that they understand what exactly the order does.
M303 E-1 S60 C8
Code 1: Terminal command for the PID calibration of the Heatbed
M303 stands for the command to perform the PID autotuning. The parameter E-1 stands for the heatbed. Important at this point, as it goes around the PID tuning from the Heatbed. The parameter S60, stands for the setpoint temperature 60 degrees, which should heat and hold the heat bed. The last parameter C8 stands for the number of cycles to be performed for PID autotuning. The heatbed is deliberately cooled and slightly overheated to determine the exact parameters for the PID controller.
If the command was sent to the terminal, apparently only a little, see Figure 15, but now the heated bed is heated to the target temperature 60 degrees.
Figure 15: Pid autotuning started from the Heatbed
After a short time, the terminal will fill with some text, see Figure 16, which, among other things, outputs the new parameters for the PID controller.
Figure 16: Space of the PID autotuning from the heat bed
These messages can first be ignored, because it is only animp! These are the determined values of the respective cycle, which are not yet the end parameters. It is important only when you see the line as shown in Figure 17.
Figure 17: Finished PID car tuning from the heated bed with new constants
Here, the terminal announces that the PID autotuning is completed and the constants were determined for the PID controller, see Figure 17 Yellow mark. The values are deviated from the values shown here in Figure 17, but the terminal recommends storing these values in Configuration.h. Only that we do not recompile the firmware, but transmit the values by means of terminal command to the printer. We use the Marlin command from code 2.
M304 P66.27 I13.05 D224.40
Code 2: Submit the new constants from the Heatbed PID controller
Again, the short explanation so you understand the command completely. M304 is the marlin command to set the values from the PID controller. Important here the parameter is set only Not saved! Parameters P, I and D represent the values for the control loop and should have the output values of PID autotuning. So that there are no problems, instead of the comma, the point for the decimal places must always be used! After the entered command only a short feedback appears that the values were adopted, see Figure 18.
Figure 18: The printer has received the new PID constants for the Heatbed
Thus, the new constants are temporarily available, but when restarting or reset via marlin command to the EEPROM data, the old constants are used again. So that this does not happen or the values are stored firmly, you are permanently stored with the MARLINE command from code 3 in the EEPROM from the printer.
Code 3: Save parameters permanently in the EEPROM
M500 is the marlin command to transfer all changes to the EEPROM, which is loaded when the printer is e.g. restart.
This still remains open the hotend, which is similar to the parameters, like the heatbed. But there is a small deviation. In addition, we want the hot fan to be active and as a "fault source" is also correctly regulated. By means of the Martlin command of code 4, the hot fan is set to full speed.
Code 4: Set the Hot End Fan to Full Speed
Next, the PID autotuning should be started by the hotend. For this purpose, the Marlin command M303 is used again, but the parameters are slightly different this time, see code 5.
M303 E-0 S230 C8
Code 5: Start Pid Car Tuning for Hotend
In this case means E-0that the hotend should be selected and S230that a temperature of 230 degrees is the setpoint.
Now it is said to wait for the cycles to go through for the PID autotuning and the terminal indicates the corresponding feedback about the successful end, see Figure 19.
Figure 19: PID autotuning completed by the hotend
Again, the values for the PID controller are clearly displayed again, which are transmitted by means of code 6 to the printer.
M301 P15.79 I1.04 D59.82
Code 6: Set PID Constant for Hotend
It is important that the marlin command M301 It is used because this writes the PID constants into the memory. Then M500 Not forgot so that these PID constants are permanently stored in the EEPROM from the printer.
If the fan should now nerve, run code 7, which returns the fan speed 0 puts.
Code 7: Switch on the hot fan again
Calibrate the extruder
The last point in this blog and improving our print image is dedicated to the calibration of the extruder. The extruder is the part on the printer that leads the filament to the hotend. Here, too, a stepper motor is used, which it applies correctly. More specifically, the stepper motor should not be set correctly, but the stepper motor driver, which I exchanged at the beginning of this article. If you do not do this, you could quickly be frustrated because you either promote too much or too little filament and thus the print image looks more than modest.
So you can calibrate the extruder, it needs:
- A caliper
- A pen of the well recognizable on the filament is
- A software with which I can explicitly control the extruder, in my case Octoprint with the TAB control
So that you can also calibrate, the hotend must be brought to operating temperature, otherwise the firmware from the printer does not work the extruder. At the same time, since no filament should be wasted, I pull back the filament, so that the hotend and the guide hose has no material anymore.
In the next step, I take the marker and make a point for my reference point, a mark at 100mm from the reference point and a point at 120mm from the reference point, see Figure 20.
Figure 20: Filemant with marking for distances
Thereafter, the reference point is driven as well as possible to the move from the extruder, see Figure 21.
Figure 21: Positioned reference point on the move from the extruder
So that succeeds, I use Octoprint with the rider in my case controlAmong other things allows me to move the extruder, but also the individual axes, see Figure 22. However, you can also simply push the filament by hand, which can be lighter or more difficult according to the extruder.
Figure 22: The TAB control of Octoprint
Now I can withdraw the printer 100mm filament and wait for the process to finish. I use the corresponding control settings in Octoprint in the control control. The moving of the filament should not last long. If the 100mm marker is now at the beginning of the extruder, no further step is necessary, but that will not happen in most cases. Either the catchment process is stopped before the 100mm marker or thereafter. In my case, the extruder has moved 6.5mm to a lot of filament, since only 13.5mm were measured from the 120mm mark for the inlet of the extruder, see Figure 23.
Figure 23: Measurement How much filament has been moved in
So that I now knows how many steps the printer is currently accepting for 100mm, I need this steps from the printer via the terminal. With the Marlin command from code 8, the terminal delivers the desired answer, see Figure 24 red border.
Code 8: Get the current steps for the axles and extruders
Figure 24: Return for the M92 command in the terminal
This is now known that the extruder makes 405.71steps per 100mm. Now it will be time for a bit, so that the extruder steps also fit. The formula looks like this:
New extruder control = 100mm / (120mm - Measured rest) * Current steps
In my case, the formula would look like this:
New extruder control = 100mm / (120mm - 13.5) * 405.71
New extruder control = 380.95 (less than last decimal place rounded)
I take this value and copy me the output from the terminal and correct the value for E, so my new M92 marlin command looks like in code 9.
M92 X80.00 Y80.00 Z400.00 E380.95
Code 9: Submit new steps for extruders
Then a M500 afterwards and the current steps are still deposited at the next restart.
This made a big step towards perfect pressure. The printer is now quieter and can control the axes more precisely and the extruder now gives the correct amount of filament during pressure. Thus we can basically print.
In the next part I would like to introduce Octoprint a bit closer and also show the installation, as well as explain the topic of Mesh Bed Leveling. In the first part I have already mentioned what I will repeat briefly, on the other hand, to show another software-side method with the current firmware of Knutwurst. This is another tuning measure, which is only needed with curved heat boards, or believes that the pressure is still needed to improve. In addition, I would like to introduce you to Thingiverse.com print templates with which you can easily see how it is about the print quality of your 3D printer.
This and other projects can be found on GitHub https://github.com/M3taKn1ght/Blog-Repo.