Visualize bed flatness with gnuplot
Even a badly-warped bed can look pretty flat to the eye. I used the following procedure to visualize my printer’s bed using gnuplot. I used manual bed leveling to measure, and I took advantage of auto-scaling in gnuplot to accentuate variance in Z rather than worrying about dimensions.
I have Marlin set to do manual bed leveling with 5 points. There’s not much point in doing this with fewer, I think.
I brought up a spreadsheet program and entered in the readings in cells that followed the boustrophedonic testing pattern, so that the readings were arranged the same way in the spreadsheet as the test points on the bed. (Note that because of the way gnuplot interprets the data, you’ll want to put the front row as the first line; visualize the data as “looking up at the bottom of the bed” and it will make sense.) I saved the readings in a tab-separated value (TSV) file, which looks like this:
-1 -0.93 -1 -0.97 -1.02
-0.8 -0.71 -0.8 -0.75 -0.72
-0.83 -0.77 -0.8 -0.74 -0.7
-0.92 -0.81 -0.81 -0.8 -0.8
-1 -1.03 -1.02 -1.02 -1.03
(I had intentionally set Z high for this test; only the variance is interesting.)
Then I plotted it with gnuplot:
splot ‘grid-5.tsv’ matrix using 1:2:3 with lines
After this, I can rotate the 3D plot with the mouse to see the variations better. Here’s how it accentuated where .33mm of total Z variance was distributed across my Tronxy X5S bed. It let me see that the middle is pretty flat, and that variance is concentrated in Y.
(All this confirms that rolled aluminum plate 330mm x 330mm hot bed looks like a lost cause and I should buy milled cast plate, but that’s another post!)
Julien Dodokal March 22, 2018 08:52
Cool! This reminds me of this new project that has a nice visual too:
Stephanie A March 22, 2018 09:35
You should compare hot vs cold.
Michael K Johnson March 22, 2018 12:28
+Julien Dodokal thanks for the link! For me, seeing the 3d surface projection is easier to visualize. I was really happy to find the gnuplot matrix mode!
Michael K Johnson March 22, 2018 12:30
+Stephanie S what benefit from checking cold, though? I never print on a cold bed anyway…
Johnny Lindén March 22, 2018 13:36
Have you locked st marlin3dprintertool.se?
Alex Koukarine March 22, 2018 14:14
Elias Bakken March 22, 2018 14:43
+Michael K Johnson You should be able to pick the bed level data right from the terminal if you are using Redeem as well. The data is transferred as a action command from Redeem to OctoPrint, so you can just copy-paste it if you are interested.
Baldur Norddahl March 22, 2018 15:35
It is not just the bed that needs to be straight. If the frame or rails are not straight it will appears as the bed is wrong. Some types of printers are very susceptible to this, although maybe not so much the cube design.
Michael K Johnson March 22, 2018 18:55
+Elias Bakken Ethernet didn’t come up when I hooked up the replicape, so switched back to the stock board until I can debug. But very good to know, thank you!
Michael K Johnson March 22, 2018 19:03
+Johnny Lindén I’m not running Windows, so not the target market.
Christoph Pech March 23, 2018 03:33
ReprapFirmware does this visualization by default.
Martin Karlsson March 24, 2018 08:41
+Michael K Johnson if the bed is flat when cold, is it possible it could be rising in the middle due to heat expansion? Looking at your data the z values in each corner is very close to each other, indicating points of attachment.
Michael K Johnson March 24, 2018 08:55
Exactly, it’s definitely expanding when heated. This is a Tronxy X5S with six (!) anchor points and you can see in the graph exactly where they are; at the corners and at the middle of the supported edge.
Martin Karlsson March 28, 2018 06:24
+Michael K Johnson Did you ever check the bed when cold as well? It could be deformed due to the position of the holes not being 100% correct. I’m thinking that the order of how one is tightening the screws might deform the bed (for instance if you tightened first one side, and then the other).
Michael K Johnson March 28, 2018 06:40
I didn’t measure it by bed mesh level but it doesn’t pass the straightedge test.
Thank you for mentioning tightening technique. I was lucky enough to have a dad who taught me really young proper technique for tightening sets of bolts or screws, so a gradual pattern is well ingrained. ☺
It’s useful to know when tightening bed screws that the thread pitch of M3 screws so often used is 0.5mm.
Martin Karlsson March 29, 2018 13:23
I mentioned it because I’m a bit suprised it could deform that much by heat expansion. I would expect that the printer wouldn’t be 100% rigid and allow some flexing where the bed is attached with screws, when the bed expands.
I don’t own a 3D printer myself (yet), so I find this problem very interesting on a theoretical level. I work as a manufacturing engineer so flatness, hole position etc is something I’m somewhat familiar with 😊 Heat expansion too, but that’s more of a couple of degrees C…
Once I get a 3D printer i will most certainly want to use your tip on using gnuplot! Thank you 😊
Imported from Google+ — content and formatting may not be reliable