Minimum PWM Drive and Low Max PWM


I have two questions about Minimum PWM Drive, following the last video of Brian about new functions Low Max and High Max PWM.
With this new configuration, it’s not clear for me when AOG will use the Min PWM setting.
What I understand:

  • When the error is >5°, AOG will use the High Max PWM setting.
  • When the error is <5°, AGO will, function of the error, interpolate the PWM value between Low Max PWM and High Max PWM → As close as the error is close to zero, the PWM value will be close to Low Max PWM
  • And if error = 0, PWM = 0.
    But in what case AOG will use Min PWM as the PWM value ?

The Minimum PWM value is the minimum PWM requiered to move the steering will: i.e minimum power requied to overcome the motor friction and all the steering weel friction to drive the wheels.
What the good method to dertimine this value ? I saw on Brian video that the gain was set to 1, an error applied and the Minimum PWM value is increased until to be enought to drive the steering wheel.
Is this the right method to use on a tractor for setting up this value ?




The minWM is the lowest value sent when the motor is required to move. Example minPWM is set to 30, LowMax set to 50 and HighMax set to 200.

If the motor needs a tiny nudge it will get like a pwm of 31. ( 1 plus the min 30). Now if the gain is cranked up and you have little error, the range of pwm will be between 30 and 50. As the error increases, to greater then 5 degrees the range will be between 30 and 200.

The minPWM is still the lowest value sent, the maxes sent will be the max at the appropriate error at the time. I know, lowMax seems like a minimum, but it is the upper limit when error is low.


Hello Brian,

Thank for your answer. More clear for me now.

Do you also agree with the method to adjust the Minimum PWM Drive i.e: set the Gain to 1, and increase the Minimum PWM Drive value until the motor has enought power to turn the steering wheel (using the drive test mode from the autosteer configuration) ?



yes pretty much. Too high and it will oscillate or move when it shouldn’t. its smoother a bit lower then moving on its own

Hello Brian,

One question : sometime on the steering chart, I have observed this type of behavior (sorry not recorded on video so I made a schematic of it):

I interpreted this as a symptomatic behavior of an adjustment with a too low PWM Drive: did you agree with that ?
Like AGO command a PWM but it’s too low for driving the motor until the error is enought to produce a sufficient PWM for moving the motor and merge with setpoint.
So I increases the minimum PWM drive but the marging between the disappearance of this phenomen and the appearance of a oscillation is very tight.

Also sometime I have a strange behavior: AOG this shift like 10cm of the line, but take realy long time to go back to the line. Don’t know why: I look at the steering chart but the actual angle is at the setpoint angle. So it’s seems not being a problem with the steering parameter. It’s like AOG does’t setting up an enought steer angle to the Arduino to go back to the line.
I check the centering of the WAS: it was good, 0° = driving straight forward.

Running AOG with RTK Fix, Stanley with both parameter at 1. MMA8552 of, BNO On.



The trouble with using a computer connected to gps and then the steer module is delays. we wait for gps, then do some math and then send corrections to the autosteer module. the motor takes time to speed up, and that is some of the delay you see. Roll gets sent back and tries to correct the next incoming gps position.

In commercial systems, its all in one place - but there still is the delay of getting all the steering moving.

1 Like

Continuing a bit to this one regarding setting up a hydraulic valve. I have a Danfoss valve with the following characteristics:


The coil nominal resistance is 4.75 Ohm, so I roughly figured assuming everything is ideal
and assuming 13.8 volt supply voltage from the tractor:

  1. Valve spool starts moving with 580 mA which gives a voltage of 0,58*4,75 = 2,755 V, which equals 20% duty cycle, so ideally I should set Minimum PWM drive around 51

  2. With the same logic, 1000 mA should give maximum spool stroke at 35% duty cycle, or around a setting of 88

So I have 88-51 = 37 usable values for PWM in the whole range of motion for the valve spool. Bit of theoretical thinking, but does it make sense to calculate it like this? Was thinking about the resolution for the gain, now there’s only so many meaningful steps for adjustment, probably easy to adjust with the gain multiplier in the arduino coe, though.

Tested yesterday on the tractor and seems very sensitive and easily starts oscillating pretty heavily, probably because I had the gain too high and minimum PWM set too low. Gives sort of deadband and then steers very rapidly when the error gets too large.

Can you limit the hydraulic flow to allow more range?

Could be an option, the spool is quite low flow though, 10 l/min max. Tried playing around with the hand lever and the steering speed feels quite OK, will need to do some more testing this weekend with the settings.

Tested bit more, and the 50 min PWM drive was quite much spot on, if lower than 47-48 the steering starts to lag behind in the graph. Gain, however, is usable at 3-4 maximum, got it to steer OKish with this setup. The steer chart looks kinda jagged though, and the steering feels quite aggressive. Already with 65 PWM the wheels are turning quite fast…

Edit: Some digging shows that the spool maximum travel can be limited with set screws mechanically. Still, the resolution remains quite bad, as it’s limited by the spool travel. With D9 output I should be able to use the 16 bit PWM in arduino, that could maybe help? Of course having to physically swap pwm1/2 on the board as well

A physical spool limiter won’t get you better PWM resolution. You need a smaller valve or maybe lower pressure?

Yes I know, that’s why I was thinking of going to e.g. 10 bit on the pwm. With the drive mode it works quite nice already, but gets wild when trying to follow a line.

Here’s what the steer chart looks like. So it’s only a couple of PWM steps that it’s using but follows the manual commands quite nicely. The resolution is just missing in the sub-degree corrections as the gain needs to be so small.

The valve is pressure compensated so dropping pressure just makes the wheels not turn at some point.

@nut when I look at your video I would say the Low Max PWM of 53 is maybe not enough
Low Max PWM is the max pwm used when the correction is less than 5 degree I think.
You can see how it react when you set the steering to 4 deg and press >0<

For the Gain 3 is maybe good. Maybe 2 is better for not over shooting after large corrections.
I use a Gain of 4 or 5 with my Hydraforce, theoretical min and max PWM are 64 and 182.
I use 54 as Minimun PWM Drive

I set the Mimimun PWM Drive hi enough to make the wheels move with 1 deg steeps.
If you can see AOG sending PWM for a little correction (less than on deg) and the wheel not moving the min PWM drive is not enough.
I do this in drive test mode at low speed (1km/h)

1 Like

Gotta give it one more shot. Neighbors are soon starting to think I’ve gone crazy driving back and fort round the yard with a wiggly steering :upside_down_face:

Could go down one spool size to 5 l/min as well. And will try to implement the higher resolution PWM as well if the rainy season continues…

1 Like

Did some editing to the .ino, still to be tested but I think changing the PWM resolution should be quite easy (given that the code actually works :grin: )

I used the Timer1 library and changed

  //analogWrite(PWM1_LPWM, pwmDrive);

And modified all the limits by a factor of four. Now I should have four times more resolution for the gain. Just need to swap pins for pwm1/2 on pcb connector

One could also directly edit the registers but this would be minimal modification.

Hello everybody, please let me hook in into the start of this topic.
I have watched Brians video but there is a case that i absolutely do not unterstand.
If I understood correctly the Low Max PWM is a boarder that is never overtaken if the Error is below 5°.

Watching the Video at 10:17min there are the following setting:

Proportional Gain 200
Minimum PWM Drive 6
High Max PWM 101
Low Max PWM 20
Error 2°

Output PWM -53

How can this -53PWM happen if the Low Max PWM is set to 20?

Thanks a lot

here is what I found in the usb arduino code v4.3.10

 if (errorAbs < LOW_HIGH_DEGREES)
    newMax = (errorAbs * highLowPerDeg) + steerSettings.lowPWM;
  else newMax = steerSettings.highPWM;

steerSettings.lowPWM is Low Max PWM
steerSettings.highPWM is High Max PWM
highLowPerDeg is (High Max PWM - Low Max PWM) / LOW_HIGH_DEGREES
errorAbs is error in deg?
LOW_HIGH_DEGREES is 5? Not adjustable?

this give under 5 deg
max possible PWM= (angle error x((High Max PWM - Low Max PWM)/5) + Low Max PWM
else max possible PWM = High Max PWM

so your case this would give (2x((101-20)/5) + 20 = 52

So this is only a factor, not the real max PWM under 5 degrees.
at 5 deg it can output the Max PWM
It will have more effect at 1,2, or 3 degrees.

Thanks Pat,

I can follow your description.
That means for an error of 1° the output PWM can be adjusted between a ratio of 1:5 ( if lowMax PWM is set to 0) and 1:1 (if lowMax PWM is set same as highMax PWM).

I`m thinking about if it is a good idea that the output PWM limit below 5° depends on the highMax PWM.
What if I set a really high highMax PWM, let say 200, for U-turn. LowMax PWM is only set to 1 so i get and max output of 40,8 at 1°.
Gain is for example 10 and minimumPWM drive 20. So i have the output of 25PWM (20+10÷2)
In this case the lowMaxPWM has no effect, so we have to pay a lot attention on the highMax value.

I think about if there is a systematic way how to adjust these settings.

Ok, I have thought about it a little more.
Please correct me if I am wrong. The Gain is the PMW value of 1° error?
If i set gain to 10 at error 10° pwm output is 100 at error 11° pwm output is 110.
Why not use the lowMax PWM independant from the highMax?

For error 0°-5°:
Max possible PWM= angle error x lowMax PWM + min Drive PWM

So changing the highMax has no effect on it and if i increase the required minimum PWM the increase of speed keeps same.

What do you think?

From what I see in the code, I think so, constraint between Minimum PWM and newMax.

I think the actual code can be great, you will never have a big step between 5 and 6 deg error.
It’s maybe a good explication of the Low Max PWM setting that is missing.

I think that is what we have to know when setting LowMaxPWM, so I will recheck my settings!