MobiFlight Community Support

Welcome to the forum for MobiFlight! Feel free to reach out to the community in case you have questions, issues or just want to share great ideas or details about your latest home cockpit project.

You like MobiFlight? Donate via PayPal and support the MobiFlight development. Thanks! 

icon
Avatar
Caspajack
Posts: 29
Hi,
Has anyone successfully interfaced the switec x27.168 stepper motor with the Easydriver 4.3 board to make gauges?
A MobiFlight user by the name of Sousa said he'd done it in an old post, but he never answered any questions regarding the interfacing.

I've successfully connected one of these using the preset for airspeed and it sort of works, but the needle moves very slowly and it's very noisy as well. Which after testing it with a simple sketch using just the arduino it works fine.
------------
void setup() {
pinMode(8, OUTPUT);
pinMode(9, OUTPUT);
digitalWrite(8, LOW);
digitalWrite(9, LOW);
}

void loop() {
digitalWrite(9, HIGH);
delay(1);
digitalWrite(9, LOW);
delay(1);
}
--------------

I'm using just 2 pins on the Arduino and set them with the same pin number in the Mobiflight connector. So that pins for the A coil are set on pin 8 and the B coil is set on 9. They correspond to the relevant pins of the Stepper. The spec sheet for the stepper says there is no polarity for each coil, so as long as they are set correctly for each coil they will work.
I believe the Switec Stepper defaults to 1/8th microstep mode. That means that each time the "digitalWrite(9, HIGH);" call is executed, the stepper motor will move 1/8th of a full step. So that may have a bearing on the speed but I don;t know how to change that, or even if I should.

I have tried a range of different settings within the Connector regarding the sim / stepper but I'm working a bit in the dark here.

If anyone has any advice, or actual knowledge of the settings for the EasyDriver board I would be grateful.

John.
2020-05-19 16:13
Avatar
pizman82
Moderator
From: ETSI, Germany
Posts: 3520
Supporter
Hi

the Sim/Stepper Settings are just important to define how many steps are used for a Full circle and what Sim Value is used also for that full circle.

For example Sim 100 Stepper 2048 means.... A Increase of Value from 0-100 should Represent a 360° turning of Stepper..... and it will move the Stepper by 2048 Steps.... If that is a 2048 Step Motor it then will turn exactly 360°

In your Case if you got e.g. a 2048 Step Motor but it will do 1/8 steps then you simply say 8*2048=16384 .... So in theory this is the numebr of Steps ( commands) to turn the stepper by 360°.

NOTE: there is no way to change the Speed of the Stepper diretly in Mobiflight ( Only by rewrite the Code)

*************

Summary: If you realy need this try out.... If Speed is to slow think about a Gear. 5:1 e.g. speed up by x5

Whatever.... If you got choice to use a ULN2003 then buy one for less then 1$ and not waste a lot of time for research !
If your TV use a HDMI wire you also not try to Cut and resolder a Scart Cable.... You just buy a HDMI cable and all is fine !
Good Luck !
2020-05-19 19:10
Avatar
Caspajack
Posts: 29
Hi Pizman,

Thank you for the detailed explanation.

I already have the slightly larger stepper motor with the UNL2003 driver board and have used it successfully for a wet compass, and also a flap gauge.

The reason I bought a few of the Switec motors was because they are smaller more compact and designed specifically for gauges.
I was led to believe they will not work with the UNL2003. If in fact they will work, I already have a number of those I can use.

It wasn't my intention to spend time trying to use something just for the sake of it. I would not waste yours or my time in such a pointless pursuit.
As someone by the name of Suza had said that these work fine, I simply wanted to know if anyone had followed the same path successfully.

https://www.mobiflight.com/forum/message/4820.html

You and Sebastian also took part in this discussion, Sebastian said he had a Switec gauge but had not had the time to experiment with it yet.
Because that was written in 2017, I was simply following up to see if there had been a resolution one way or the other.

Not sure if your analogy of the HDMI cable was meant to be helpful?
2020-05-20 01:42
Avatar
pizman82
Moderator
From: ETSI, Germany
Posts: 3520
Supporter
Hi again

About Souza..... I not read from him sinse long time. Don´t know if he is still passive in the forum Maybe he read this. Sebastian is here already but not post verry often.

About ULN2003..... If i remember right some poeple here try to use other Motors ( Not 28BY-J48) but also try to build this with the ULN that is compatible with Mobiflight. thats why i thought you can try to controll your "special" Motor already with the supported Chip.

About the analogy.
Here i must say i´m a verry conservative guy... I think mostly linear..... So also my planings work so
So i pretty understand if people try to use a premade Element ( Like a MIP with a included Flaps gauge) now with mobiflight and want to support other hardware ( instead of difficult reworking)
BUT
If Users plan for a Cockpit (selfbuild) i personaly would simply use the given tools and plan it in that way instead of make difficult workflows with other hardware.

So we got here two different ways of planing.... You got the problem that the recommend motor not fit into your gauge as i understand.... So you search for a smaller Motor.
I would simply redesigne my gauge in a way i can use the supported motor..... for example by enlarge the shaft and mounting the Motor behind the gauge..... Or with a cogwheel and mounting the motor next to the gauge if there are no switches or LED blocking.

Basicly our both ideas are OK.... I need time for planings.... you for research and testing.
Good Luck !
2020-05-20 19:16
Avatar
Caspajack
Posts: 29
Hi Pizman,

I will revert to the 28BY-J48 combined with the ULN2003. I have already built a Flap gauge using a servo, so it's not a problem to make the others for my 737 cockpit. In fact I've used the 28BY-J48 to make a wet compass.






There is still much to do, so I'm not looking to make extra work with unsupported motors. So I will follow your advice and invest my time in planning and redesigning the gauges to accommodate the larger motor. Since your previous mail I set to and made an ETG gauge with the 28BY-J48, so it's not too difficult to swap the motors, Sadly I designed and invested in some circuit boards for the Switec ,which will now become redundant.




Oh well, that's life... stay safe

John
[Last edited by Caspajack, 2020-05-20 22:44]
2020-05-20 22:25
Avatar
pizman82
Moderator
From: ETSI, Germany
Posts: 3520
Supporter
Please think about it again !
I will not be the bad guy that say you have to put your PCB´s in the trash and finaly in 2 weeks a other user say " Your Switec motor was still useable already" .

As i said above.... If you already have hardware ( like a premade element) or in your case perfect designed PCB´s then we got a other situation.
Then its also profitable to do research.

If i would be in your situation i would simply invest a evening in testing ( and a lot of google searches :P )

Take a empty Mega..... A Breadboard and a couple of Jumper wires.
Flash Mobiflight firmware and create one Motor Device. Make a easy new MCC Config with only one line for the Motor and use TEST in Display Tab Only e.g SIM 1000 TEST 500.
And then start.
As you said.... Change sequence of wires.... Maybe search for a Datasheet shematic of ULN and your PCB.... Maybe you see some logics you can use.
If you understand "code" then get on Bitbucket and check the Mobiflight sourcecode ..... If you knwo how Mobiflight handle the data and you know how the 2 Motordrivers work then you maybe find a way to solve this !

Summary:
If you already have PCB´s then you should give those Motors a second chance.... I would do!
Good Luck !
2020-05-21 04:57
Avatar
Caspajack
Posts: 29
Thanks Pizman,
Good advice as usual, I'll do as you suggest and try some different combinations.
I'm afraid I don't have any experience in coding, other than some "basic language" programming many... many years ago.

Perhaps there is a way. ;)
If I'm successful I'll report back so perhaps others might benefit from it.

John
2020-05-21 09:41
Avatar
krono
Posts: 19
Hi
Hopefully you will be able to get the Switec motor working. I have already built my main gauges with the larger 28By motors but for the smaller gauges like the fuel or vacuum for example the Switec would be brilliant. I have been looking at these and was on the verge of ordering some when your post came up. The 28By steppers are great but not for everything. I will be following this with extreme interest.
By the way I allmost forgot, your small printed board looks very good. Well done :w00t:

Ken
2020-05-24 06:44
icon