#Stepper X27 (25).168 based Gauges

1 messages · Page 1 of 1 (latest)

dense vessel
#

Has anyone yet have a solution to using an X27 stepper with Mobiflight to produce gauges which don't swing 360 such as the PMDG 737 flaps gauge. Given its uses little power, is there a need for a driver? If so which driver, or can it be direct connection to Arduino board? If this approach has been used, could the clever SIM builder please describe the setup and motor settings. I simply want to build a gauge that swings up to 270deg, and mimics the gauges in vehicles that use the X7. Ie. that start at zero stop and can be calibrated as normal.

fleet pecan
dense vessel
#

@fleet pecan This image comes up from the links above...

#

This the upgraded equivalent from Ver 10.5.3 MF whixh I'm using...

#

V10.5.3 Popup has several differences (tabs, Sim Settings and values). I don't use Ver 11.0 yet! Makes it very difficult to know wha's best.

#

I get erratic movement with the settings above, the needle doesn't return to the 0 test value, although it moves through an arc of about 30deg with a test value of 500. Strangely, presumably because I have no idea what settings I should use, it swings both ways when I stop and run the test value. Clearly these settings are wrong. I might add, the link above is for a continuous compass gauge that Bob invented years ago, it appears not relevant either for the current (or near so) version of Mobiflight, and for a 270 degree gauge (limit of stepper movement). I believe these steppers can be modified to allow continuous full 360degree turns which I assume Bob did for his compass. Because the X27/25 are cheap and do work very smoothly when set up properly (as evidenced by the universal use in cars) suggests that they should be a perfect choice for many gauges in the simulator.

#

My next move if I cant get satisfaction from the X27 is to add a small reduction gear pair to a SG90 servo, or buy the 270 degree SG90 variant, and use that. At least that device functions properly in Mobiflight setup.

fleet pecan
#

yeah that wiki article is old. but basically you can follow the current stepper docs for congiguration

#

the idea is just that you can connect the stepper directly to the pins but need to swap the two middle pins

#

the problem with these is they are very weak, so the pointer needs to be very light

#

but if your movement is erratic, I think the wires are in wrong order

dense vessel
#

Sounds like it...

fleet pecan
#

the stepper setting has a preset for x. 27, I think the default is the geared stepper

#

what kind of stepper is this? there are a few different versions of that style stepper

#

some have pins in front and some in the back

dense vessel
#

I have the X27.168 everyday white ones- shaft out front, pins out back. I remain confused as which pin is which. It seems the internal coils are under the pairs of pins. Makes sense that each coil operating in a sequence should be connected to give a field which reinforces the stepping. I have about 20v of these things, maybe I should pull one apart to see the internal layout. That might clarify the behaviour

fleet pecan
#

ok let me look

#

I have a video of this actually

#

only video on my youtube channel

#

this shows the internals but I have the footprint, let me look it up

#

so my motor has pins in the back

#

so I do this (this will be something that will be available later)

#

I assume you are wiring this by hand now?

#

so

1             4

2             3

In MobiFlight configure the pins: 1-3-2-4

#

si coils seem to be between the short distances

#

my pcb above crosses the pin 3 and 4 so it will work with the prototyping board's stepper connector that is 1-2-3-4

#

@dense vessel let me know if this works out for you

dense vessel
#

@fleet pecan . Excellent description of the motor and its workings, that circuit will be available from Mobiflight shop in due course?? I disassembled one of these steppers this morning and was blown away by the simplicity and by the miniaturization involved. It becomes readily clear how it works!

Then I found this 2012 link below by "Ardunaut" to bit of code to drive the stepper direct from an Arduino using a pot as signal source... worked flawlessly first time, wired as shown. https://arduining.com/2012/04/22/arduino-driving-a-micro-stepper-motor/

Small stepper motors are used to control pointer gauges in motor vehicles. These motors are  small and can be driven directly by the Arduino due to low operation current (15-25mA per coil). They ha…

#

The stepper shown is a different manufacturer to the motor you describe and I have, but identical in function.

Its just a matter of wiring it to mobiflight and using the correct range and limits, steps etc. which I will do now. I also came across a link to these motors being used in SimVimX for X-plane which is useful as a reference, and also describes very nice circuit and components for TCRT5000 IT sensorIR sensors. These could replace pots or Hall sensors for things that require exact triggering such as the flaps ona Boeing quadrant. https://www.simvim.com/gau_stepper_x27.html

#

Thanks for your efforts @fleet pecan, I will add a note when I've verified the stepper in mobiflight...

fleet pecan
#

here is a starting point, and use a super light weight pointer

#

those are really really small things with little torque

#

you see here my pin "swap" of 0123 -> 0213

#

(its a pico so there is D0)

dense vessel
fleet pecan
#

yea, so it should work the same way in MobiFlight if you configure it accordingly

dense vessel
#

@fleet pecan Ok, I've assigned my pins as such-
Arduino Motor
8 1
9 3
10 2
11 4

What I need are the settings you have used in your example for the corresponding config- I'm using the stepper to show flap position in a 172 (pot mapped to 0-16383), so that needs to remapped to suit the stepper?

Display Settings -
Display Scale ? steps per revolution
Advanced Stepper Settings-
Full revolution ?
Max speed ? (std 1800)
Acceleration ? (std 3600)

dense vessel
#

@fleet pecan Ok so I now have it working beautifully. The pin 2 and 3 are swapped in the module reference. But the wires going into the Arduino remain as -

#

Ard Pin Stepper Pin Module ref
5 1 pin 1 is 1
7 2 pin 2 is 3
9 3 pin 3 is 2
11 4 pin 4 is 4

Config settings-
Input: stepper data is transformed to give 0-630 range

Output settings-
Display Scale 720 steps per revolution
Advanced Stepper Settings-
Full revolution 720
Max speed 30 (std 1800)
Acceleration 100 (std 3600)

#

However, I've found a bug in that changing config values and trying to save has brought up an error and that the config cant be save and wiped my config references... lucky for backups!

#

When I try to reload the config, it says there are unsaved changes, if I say no to saving, it then says backup config cant be loaded, check for syntax errors... grrrr. I will close MF and try again.

fleet pecan
#

hmm, @cloud ginkgo got an idea?

#

@dense vessel can you list the steps you do to cause the problem to happen so we can try to reproduce the issue?

dense vessel
#

Probably not, I have now updated to Ver 11, the configs are restored. I've been hesitant to commit to Ver 11 previously as I had some variability in the result. But now I've updated, I will persist with it. Wish I could help further, but I dont want the stress 😉 Just thought in alerting you that you might have had others complaining and be familiar with a bug like this. By the way I've posted a comment to Sebastian on editing/ renaming lines in V11, can you have a look for that and tell if I am doing so in the correct channel?

cloud ginkgo
dense vessel
#

@fleet pecan , just to re-iterate the test settings. My pin assignments are :

#

the test values are full range 720, speed 30, no acceleration figure. Pot is 0-630 left to right (CW)...

#

If I set up:
Ard motor pin.
8 1
9 2
10 3
11 4
(motor runs CW)

#

whereas:
Ard motor pin.
8 1
9 2
10 4
11 3
(motor runs CW)

dense vessel
#

Then pin 1 2 3 4 sequence can be maintained on control eg. 6 7 8 9 or some other set.

dense vessel
#

Testing the action, with the original pin assignments. 3 4 1 2 connected to Arduino 8 9 10 11

#

No w to try it with Mobiflight- here is my setup...

#

Module ref...

#

The latter module references did not work however, the needle just buzzed. Next I tried reversing 1 and 2, that did work, then I tried the following-

dense vessel
#

And bingo , the needle moved smoothly back and forth with pot adjustment, however needle action was reversed. Reversing the number sequence 8 10 9 11 to 11 9 10 8 did the trick!

#

Next test tried 9 11 8 10 and that yielded the expected CW desired CW movement. Now it was just about scaling.

dense vessel
#

@fleet pecan Almost done. After a bit of trial and error, I found an input to stepper driver of 1860 gave the full 315 degrees of rotation possible setting steps to rev at 720, full rev to 630, max speed to default 1800 and acceleration to 3600. Now its just a matter of working out the pin assignments to reverse the needle travel. That shouldn't be too difficult now I have everything else sorted.

dense vessel
#

In terms of the future for the X27 stepper, it is apparent that the confusion is around naming the pins on the stepper, presumably mobiflight UI and code are set in concrete, and in any case, its more logical for a user to assign the pins based on the 1234 sequence to suit the stepper. The confusion arises because these X27 steppers seemingly aren't branded with pin numbers, its up to the user to determine that. Similarly, NEMA steppers have a wiring color code, but it changes dependent on the particular batch as far as I can see, in that case the user is still bound to determine the coils wiring. 28BYJ are bit more organized and supply with a nice driver where that is not an issue. My suggestion would be to firstly have a decent section in the Mobiflight documentation as it currently absent, and to label any image of the X27 with pin numbers that reflect usage in Mobiflight. Pin number labels match the pin numbers in the UI. That way the confusion will not arise.

#

This the first of several gauges I want to build for the x27...

#

Needle is a bit long but that easy fixed. The X27 is the perfect driver for gauges like this, and will have the 270 degrees to give swing to suit.

dense vessel
#

@fleet pecan Bit of playing and I've calibrated 0-100% flaps extension 270 degrees gauge travel in my 737 project config, so, I reckon apart from documenting the outcome of this thread, we are done. In terms of documentation, @steel lantern I am happy to prepare a draft for the MF online manual in the stepper section, currently that is deficient having only a description of 28BYJ-48 as far as I can tell. Be good for other users to have that reference!

steel lantern
#

sure. please do

dense vessel
#

Ok, I will do a bit of work on it over the next while and send you a draft to be knocked into a suitable form by editor.

dense vessel
#

@steel lantern Hi Sebastian, following my proposal for manual amendments, can you answer some questions. I am not at all familiar with the manual composition for webpages. But to get started- font used in the manual? Would a simple Word for windows document be ok? Images as JPG, PNG or BMP? Then your web man can convert that if necessary into a form suitable for a web page.

fleet pecan
#

you can write basic text file, it's actually a file format called markdown. but we can format it, no need to worry about that. the content is what matters

#

images as png

dense vessel
#

@fleet pecan Ok, will do some work on it... I also suggest a slight change to the UI pop-up for steppers... maybe something like this...

#

That, and an explanation in the manual for the X27 might serve to clarify, as the pins on the stepper are not actually labelled, they can be assigned to suit.

#

I'm assuming that the Mobiflight driver (as it stands) assigns motor pin 1 as coil 1 A, Pin 2 as 2 A, Pin 3 as coil 1 B and Pin 4 as coil 2B ?

#

The same logic in the UI labelling could be applied for the different stepper options as required- eg. where an intermediate driver is used the 2 pins could be labelled pulse (PUL) and direction (DIR).

cloud ginkgo
#

I am wondering if Pin 1/2/3/4 is required at all or could just replaced by coil XZ?

#

In case of using a driver Pin 1/2 would be replaced by Pulse/Direction

dense vessel
#

@cloud ginkgo I agree re drivers that only have pulse and direction, where the confusion lies is figuring out the connection between 4 pin stepper and controller 1 2 3 4. My suggestion re labelling might make that easier.

#

Either way the UI needs to relabelled for each class of stepper!

fleet pecan
#

and the uln driver for the geared motors needs pins in sequential order

#

so no pin swap there

#

but we plan to rethink most of the device configuration pages in the new user interface when we get there. Just a lot of work to do it all but then one would have pictures of the stepper and pins selector right there etc

dense vessel
#

sounds good, will make it lot easier for novices to get there instruments etc. going quickly

fleet pecan
#

yes

#

and we want the pcbs also so it will be compatible with the prototyping board

#

and the proto board is actually surprisingly good, I used it for the demo panel we have here at AERO now

#

this one has no steppers though

dense vessel
#

👍

dense vessel
#

Using the test routine described on Arduining.com site for driving an X27 micro-stepper direct from an Arduino..

#

Any other sequence of numbers is likely to just sit and buzz

dense vessel
fleet pecan
#

so did you get it to work ok?

#

because I know when it is connected right the motor will work fine without rattle

#

will be a bit smoother with the quad driver chip but it should still work fine without

dense vessel
#

@fleet pecan yes, it did, I've been working on the gauge , printing and testing. The stepper is working fine. I'm yet to do some tweaks with scale and so on, but essentially it works well. So I now have a base for all the other gauges. And as you say, a separate driver would be better I think . I notice it does rattle a bit... What driver do you recommend?

fleet pecan
#

nice yeah

#

it might be just a type of motor too

dense vessel
#

I have put a fair bit of effort in steppers and drivers working towards a powered trim and throttles. Trim system is near done too.

fleet pecan
#

some of them are more quiet but perhaps try if the half or full step makes a difference in pin config

#

for nema17 a 3d printer motherboard using a Mega or shield for one can be convenient option if stronger motors are needed

dense vessel
#

Interesting though, the motor runs very smoothly, driving off that test routine I've linked, but not as smooth in the sim

fleet pecan
#

just need to find the pin numbers from Marlin firmware source code

#

make sure you have your sim value "oversampled"

#

so if sim range is 0 to 300 for example have it multiplied by 10 or 100

#

and then have the multiplied range also for the stepper

dense vessel
#

I have a bunch of nemas, for the powered throttle etc. they are great but need heat sinks and cooling I think.

#

When I get to finalizing the physical devices and actually using them, I will be talking to you. I'm definitely on a steep learning curve there.

#

Can we leave this thread open while I work through this?

fleet pecan
#

yes sure

dense vessel
#

👍 🤓

dense vessel
#

@fleet pecan Decided to try out the DRV8825 driver which only has DIR and STEP pins from the designated SIM controller, pin 3 is connected to DIR, pin 2 to STEP. The RSET and SLEEP lines should be held high to VCC, card is powered by 12V (VMOT GND). First test was with M0, M1, and M2 pulled low internally (full step mode).

dense vessel
#

The X27 motor pin 1 was designated as A1, pin A2, pin 3 was B1 and pin 4 was B2. Those connections when tested with Mobiflight, actually drove the motor in the clockwise direction, all good so far!

dense vessel
#

Display Scale was 720, Full Rev Steps set at 600, speed 400, acceleration 3600.

Next to scale the output from the SIM.
Flap Position Indicator Left Needle
0 = Up, 100 = 1, 200 = 2, 300 = 5, 400 = 10, 500 = 15, 600 = 25, 700 = 30, 800 = 40

With these test system for the config, a value of 660 gave 273 degree swing from zero. So put in modifying transform (Round($, *0.822,0) to give a 270 degree swing.

Under these conditions, the needle traveled very smoothly from 0 to 270 as intended (single step mode)

#

When the motor was driven by the 0-40 range of the 737 FLAPS, it worked perfectly although the needle did vibrate a little towards 0, suggested I need to try micro stepping the motor.... your suggestions to clean up needle movement by over-sampling sound reasonable but I'm not sure exactly what to do with the config? The driver has wide range of micr-stepping options pulling up either or all pins M0/M1/M2

#

Saw you suggestions re oversampling but not quite sure with setting that up. I might just leave it as its working well enough to continue finishing the gauge. Are you far away from having your little X27 circuit boards made and available? Might revisit the micro-stepping idea later.

dense vessel
#

Currently: SIM Raw data 0-800, output after transform 657
Round($*0.822,0)

Config Display Tab-
Display Scale 720 steps per rev.
Full Revolution 600
Max Speed 400
Acceleration 2000

Module Settings- Pin 1 is 3 (DIR), Pin 2 is 2 (STEPS)
Auto Zero None
Stepper Custom Stepper
Mode Driver
Backlash Value 0
Default Speed 400
Default Accel 800

fleet pecan
#

you can also use the interpolate modifier to stretch the range of values

#

transform of course works too

#

I think interpolate rounds the result

dense vessel
#

If you have some time, maybe you could give some further guidance by suggesting some numbers which I might use to get microstepping to work . For example 1/2 and 1/4 stepping. I tried 1/4 but it just caused the stepper to oscillate wildly. Obviously some fact I had misunderstood.

fleet pecan
#

but for sim values that are fractional like compass heading (0.123747 degrees) the stepper might feel like it has, well, steps (heh)

#

so if you multiply the heading by say, 10 then heading of 12.534 becomes 125 so you get 0.1 degree steps of movement in the compass stepper for example

#

and depending of your stepper number of steps it is likely smoother

dense vessel
#

I understand the principle, it is implementation . As I understand it, the stepper is tricked by the driver and that can lead to smoother operation, instead of the device jumping at low speed to each whole step.

fleet pecan
#

yes the half step mode works like that

#

but also the value is sent as integer so the decimal part is dropped because the stepper can only move in steps

#

whether they are half or full

dense vessel
#

I might set up a test rig tomorrow and have a bit of a play with the numbers.

steel lantern
#

There should not be "jumps" because a stepper moves to the target value by stepping incrementally until it reaches that value

#

acceleration and speed determine how fast it can go.

#

the half step increases the resolution of the stepper. Basically doubling the number of steps it takes to do a full revolution

#

so it looks smoother and less jagged- thats probably what you mean with jumps, right?

dense vessel
#

Yes that sounds correct. I read somewhere that the driver plays with a combination of pulses and voltage to achieve the micro steps...

#

Also it seems that different motor and drive can give varying results when it comes to speed

#

Good to understand these things...

fleet pecan
#

if it jumps, also try lowering the speed and acceleration to see if it is just pushing the motor too much

#

or if the pointer is too heavy

#

the x27 are pretty weak

dense vessel
#

@steel lantern Hi Sebastian, I'm making some progress in writing up a descriptive section for the Mobiflight documentation on Stepper Motors. Decided I would re-write the web pages as a Word document and your team can knock it into shape as required. My approach was to look at the documentation as a novice user and try to provide enough information to enable that user to both choose an appropriate motor and driver, and then give examples clarifying the connectivity, extending the existing online documentation.

My quest highlighted a couple of issues with the UI which you might have had comment on before, but if fixed up would greatly improve useability. The difficult I saw immediately right at the start of this was the fact that the UI only has pin selections, the function of the pins is not provided. Eg., for custom steppers in driver mode, the UI is modified to the need only 2 pins assigned, but the function of the pins is not described (DIR and STEP)- it is left to trial and error to sort that out. If Choosing the X27 then 4 pins are required as for other combinations. Labelling of the pins with their function would improve the useability of the UI. EG., drivers can be labelled A1 A2 for coil A and B1 B2 for coil B, if that was available on the pin entry boxes, it might serve to clarify setting up a stepper. I suppose its a matter of striking the right balance of information.

In so far as the draft documentation is concerned, can you provide an email address that I can use to forward the draft to you without it yet being public?

fleet pecan
#

you can also send it as a private message here on discord if it is under 8MB or so

#

but I dont think there is a huge issue from our point of view even if it is public too, it will be public in the end anyway

#

and yes, all the device configs will also eventually be redone when the old dialogs get converted to the new UI style / toolkit

dense vessel
#

@fleet pecan Sounds fine, I will send the drafts as PDF until such time as the job is ready to translate to web. ATM it is only 6Mb, should be easily able to accommodate it under 8Mb. My image inclusions currently are just a grab bag of shots in the public domain online, or ones taken myself from my hardware collection. I'm just investigating a camera setup and backlighting etc. to get some better image so forgive if they are not the standard you would prefer.

As an aside that might be worth a reference , I notice that SimVimX is capable of driving multiple X27 motors through an output multiplexer, is this capability also available through Mobiflight using the output shift register? Or this currently limited just to turn on LEDS? Found this interesting discussion... https://forum.arduino.cc/t/do-shift-register-give-me-individual-controll-over-connected-steppers/697036

#

@fleet pecan @steel lantern Here is a first attempt (not PDF), still needs work towards the end though, so it is still a work in progress. It's a matter of comment as to whether it is enough to give the user an intro to steppers and also allow them to start in with an application. Could be a bit long but really that's up to you guys. Here's the file anyway...

#

No AI was used in this exercise 😬