I have been using a stepper motor on MF to drive my trim wheels, the POT on the trim wheels is interfaced via prosim and the grbl stepper driver board is ran on MF, I also have input and output setup to lock / disengage the trim wheel. I used the prosim offset via FSUIPC before and it worked but my rotations were slightly off from what the sim had, i could live with it ! now i have set up the POT in MF i can have the trim numerical output and the trim input in MF. I have set it to trim input and it has a variable from 0-65400 from 14 to -4 on the trim wheel, the stepper driver board has the trim ouput numerical. based on the 0-65400 how do i calculate the stepper settings for the stepper ? thanks
#Stepper motor and trim in MF A320
1 messages · Page 1 of 1 (latest)
You should specify what type of stepper motor and what is the micro stepping mode you set in the driver board. That determines how many steps per revolution the motor makes.
Google AI says...
The Airbus A320 pitch trim wheel typically requires approximately 6 full rotations to move from one end of its travel range to the other. This corresponds to the full travel of the Trimmable Horizontal Stabilizer (THS), ranging from about 13.5° nose-up to 4° nose-down.
If the sim trim value goes from 0 to 65400 and that corresponds to 6 full rotations, then the sim scale setting for the motor is 65400/6 = 10900 units/revolution
you still need the motor steps per revolution, which depends on the stepping mode you set.
Thanks i believe the stepping mode is full for the Nema17 stepper I have
OK, full stepping on a Nema17 should be equivalent to 200 steps per revolution on the motor side
Frankly, I would increase the stepping mode to 1/4 to make the motor movement smoother. That increases steps to 4*200=800
I assume there is no gearing between the wheel and the motor. Please confirm.
Yes there is just belt pulleys from the motor to the wheel
And it is 5 3/4 turns on my sim for the THS range so its pretty close i guess
Belt pulleys can have a ratio different from 1:1
If the belt pulleys have different diameter
OK if it is 5.75 rotations then 65400/5.75 = 11374 units per rotation.
5.75 turns on the Trim wheel pulley and 3.5 turns on the motor pulley in the full range
i tried this in display scale but the motor runs horribly
What does horribly mean?
Did you change the stepping mode to 1/4?
This is done physically on the motor driver board
meaning rugged, sluggish yes i removed 2 jumpers to set to 1/4 step
Verify the range received by Mobiflight. I am just going with what you said.
The trim variable I mean
If the stepper does not move smoothly it is most likely caused by incorrect wiring to the motor coils.
The coils must fire in a very specific order
restarted MF and it runs smother now
is this resolved?
No I have not tested it yet I will report back
another verification, are you sure the max reading is 65400 and not 65535?
Correct it is 65535
Im not sure how to tie these in... so for the POT trim input its set for the TRIM ANALOGUE variable so its giving me the input of the trim wheel which is exactly 0-65535... As for the stepper part, that should be reading the Trim motor output numerical or something else ? Should it be tied to the POT variable, im a bit lost what this part
You haven't mentioned which simulator, vendor and aircraft is this for? In general, inputs are translated into commands for the sim and you read back a status variable for the trim wheel position, which you use to move stepper motors.
there is no standard way. Each aircraft developer does their own thing.
Some (the simpler aircraft) use generic instructions and variables.
The more sophisticated an aircraft model is, the less it will depend on simulator provided systems.
Prosim 320 and MSFS 2024 I had it working via FSUIPC before but the stepper settings were slightly off but now i have added the POT in MF rather than PROSIM to match the stepper motor output
You have to be aware that Mobiflight does NOT have any functions for a closed loop control scheme. I would consider Mobiflight too slow in general for real time closed loop control. Although I would guess it can be made to work, sort of.
It is very easy to read a variable from the sim, and instruct your motor to move to that location. Period.
What I described above is a simple open-loop motor control scheme.
IMHO, you don't really need precise trim wheel positioning, because it is just mimicking the rotatioon of the virtual wheel. The sim does not depend on where the wheel is actually placed when auto-trim is active.
Yes it is easy enough I just like to learn more i guess... so in the stepper tab, i will literaly move the wheel to 0 and then set zero, will it always know this position ?
Mobiflight will always move stepper motors back to their zero position before exiting, so the motor is assumed to be at zero when Mobifight starts. Having said that, any type of abnormal exit, PC or software crash, or even the wheel being forcibly moved, will cause the zero point to be lost, requiring a recalibration.
There is a function in the firmware to move the motor until a signal on a designated pin indicates the motor reached its zero position. I have never used it though. You could attach a switch or optical sensor of some type to implement this functionality.
The trim wheel cannot be moved by hand when auto-trim is active unless you take additional steps to include that functionality into your design.
Yes I have a stepper on and off it as an led so it engages / disengages as it should