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)
Is this a bug or is something wrong on the code?
Thanks and greetings,
Marcel