Skip to content

December 23, 2017

Marlin Firmware Fishing – Delta Bait

While it seems like only yesterday that I built my two delta printers, in reality it’s been almost three years. Or in “printer” years, just under 4,000 hrs.

I read that to be an expert it takes 10,000 hours of practice. Of course there’s a number of scientists who now will question that claim from 1993, my guess is they’ve probably spent more than the allotted 10,000 hrs disproving it, so maybe I’m further along than I think.

Or not.

Marlin 1.1.6

Having ripped the hood off Marlin 1.1.6 in the last month, I’ve learned a whole bunch about how it works, or more specifically why it does it does.

When you get down into the innards you find, that for a delta, at least, there’s a lot of trade off’s going on. Mostly due to the 8 bit processor that runs the whole thing.

For delta style printers, the LCD rotary button is hit and miss. When the printer is running. When the printer is idle, the control is very responsive. Why? Mostly it’s to do with the way Marlin figures out where in the world it’s supposed to go to. And we don’t help it any in this matter.

Marlin Planner

The bottleneck is the planner and our quest for quality output from these plastic droolers.

For example, let’s take a slow world example. We are printing a perimeter in slow motion, the long edge is 200mm long and we are moving 1mm per second.

Short math says this is going to take 200 seconds. I.e. 1mm/second, 200mm length.

With your stepper motor you have “steps per unit(mm)”, and in most of the printers (16x set stepping) it will be set to 80. So the move will be 80 * 200 = 16,000 steps long.

Good to this point, but now for the ultimately accuracy we have a setting in Marlin that looks like this:

DELTA_SEGMENTS_PER_SECOND = 200

So our original 200 seconds, gets expanded: 200 x DELTA_SEGMENTS_PER_SECOND = 40,000 segments total.

Each of the segments is 16,000 / 40,000 = .4 steps.

Marlin then feeds these segments to the planner. But the planner has a minimum number of steps it will use, anything shorter than that is handled differently. Way back in the early days it was set at 5 step minimum, with 1.02 and newer it’s set at 6.

So, the first segment is handed to the planner, but at .4 steps it’s too short, so it’s set aside, then the next, and so on until the total gets above the minimum. I.e. we have to hand it 15 steps to finally get it to move. Then that gets repeated all again until it can move again.

Should the planner get full, that’s when it actually goes out and checks the buttons on the LCD, updates the heater check (part of the watch dog timer), and a few other things. Which is why we find that on long straight slow runs the LCD seems unresponsive. But on fast cubic infill it’s the other way around. It’s all keyed off the planner.

So you can see, Marlin’s planner spends most of it’s time just reading and accumulating these little short steps until it gets to a point where it can plan a move.

This is why the majority of times where an end user complains about the LCD being somewhat unresponsive, the developers first retort is to “lower your DELTA_SEGMENTS_PER_SECOND”. The suggested number is 160. That results in a .5 step segment, we end up with 16,000 / 32000 = .5, and we’d have to feed the planner 12 segments before we hit the minimum and get a planned move.

Marlin Code Enhancements

The Marlin developers have gone to great lengths, considering it’s open source software, to ensure that not only everything that used to work, either works the same or better, but when they get handed a problem, they do their utmost to fix it.

In the planner “move” and “arc” routines there are now calls to the idle and watchdog timer to ensure everything keeps working. This means that generally the LCD and rotary encoder are fairly responsive even if you crank up the delta seconds. To a point.

Side Effects

It’s pretty easy to see just how much that DELTA_SEGMENTS_PER_SECOND number can affect the planner. When you’ll find as a side effect is the LCD becomes more responsive, and the printer will sudden print slightly faster on exactly the SAME print as it did previously.

During my tests, I changed values in the firmware, then run a worst case against it to see what damage I can do, I found a number of interesting things.

I found I could cause stutters in straight lines or on curves. Mind you it’s hard to see the printed results with the naked eye but with a microscope I have, it wasn’t hard to see the little blobs show up.

I also found that while straight lines worked for almost any setting, doing curves was more exacting. Stutters and pronounced lines in the curves were evident. Especially on high Delta settings at fast speeds.

Speed

Here is where things get interesting. Speed on a delta, set in your slicer, means, nothing. If you set the speed for a perimeter for 50mm/s, what you might get is, ah, well, who knows. I don’t. Not sure anyone does.

I’ve seen the YouTube video’s where the video is proclaiming some massive speed on a delta. Like 300mm/s. But really, it just means, fast. Again, no idea how fast. Just fast. Not sure how’d you even figure out how fast.

I know, the slicer sets the speed and the firmware should follow it. Yeah, nope.

On Delta printers the feedrate, jerk, acceleration, limits, etc. are applied at the steppers level and not to the Cartesian position. There’s only an indirect proportional relationship between the speed of the carriages and the speed of the effector.

Or, as you might surmise, two, very, different, things.

Smooth Sailing

The printer will always, and I mean always, print smoother from the SD card. A computer or print server like Octoprint/Astrobox tied to the USB of the Mega will never be as smooth. And by changing some of the firmware I can make it worse. A lot worse. Easily.

Looking at the LCD, if it’s updating fairly quickly, the planner is really working well. If not, it’s getting buried by math.

Stepper Motors/Drivers

Next up we get to stepper motors. All equal. Nah, probably more solid state than equal. Another foggy area. Seems the conventional thinking is use the biggest driver we can get. Like the DRV8825. Even with it’s built in bugs of missing steps. Add that to the stepper motor accuracy and suddenly you begin to see why 100 microns is the best you’ll ever get without major tweaking.

So you “hack” the 8825’s for fast decay, end up with a screaming chicken. Or you decide to use the TMC2100’s with their “silent chop” mode. And unless you crank the current on them, they tend to skip steps. But when you crank the current everything runs warmer. Trade offs.

Oddly enough, the best driver for the delta’s is the lowly A4988’s. Of which there are a number of versions (the versions being the values of the adjustment pot and the current sense resistors). The 4988’s are not great for heavy carriages like Cartesians are pushing around, hence the popularity of the 8825’s. But for a delta, even with a fan setup like mine, it can get quite interesting.

I set the current on my 4988’s to 400ma. Just because I could. I couldn’t hear the printer run from a nearby hallway. Turns out a lot of the noise we hear is the steppers being driven by heavy current. At any rate, I only got about 6 layers of a design when the hot end wandered off to sky print. I’ve been running them for almost 100 hours now with 800ma and never missed a beat. My guess is that 600ma or more of current is enough to hold the delta hot end in position.

Another oddity I found was that when I swapped out the 8825 for the 4988 at the extruder, I got more extrusion from the 4988. With the 8825 I got 99.7mm pretty consistent. With the 4988 swap and no other changes I was pushing 102.3mm. The 8825 does drop steps, as noted, and there is a 3 – 5% error rate on each rotation of the stepper motor. Still strange.

Just so I wasn’t going balmy, I did the same driver swap on a second delta. Same result. Had to re-level and drop the extruder steps.

4988’s are now all I’d recommend for the average delta.

Accuracy

Everything comes at a price, with delta printers, because of all the calculations, accuracy and speed are the prices. For example, if you never used the LCD for anything, disabling it in the firmware helps speed up a bunch of things because there’s nothing to do when Marlin would normally be busy updating the LCD.

Printing via USB from Octoprint, Astroprint, Repetier Host, Pronterface, really, what is the LCD doing? All the info is available from the printer server or the application on the computer.

If you want speed, drop the Delta Segments Per Second. But like they imply, speed does not always equal quality. Ever. Quality? Slow the printer down. Increasing the Delta Segments does this artificially because of the increased number of calculations.

I’d love to say there’s an easy way to get max speed, with max quality. Truth is, it’s all a trade off. You just have to find what works for you.

Currently I’m using Marlin 1.1.6, tweaked for a delta by me, and I’m using 120 Delta Segments Per Seconds and the printer has never been faster or printed as nicely. So I gained both some speed and quality mostly due to the minor software mods I have in Marlin.

Summary

Tinkering and doing “what if’s” has always fascinated me.

If it breaks, I can restore or fix it, no big deal. The amazing things you learn in the process is where the fun lies for me. So I’m well on my way to the 10,000 hour point…

Read more from 3D, Electronics

Comments are closed.