Test Pattern Generator

I’ve put together an attempt at a fairly simple test pattern generator.

The idea is that it generates g-code as text that you then copy-paste into a text editor.

This draws “rulers” along one, two, or four edges of a rectangle. This is mainly aimed at seeing whether steps/mm is accurate, and also could show if it is nonuniform, or if there is “backlash”.

I’d be interested to hear your thoughts!

10 Likes

That is pretty slick. FWIW, this is the code that sandify uses to download the gcode:

link to data url. nice idea. before that I saw that usually data used for small embedded images

I’ll have to give that a shot. Thanks for the tip!

Again thanks to Jeffe for the tip on downloading g-code. Magic to me but it works.

I’ve added another test pattern that can indicate whether the surface is flat and level. It moves the pen in a “kissing” motion that lowers and raises diagonally like this:

[attachment file=100271]

The length of the line will amplify any Z variation in the surface location.

On mine, my surface is not particularly flat or level. I haven’t faced the surface with a cutter, so it is about as level as I would expect. You can see the “X” marks toward the bottom are larger than the “X” marks near the top.

[attachment file=100272]

This test pattern could potentially also indicate the presence or absence of backlash in Z, which would appear as asymmetry in the “X” marks. But asymmetry doesn’t automatically imply backlash because the pen might have funny asymmetrical behavior when the line starts vs. when it stops, so that has to be considered.

kissing_mark.png

2 Likes

As that comment suggests, it’s magic to me too :slight_smile:

Great idea. It’s a great visual.

Whoa, that is a great pattern and idea, nice!

Updating with an acceleration test pattern for X and Y.

Gradually increases acceleration using M201 and M204. I got up to 7000 and I’m still not skipping steps, so I’m not 100% sure of the methodology, but I can’t see anything wrong. With low acceleration values the acceleration was noticeably slow, so it does seem to be having an effect, unless there is some other failsafe maximum override that I’m not aware of.

Hmmm. That doesn’t look like enough. I remember it really banging around at high accelerations.

The default is 180 and I’m up to 17000 now (feed rate of 3000mm/min if that matters) without any skipped steps. Do I have to change junction deviation parameters?

Maybe it interacts with stiffness where long belts are a bit stretchy and it makes it impossible to give a super high torque on the motors because the system gives elastically elsewhere?

I will keep trying with bigger numbers.

You’re definitely setting M204 T?

I wonder if G1 vs G0 matters.

Yes, both M201 and M204, and I can’t seem to get skipped steps, even at crazy high numbers. I also flush the queue frequently with M400 because I don’t trust Marlin not to do stuff out of order.

M400
M201 X1000000
M204 T1000000
M400
G1 X6.500 Y10.000 F474
G1 X9.000 Y10.000 F671
G1 X11.500 Y10.000 F822
G1 X14.000 Y10.000 F949
G1 X16.500 Y10.000 F1061
G1 X19.000 Y10.000 F1162
G1 X21.500 Y10.000 F1255
G1 X24.000 Y10.000 F1342
G1 X26.500 Y10.000 F1423
G1 X29.000 Y10.000 F1500
G1 X31.500 Y10.000 F1573
G1 X34.000 Y10.000 F1643
...
G1 X99.000 Y10.000 F2924
G1 X101.500 Y10.000 F2962
G1 X104.000 Y10.000 F3000
G1 X101.500 Y10.000 F3000
G1 X99.000 Y10.000 F2962
G1 X96.500 Y10.000 F2924
...

I guess will have to add weight or something. Maybe I will look in the code and see if there is some other limit I’m not seeing. At the low end I can tell that it is using low acceleration, but at high values I can’t tell from the look/sound if the acceleration is actually going up.

G0 is easy enough to try. Seems unlikely, but not a lot of work to rule out.

Any chance you have a max feedrate set in Marlin? M203

Good to check.
M203 is still the default at 50 mm/s which is 3000 mm/min.
According to M503

Recv: echo:; Maximum feedrates (units/s):
Recv: echo:  M203 X50.00 Y50.00 Z15.00 E25.00

This is weird. I thought this would be a simple thing that gave an unambiguous answer. :thinking:

(G0 didn’t make a difference)

2 Likes

Can I just add a suggestion?
On the dense test make the testing traces diagonal.
Making more axis move simultaneously the more the bresenham algorithm will be forced and the time necessary calculate step pulses. This will result in less time available for parsing and planning of motions.

2 Likes

I don’t think it will make a difference, but the point is not what I think. The point is finding out objectively, and anyway I am not always right.

I’ve added an option for diagonal and it will draw the same length, but diagonally:

Thanks for the input!

In that case could I make a other sugestion to find out if there is a difference and if so what would me the most stressful?
With you current setup could you do the test with both straight and diagonal patterns ajusting the offset so that the gcode generated would match the travel distance for a single step on each axis on your machine?
Then run it to see what would be maximum achievable speed in both. By doing this the planner buffer Will be drained out more quickly and also gcode fetching Will be made at a higher rate right?

Ok I had to look up my older results because I could not remember what I had thought before, and I found it here: Many short segments

I’ll post results on that thread because it has more context for what I was doing and what I was thinking.

2 Likes

That doesn’t seem right at all. It might be junction deviation and Scurve accel. JD is super super low. Maybe turn them both off and try the test again.

Odd I thought this would be straight forward. I have used teaching tech’s generator to test my printers so but not my CNC.

1 Like

Looking at his file, maybe it is the limits you are hitting. You are raising the accel but getting stopped by the max that is set?

;customstart
G0 Z3; fix for delta printers that home at max
M201 X50000 Y50000; custom raise acceleration limits
M204 P500 T500 ; custom acceleration - A
M205 X8 Y8 ; custom jerk - A
;layer 1, Z = 0.200

From here, TT Accel

And the JD version,

;customstart
G0 Z3; fix for delta printers that home at max
M201 X50000 Y50000; custom raise acceleration limits
M204 P500 T500 ; custom acceleration - A
M205 J0.050 ; custom junction deviation - A
;layer 1, Z = 0.200