Stepper 28BYJ loosing steps

Support for Arduino in combination with Air Manager and Air Player

Moderators: Ralph, russ

Message
Author
marcel_felde
Posts: 140
Joined: Wed May 09, 2018 12:19 am

Stepper 28BYJ loosing steps

#1 Post by marcel_felde » Thu May 06, 2021 6:36 pm

Hello everyone,

After wasting nearly a day on a possible problem with my hardware, I found out, that the 28BYJ is loosing steps when the motor is moving slowly.
I did a test-setup to verify this:

A script that turns the stepper 90°every 5 seconds resulted in a very precise position of the needle over long time.
Using the same setup with the N1 variable of XP results in loosing steps in moments when the needle moves slowly. It just does not move on tiny and slow N1 changes.

I tried three steppers and two ULN2003 drivers. Same results.

Air Manager 3.7.1 and this script:

Code: Select all

stepper_test = hw_stepper_motor_add("4WIRE_8STEP", 4096, 60, false, "ARDUINO_MEGA2560_A_D8", "ARDUINO_MEGA2560_A_D9", "ARDUINO_MEGA2560_A_D10", "ARDUINO_MEGA2560_A_D11")


-- DATA --
function xp_data_callback(value)

   position = value[1] / 103.6 --115.6
   hw_stepper_motor_position(stepper_test, position )
   
end
xpl_dataref_subscribe("sim/cockpit2/engine/indicators/N1_percent", "FLOAT[8]", xp_data_callback)
I did also try 4WIRE_4STEP with 2048 resolution.


Is this a bug or is something wrong on the code?

Thanks and greetings,

Marcel

marcel_felde
Posts: 140
Joined: Wed May 09, 2018 12:19 am

Re: Stepper 28BYJ loosing steps

#2 Post by marcel_felde » Thu May 06, 2021 8:58 pm

Did some more testing:

With a 100ms timer: loosing steps very obviously.
With a 200ms timer: loosing steps, not so obvious but several degrees after a few movements.
With a 500ms timer: No step loss visible yet. But I did not test very long.

But even with 200ms movement is very jerky. With 500ms it is not usable at all..

User avatar
Ralph
Posts: 5105
Joined: Tue Oct 27, 2015 7:02 pm
Location: De Steeg
Contact:

Re: Stepper 28BYJ loosing steps

#3 Post by Ralph » Fri May 07, 2021 2:13 am

What we noticed is that this motor doesn't necessarily have 4096 steps. I had to play around a bit to find the number that fits this motor. That's why a calibration sensor is important. It is cheap Chinese hardware, so you shouldn't expect too much.

User avatar
Ralph
Posts: 5105
Joined: Tue Oct 27, 2015 7:02 pm
Location: De Steeg
Contact:

Re: Stepper 28BYJ loosing steps

#4 Post by Ralph » Fri May 07, 2021 2:16 am

Oh by the way, a speed of 60 is way way too much. Its maximum is under 20, closer to 10 even if I remember correctly. If you go too high then it indeed will loose a few steps and become jerky.

marcel_felde
Posts: 140
Joined: Wed May 09, 2018 12:19 am

Re: Stepper 28BYJ loosing steps

#5 Post by marcel_felde » Fri May 07, 2021 3:52 am

Thanks Ralph!

Would you suggest another stepper? The X27 type motors have to little torque for many applications.

I did setup the resolution to make a complete 360° turn with the value of 1.0 . 2048 results in a half turn. 1024 in a quarter. The speed is fine, other values are too slow.
And as I mentioned: When I do make the stepper turn 90°, pause, turn further 90° and so on, with full speed, it works absolutely fine. It just looses steps when I do use a XP dataref that gets slower and the end of the movement, the N1 for example.

When I do restart the script or inject a value for the variable, it works fine everytime and is precise. It is just a matter of the smaller and finer movements of the needle.

User avatar
Ralph
Posts: 5105
Joined: Tue Oct 27, 2015 7:02 pm
Location: De Steeg
Contact:

Re: Stepper 28BYJ loosing steps

#6 Post by Ralph » Fri May 07, 2021 7:48 am

Assuming you're using 4.0, did you flash the Arduino with the latest firmware?

The x25's and x27's are very fast, but indeed not powerful. Not that precise either, but better than a servo :) Flight Illusion uses mainly VID stepper motors, which are better, and maybe the real Juken Swiss motors are even better.

The 28BYJ is generally fine, just don't set the speed to high, maximum 10 or so.

marcel_felde
Posts: 140
Joined: Wed May 09, 2018 12:19 am

Re: Stepper 28BYJ loosing steps

#7 Post by marcel_felde » Fri May 07, 2021 8:13 am

As mentioned, I am using 3.7.1.

I used electronics from Flight Illusion to convert the Dornier Instruments. They had the same problem - nearly no torque. So it only worked on gauges that have no gear, that drive the needle directly.

I just did a test:

The 28BYJ has a recommended speed of 15. If I use:

Code: Select all

stepper_test = hw_stepper_motor_add("4WIRE_8STEP", 4096, 15, false, "ARDUINO_MEGA2560_A_D8", "ARDUINO_MEGA2560_A_D9", "ARDUINO_MEGA2560_A_D10", "ARDUINO_MEGA2560_A_D11")
it takes 1 Minute and 7 seconds for one turn. So not even 1 RPM instead of 15.

With value 60 it takes 18 seconds for one turn. Still a lot lower than the motors possible RPM.
With value 90 it takes 8 seconds for one turn.
With value 245 it takes 4 seconds for one turn.
With higher as 245 it does not turn anymore.

Value 15: 0.89 RPM
Value 60: 3.33 RPM
Value 90: 6.66 RPM
Value 245: 15.00 RPM

Conclusion: The value in Air Manager does not represent the true RPM. And 10-20 is definetelly to slow. ;)

User avatar
Ralph
Posts: 5105
Joined: Tue Oct 27, 2015 7:02 pm
Location: De Steeg
Contact:

Re: Stepper 28BYJ loosing steps

#8 Post by Ralph » Fri May 07, 2021 9:33 am

It's indeed not really RPM I think, it is more like a 'factor'. The 28BYJ is heavily geared, that's why it is so slow. There are probably stepper motors which are less or not geared with more power.
You can also use a stepper driver like the VID-6606.

marcel_felde
Posts: 140
Joined: Wed May 09, 2018 12:19 am

Re: Stepper 28BYJ loosing steps

#9 Post by marcel_felde » Fri May 07, 2021 11:20 am

Does the VID-6606 support those geared steppers?

Still it would be interesting to find out where the steps are lost. I assume it may not be the driver, otherwise no one would use the 28BYJ anymore. I have no experiences with message port, but this may be a solution to send the XP dataref to the stepper via message port and a standard Arduino stepper driver and have a look for the behaviour...

Does anyone know if steppers that are used for CNC tools and 3d printers can also be used with Air Manager? They are strong, fast and precise. At least they should not be loosing steps...

marcel_felde
Posts: 140
Joined: Wed May 09, 2018 12:19 am

Re: Stepper 28BYJ loosing steps

#10 Post by marcel_felde » Fri May 07, 2021 11:21 am

...for example the Nema 17?

Post Reply

Who is online

Users browsing this forum: No registered users and 8 guests