stahlfabrik
Posts: 638
Joined: Sep 11, 2017 5:14 am
Topics answered: 3
Contact: Send private message

1st layer problems - in depth look at software PINDA problems (and solutions!)

Mar 09, 2018 8:49 pm

Hello my name is stahlfabrik, and I have problems. With my PINDA.

TLDR:
1. There is IMHO a nice bug in the MK3's firmware that combats the possibility to achieve repeatable first layers.
2. You need good temperature calibration. There is no way, that the MK3's firmware currently provides, to achieve good temperature calibration. The stock temperature calibration values are way to high.

This gets technical:-)

So what does this all mean?

Let me introduce you to the technical background. The PINDA probe is an inductive sensor which triggers when a certain distance threshold to the heatbed has been reached. The MK3 uses that information to home it's Z axis and to perform mesh bed leveling. These type of sensors react to heat: when they get warmer, they trigger later/lower. The MK3's pinda has therefor a thermistor inside, so the software can read the temperature and account for the effect the temperature has on the triggering distance. The idea is that you calibrate Z once and then: "Happy printing."

So how does (should!) it work? There is a small table in the EEPROM of the printer where for certain temperatures the offset is stored, that the software needs to add to nozzle height (or the measured mesh bed level compensation values) to achieve the same "Live Z value" no matter what the temperature of the PINDA is.

So the bug that I found, as described in my pull request is easily explained: instead of using the compensation table that is stored in the firmware to counteract the physical effect that the temperature is having on the PINDA's triggering height, the opposite happens: it adds the calculated offset in the opposite direction making the MK3 super temperature sensitive. So when your printer is nice and warm and ( - under pain and struggle - ) you managed to get a decent first layer, let the machine cool down completely. Start a new print and because the PINDA had no chance to reach the old warm temperature, the Live Z value is way off (the first layer hardly sticks to the bed because it is too high).

Here is a link to my pull request for this issue: https://github.com/prusa3d/Prusa-Firmware/pull/514

So that is one big part of problem. Let's all hope that Prusa Research will acknowledge and fix that bug soon.

The second part of the problem is the temperature compensation table. It's values are of course defined in the firmware and are the same for all MK3s. I have got the grey PINDA (I hope Prusa did not switch from black to grey PINDA because of that bug...) and the temperature calibration which are optimal for me (see below) are WAY different then the stock values.

So let's talk about the temperature compensation table.

In the EEPROM there are for certain temperatures (35, 40, 45, 50, 55, 60C) stored the offset the printer has to take into account for doing the compensation of the effect the temperature has on the PINDA's triggering height. The unit of the offset is "usteps". The temperature intervals are "hard coded" and cannot be changed in one place. (Spoiler alert: I absolutely think that my PINDA might be colder than 35C when I start a print so Prusa should possibly grow the temperature range to 30-60 or even 25-60C! More about that below)

So lets see the stock values. These are:
35C - 0um - 0usteps (the lowest temperature offset always must be 0, so it is not saved in EEPROM)
40C - 20um - 8usteps
45C - 60um - 24usteps
50C - 120um - 48usteps
55C - 200um - 80usteps
60C - 300um - 120usteps

So far so good. The basic idea is: adjust live Z at 35C degree PINDA temperature and when you later start a print with 50C PINDA temperature just add 120um to the live Z value internally, so the user does not have to dial up live Z, to avoid the layer to be to squished. Of course - mind the bug which internally subtracts 120um which leads to a very squished first layer. That is the basic idea of how it works. Between the temperature steps the offsets are interpolated.

I hope you see the importance of correct temperature compensation offset values in the EEPROM table.

With my bugfix, printing PLA was quite OK, but when I did ABS (bed at 100C) the PINDA was warmer than while printing PLA (the PINDA cannot get warmer than 45C when printing PLA I would say from the tests). In fact the PINDA indeed reaches 60C when staying over the 100C bed. So the high PINDA temperature now lead to a too strong compensation - so the 1st layers became higher and higher the more the temperature of the probe rose.

So I knew: My bugfix seems to work, but the calibration values are bad. So I looked into the "experimental and optional" temperature calibration routine. Yes, it is experimental. But it is absolutely not optional. The problem is the results suck for me quite a bit! After it was done, ABS was still printing bad and now PLA was bad, too.

I did it 5 times to get mean values for each temperature level, and the results were surprisingly different than the stock values - but as mentioned far from optimal:
35C - 0usteps
40C - -2usteps !
45C - 5usteps
50C - 11usteps
55C - 22usteps
60C - 37usteps

So I needed to come up with my own temperature calibration methodology. So where do you start? The stock software is absolutely lacking everything you need to accomplish this goal: You CANNOT read nor set the temperature calibration offset values in the EEPROM manually.

So I came up with the idea that I need two things:
- a new GCODE that waits until the PINDA has reached a certain temperature (Pull request: https://github.com/prusa3d/Prusa-Firmware/pull/542)
- a new GCODE that lets me read, reset and set and also zero out the temperature calibration offset values in EEPROM. (Pull request: https://github.com/prusa3d/Prusa-Firmware/pull/543)

I must confess the code quality of these GCODEs could be enhanced for sure. I have not programmed GCODEs before. But they work fine for me! Everybody is welcome to contribute and the devs at Prusa research should have an easy time to incorporate those. Again, lets hope Prusa Research will look into these tools and provide this or equal functionality into the official firmware soon.

So the test took a few hours but was very straight forward but cannot be done without the custom software:

The first step is to deactivate the temperature compensation completely. For that I commented out the buggy line of code. But zeroing out the temperature compensation table in the EEPROM should have the same effect. As a second step I took a .gcode file with a nice big first layer where the print head moves from left to right (so I could see the first layer quickly sitting on the left side of the printer). I pimped the startup code so that the printer homes its axis TWICE: One time at the beginning, the second time when the PINDA has reached a certain temperature. After the second homing the mesh bed leveling is done and the print starts. I added a few movements between the homing actions: First I raise Z 5cm so the PINDA does not heat before the bed has not finished heating. The second movement happens when the bed has heated up. I then move the nozzle to X5cm Y5cm Z0.15mm so that the PINDA gets warm effectively while waiting.
You start a print with using the custom waiting GCODE and dial in Live adjust Z to the optimum value and note the live z value down. You do that with the material of choice. I used Prusa grey PLA because it is easy to dial in live Z - I dialed it in so that the splits between the lines JUST vanish - you need to repeat and achieve that level now a few more times. You repeat that live z tuning now for PINDA starting temperatures of 35C, 40C, 45C, 50C, 55C and 60C (after 45C you need to turn bed heat up to be able to warm the PINDA enough). Note the live Z values down for each temperature. Just for the fun: repeat a measurement and be ASTONISHED that you can directly dial in the noted value it will be perfectly OK (the PINDA is able to deliver repeatability!). I got these values for MY pinda (yours should be maybe different - let's share our values to determine better stock values!!):

35C - -0,822
40C - -0,810
45C - -0,795
50C - -0,795
55C - -0,787
60C - -0,790

So get out your calculators out as you need to compute the ustep values now:
Example:
35C is the reference, easy: ustep is 0
40C the difference to 35C is 0.012mm. Multiply that by 400 (steps per millimeter the MK3 uses) and you will get 4.8 which rounds up to 5 usteps.
And so on.
So I got these ustep values that I stored to EEPROM using my custom gcode.

These are the ustep values I found that work for ME:
35C - 0
40C - 5
45C - 11
50C - 11
55C - 14
60C - 13

Compare these to the stock values - isn't that crazy? It is not even increasing steadily and for 60C the stock values compensate 9-times more than necessary - that is why I still failed to print in ABS! The build in temperature calibration function delivers values that still are 3 times more overcompensating...

So I set the EEPROM values to the manually crafted values and LOOK at my two PLA prints: I did NOT touch live Z - I set it to -0,822 in the settings before I started the first print. I started a print with 35C pinda temperature, came out perfect as expected. So now the GREAT question: does my bugfix even work (I am still waiting for official feedback if I am heading in the right direction!). So I started a print with PINDA temperature of 55C - AND IT CAME OUT PERFECT! So yeah - I prooved myself that the bugfix fixes the bug.
IMG_1434.jpg
IMG_1434.jpg (1.59 MiB) Viewed 7373 times
IMG_1435.jpg
IMG_1435.jpg (1.69 MiB) Viewed 7373 times
See an example GCODE snippet in my pull request.

What I would hope Prusa Research do now quickly:
- Fix the bug in the offical software
- Incorporate the GCODE to wait for a certain PINDA temperature ASAP in the official firmware as well. Because we need the PINDA to be at least 35C warm at the beginning of each print! The temperature range below is not defined! Also, of course, for manual temperature calibration it is needed very, very, much.
- Incorporate GCODE - and later - EVEN BETTER: A menu - to let the user read and set the temperature calibration offsets in the EEPROM.
- Increase the PINDA temperature calibration range to temperatures below 35 C. My room often is 16C, when the print starts, the PINDA is not much warmer than 20-25 degrees - so the offset is not defined!
- Show pinda temperature on main screen on LCD
- Maybe come up with a better way to do the temperature calibration automatically.

What have we learned:
1. Use a firmware that combines the bug fix as well as incorporates the tool you need to do a manual temperature calibration. Otherwise you will not improve stuff completely.
2. Never start prints with a PINDA cooler than 35C - the provided gcode makes that easy
3. Open source for the win. I would be soooo mad with the machine if I would not have been able to fix this. Finally it works as advertised.

Cheers! And happy printing for real this time.

(I added my last firmware build which contains all three pull requests. Use at your own risk and do not blame me!)
Attachments
Firmware.ino.rambo.hex.zip
(220.31 KiB) Downloaded 84 times

BEST ANSWER by stahlfabrik » Aug 21, 2018 12:06 pm
We wrote a how-to article on the prusaowners.com wiki on that topic.

Have fun:

http://prusaowners.com/wiki/index.php?t ... alibration

GO TO FULL POST ➙
Last edited by stahlfabrik on Mar 09, 2018 9:29 pm, edited 1 time in total.

Steven
Posts: 36
Joined: Jan 08, 2018 4:36 am
Contact: Send private message

Re: 1st layer problems - in depth look at software PINDA problems (and solutions!)

Mar 09, 2018 9:03 pm

I don't have my MK3 yet but I want to thank you for your hard work!

stahlfabrik
Posts: 638
Joined: Sep 11, 2017 5:14 am
Topics answered: 3
Contact: Send private message

Re: 1st layer problems - in depth look at software PINDA problems (and solutions!)

Mar 09, 2018 9:05 pm

Cool, you are very, very welcome!

stahlfabrik
Posts: 638
Joined: Sep 11, 2017 5:14 am
Topics answered: 3
Contact: Send private message

Re: 1st layer problems - in depth look at software PINDA problems (and solutions!)

Mar 09, 2018 9:24 pm

LOL I just started a print below 35C even though I told you not to do so! Et voila the first layer was a little to high. DO NOT ADJUST but abort. Started again at 35C, perfect first layer...

john.n13
Posts: 110
Joined: Nov 20, 2017 6:39 pm
Topics answered: 1
Location: Cleveland, OH, USA
Contact: Send private message

Re: 1st layer problems - in depth look at software PINDA problems (and solutions!)

Mar 09, 2018 9:29 pm

This is really good stuff. I'll test and report soon after I have, and have built, my printer. Thank you for taking the lead in this classic commissioning trials exercise. It will be interesting to see the level of commonality between PINDAs as the data accumulates.

luke.m9
Posts: 29
Joined: Dec 13, 2017 12:16 am
Contact: Send private message

Re: 1st layer problems - in depth look at software PINDA problems (and solutions!)

Mar 09, 2018 9:40 pm

Man, this is just some quality stuff. I cannot wait to see the development and future first layer quality as a result of this work.

User avatar
Brigandier
Posts: 424
Joined: Sep 24, 2017 5:17 pm
Location: USA, Arkansas
Contact: Send private message

Re: 1st layer problems - in depth look at software PINDA problems (and solutions!)

Mar 09, 2018 10:49 pm

Great troubleshooting, this is some damn good improvement.

Saw on one of Josef's blog posts:
If you got ideas similar to this, do not hesitate to e-mail us with them via e-mail and “Firmware improvements” subject, so they can get to our developers.
Anyone know the email address? Let's all notify them, they seem to ignore the forums.
My MK3 Parts: [Bowden] [New Shoes] [TPU Micro Springs]

daniel.s63
Posts: 17
Joined: Feb 15, 2018 4:12 pm
Contact: Send private message

Re: 1st layer problems - in depth look at software PINDA problems (and solutions!)

Mar 09, 2018 11:05 pm

Hi, stahlfabrik (and many others),

I must say I'm feeling quite guilty of reaping the benefits of all the blood/sweat/tears of you guys/gals who have been plowing through these issues (I won't receive my printer until April). I thank you from the bottom of my heart and hope to repay your kindness. :-)

Thank You!

-Daniel

stahlfabrik
Posts: 638
Joined: Sep 11, 2017 5:14 am
Topics answered: 3
Contact: Send private message

Re: 1st layer problems - in depth look at software PINDA problems (and solutions!)

Mar 09, 2018 11:33 pm

No neat to feel guilty:-)

Thank you for the kind words.


About the email. Yeah sure! Make yourself heard if you think the bug fix and calibration method works for you!

I did the pull requests, postet here, linked on Facebook wrote my main support guy at Prusa and even @mentioned Jo on Twitter.

Spread the word. If you know how to program let’s work on refining this stuff. I would like a menu for setting calibration so badly. And a semi automatic routine like for 1st layer calibration using 6 stripes to manual adjust live z, pauses to reheat through the temp steps and intermittent z rehoming would be feasible and ultra cool. One would not have to re mesh level. Rehoming z would be enough I think.

jettoblack
Posts: 76
Joined: Sep 12, 2017 9:23 pm
Contact: Send private message

Re: 1st layer problems - in depth look at software PINDA problems (and solutions!)

Mar 09, 2018 11:55 pm

Thanks for all the hard work, looks like you are on to something for sure.

This may explain why those of us in cooler rooms have a hard time getting a good 1st layer. My room is around 22C / 68F, so if I don't intentionally warm up the PINDA before printing, the first mesh point will be read with the probe temp still around 22C. Then it starts to warm up as it hovers close to the warm bed during probing subsequent points. Calibration doesn't kick in until 35C so those subsequent points have different temperature variances but aren't getting any calibration adjustments. Either the temperature table needs to be extended to cover colder temps, or as you said, the PINDA always needs to be warmed up to at least 35C before probing.

Return to “Hardware, firmware and software help”

Who is online

Users browsing this forum: No registered users and 1 guest