Minimum PWM Drive and Low Max PWM

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!

So between 0-5 deg error, the maxPWM is linearly scaled between lowMax and highMax?

Yes, the steps of PWM increasing with ever degree are same.
It sets the starting PWM and then adjusts the gaps.
Starting with a higher PWM the steps are smaller.
That is what i can see.

My only worry is that i will ruin my low steering values when i have to adjust the high settings for example u-turns

Increasing low max improved my steering. From snake + - 20 cm over 50 m to ± 5 over 10 m.
Admitted it is in single mode (no base) but still pass to pass is ok as I did seeding that way too.
Video show I change low max. The overlap/skips is due to the sidedraft from the 12 m weed harrow 20201001_181144striglevideo.mp4 - Google Drive


I made an Excel sheet to Draw the PWM Law of AOG Arduino code function of gain and PWM parameters (Excel sheet base on calcSteeringPID(void) function):
PWM Law.xlsx (47.2 KB)
It’s help me to understant the effect of Low Max PMW parameter on the PWM law. And more generally it’s help me to visualize the current PWM function my paramter and the impact of changing one of them.
And specially for the Low Max PWM parameter: depending on the Gain et High Max PWM, he could have a affect on the law or no effect. I have’nt understand that before.

I validated that the Excel sheet is correct by test on my test bench: it’s ok at +/-1PW (du to rounding). So normaly it’s correct.


1 Like

Thank you, The sheet made me understand I MUST get a 12 to 24 V converter (my proportional valve is made for 24 V) My Gain is set very high and that is probably why adding more Low Max helped my system in the video (there was not enough voltage to activate valve)
Added the 12/24 V converter, and now it is much more responsive.
Had to turn down both Gain and minimum PWM quite at bit, as well as Low Max PWM.

Conclusion: it is not enough thinking, that turning up min PWM can make at 24 V valve work properly on only 12 V

Don’t pay attention to the parameter to the sheet: they are parameters for my test bench.
For my Fiat tractor I’ve: Gain 25, Min PWM 53, Hight Max 200. With thoses paramater, Low Max has no influances. I just set it to 75.
I want that Low Max has an influance, I have to change the angle in the INO. Perhaps I will try.

You can maybe also change the coils to 12v coils?

That would be possible too, but I already have the 12v to 24 v converter. So will try that first.

I just redid my setting starting as mentioned below. What a difference!! This tip needs to be included in setup documentation. Just my 2cents worth.

Yes, and test in both directions of rotation


It’s cool if it could help you !
I think one improvement for AGO could be a “Minimum PWM determination mode”.
I think this mode could work like that:

  • When this mode is engage, AOG drive the motor (left or right, to be choose by the user) with only the minimum PWM value. So AOG doesn’t take accound the WAS angle, and the error, and gain etc… AOG juste send the Min PWM (left or right) to the motor

  • Before engaging this mode, the operator shall be in a field, and shall have positionned the steering wheel close to 0° angle. And set the PWM Min at a low value. Then the operator start to move the tractor, engage the motor and this specific mode. AOG will send the Min PWM command to the motor, but as we are in a low PMW value, the motor will not be able to turn the steering wheel. So the operator just has to increase the Min PWM value until a value where the motor is able to turn the steering wheel. Repeat the same on the other sight (if we start by turning left, repeat with turning right). And then the Min PWM is determined for this tractor and motor mounting.

  • This specific mode is left by the operator, he has now determined the Min PWM value and doesn’t have to change it anymore. I can go trought the orther parameters (gain, ect…) with the existing “drive mode” to determinated the remaining parameters.


1 Like

Maybe somebody can write a small sketch to be uploaded. That would not require any changes in AOG.