Autosteer - step motors

I use second Arduino nano to convert PWM signal to STEP signal for stepper motor controller (dir is directly connected to AOG Autosteer board)

I have now upgraded to an closed loop stepper (NEMA24) with 4Nm and it looks very promising. Working on a fork of GitHub - mtz8302/AOG_Autosteer_ESP32: AgOpenGPS V5 + V4 autosteer code for ESP32. I will share the relevant data in a view days.

1 Like

First working stepper motor code is on github, based an mtz8302: GitHub - hagre/AOG_Autosteer_ESP32: AgOpenGPS V4 autosteer code for ESP32, it is waiting as a pull request to be merged into the master of mtz8302.

AgOpenGPS-Stepper Driver

I build in 2 extra hardware/electrical safety-layers with a 4x relais disconnecting the motor and simulating the the motor-coils with 2 x 10M Ohm Resistors to boot the closed loop driver without problem, and a guarded toogle switch mounted near the steering wheel to manual disengage if realy in trouble. All 4 wires are disconnected so the motor is spinning free without any force needed. The relay is disconnecting the stepper when autosteer is diasbles to prvent backfeeding current into the stepper driver by manualy rotating the motor.

A video of the working setup will follow soon.


If You use EN pin (Enable) then you don’t need this relays - driver is release coils and you can rotate engine shaft without any force and without any backfiring current :wink: . And for what You use closed loop? In example with Cytron DC Motor no need any encoder etc. Why there encoder is better?

1 Like

You are right, but …

I use the EN pin to control the driver but i don’t know enough about the internals of the stepper-driver to be certain to don’t back-feed high voltage during quick manual steering-wheel movements. And secondary to have a second layer of “disconnection” for driving on the roads… .

I have used a lot of different stepper motors to move the steering, but i had always troubles with lost steps and the flowing torque-drop to 0. I increased the torque with each new buy, but it was never enough. I tried to adjust the acceleration and maxSpeed to prevent the problem. In smooth conditions (flat and level soil) it could be set to an acceptable rotation speed for 99% of the time, but in rough conditions the values have to be reduced to an undesired level. It was always a compromise to keep a high reliability and good speed.
With the closed loop stepper the adjustment is more or less just for fun, because it is extremely forgiving. If you move the engaged steering wheel manually (you will need some force to do so) and release it again it will rotate back to the target position like a strong virtual spring. So no force from the driving-wheels on ground can interrupted the steering-control-loop. The position is always at the target position of AOG, and if there is a short “bump” it will recover imitatively. The only possible situation to have a problem, is when the max. right and left wheel angle is reached (hard-limit) and the software is not set to a correct value and would like to turn further.

I am very happy now with the actual configuration am using.
If someone would like to use stepper motors as well please start with closed loop-stepper and safe a lot of time and money.

I’m wondering if you can give me some more information on using a stepper motor, i can’t open any of the photos you included there.

Hello @Tim-98,
opening the .jpg is still working for me, but i have just add a pdf as well.

If you need more information feel free to ask!

Alright, thanks.

I’m not sure if i just don’t get along or if the Pdf is different then what i was looking for. Is it on there how you connect and setup Stepper motor on the PCB v2 two?

Diodes are wrong way on your pdf-file

I think You are correct, it was not intended to be connected to any existing PCB direct, but it is worth to think about how it could be done convenient.

Thanks. Yes the diods are somehow wrong, because the should symbol a LEDs with a resistor included in the switch. I have corrected the .pdf “AOG_Autosteer_ESP32/Stepper Driver Schematic AgOpenGPS V1_1.pdf at master · hagre/AOG_Autosteer_ESP32 · GitHub

I see you use step motor for steering. Am new to Agopengps, currently running some dc motor with ibt-2 and am not satisfied with it.
What you suggest? Is NEMA 24 that you use sweet spot or too powerful? Are you using gears on steering wheel or something else…?
Discovered your code recently and i would like to use it. Already done some testing with smaller NEMA 17 from 3d printer…

I use a closed loop stepper NEMA24 with 4Nm and a printed gear with 15:55 teeth. O.k. the setup is a little overpowered, but it can move the steering wheel very quickly to the desired position. Manually holding the steering wheel against the stepper is still possible, if needed.
The trick to get it running as wished, was to not only adjust the speed and acceleration settings in the auto-steer controller, but to tune the settings in the closed-loop stepper driver as well (speed, acceleration, allowed position-error, current, …). This was the final step to improve the over all performance to a good working configuration.

headland turn video

My current setup have dc motor that dont have low torque to turn wheel with low pwm, so when it starts turning its going fast…
Will look to buy NEMA 24/34(hybrid closed loop) as you have to start from there…
I assume you already tried open loop. Is there big disadvantages using open loop?

On first look, all the settings for closed loop seams very complicated, but in the end it makes your setup more responsive and much more forgiving to external inputs.

For open loop you have to have much more torque “reserve” from the motor (expensive) and you can never use max acceleration to avoid loosing steps, with all the resulting problems (torque loss, noise, …). Any extensive steering force introduced by a bump or so, could bring your open loop stepper into big trouble!

The closed loop is always trying to synchronize the movement with the given input signal from the auto steer. If you select a broad enough “allowed-error-window” (e.g. 90° of the steering wheel) every external (ground based) resistance/force will be corrected as fast as possible. You can hold/move the steering wheel for seconds against the motor force, when you releas it, it snaps to the correct position (helpful to avoid an obstacle along the borderline) very quickly.

You can fine tune the acceleration settings in the closed loop driver to a save value for the plastic gear (upper limit for position error correction) and select a nice responsive value in AOG/auto steer to follow the line without to much nervous wheel moments.!

Thanks for info, placed order today. Will arrive in few days.
Hopefully testing this weekend.

Done some testing today, Nema 34 4nm preforms amazing. Level of precision of auto steer is great but sometimes driver errors out every lets say 5th use of autosteer or if i disable it during rapid turning, encoder position error. I know it can be configuration of controller itself but did you faced same problem or no?

Initially, I had nearly the same. After fixing a bad power connection plug to the driver, the problem was reduced to about once an hour. I have a switch to recycle power to the driver – that was an easy way to avoid further inconvenience. Trying to only activate/deactivate the stepper during strait driving improved the performance further.
After completing the configuration of very forgiving settings in the driver, the best step to do, I had nearly no problems any more, without paying attentions to the driving conditions during on/off switching.

Thanks for info.
Will try to play with setting on stepper controller more.
Will try to maybe connect relay to driver power and autosteer(enable) button to power it on and add delay for commands for second… so it will powercycle any press of autosteer enable. Will see…