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! 

05/03/2024 - This forum is read-only

The community support for MobiFlight has moved exclusively over to our Discord server. Register for free and enjoy more interactive functions like image and video upload, voice chat. More than 7,000 registered users around the world make it a great experience!

See you on our MobiFlight Community Discord server.

A HUGE Thank You to everyone who participated in the forum, especially obviously to Pizman and Stephan who did an outstanding job over so many years providing an incredible service to the MobiFlight community.

The forum is still providing a lot of good content, hence we keep this information accessible.

icon
Avatar
Doon1
Posts: 53
I need a PWM signal for DC motor control. I was hoping I could use a servo output, but the range is too small. For instance, I am reading Prop Thrust and outputting it via a servo output. At zero thrust the PWM signal is 3% at full thrust the PWM signal is at 12%. Is there a way to change it so that the PWM signal follows the input value one-to-one? zero output value=0% PWM, max output value=100% PWM.
This is the last piece of the puzzle to make Mobiflight FFB capable for rudder control.
Thanks.
2022-02-15 01:57
Avatar
Whiteknuckle157
From: Bayern - Bibertal, Germany
Posts: 50
Hi,
maybe I can help.

The Mobiflight servo output is PWM but it only covers a range from roughly 500 to 2500 microseconds (0,5 to 2,5 ms), not a percentage.

I use the servo output from Mobiflight often in this manner:

The Mobiflight servo output goes into an Arduino Nano Input (Usually an interrupt capable input) where I convert the signal from servo signal to a percentage PWM signal with the map() function. e.g.
iconcpp:
Output = map(Input, 500,2500,0,100);


You may also check the real servo input values because they might differ slightly from exact 500 to 2500 microseconds.

Then I send this value via a Nano PWM port to the device (H-bridge or the like).

cheers

Volker
2022-02-15 13:04
Avatar
Doon1
Posts: 53
Thank you very much. I was beginning to wonder if this project was going to need an additional board. I have a Teensy 2.0 that I can use. (It's a Leonardo clone). I also have 4 L298N motor drivers arriving tomorrow, so I can play with it some this week. Hopefully the Teensy won't require too much programming (as I suck at it). This should make it much easier.
Thanks again.
John
[Last edited by Doon1, 2022-02-16 03:03]
2022-02-16 02:45
Avatar
pizman82
Moderator
From: ETSI, Germany
Posts: 6010
Supporter
Why so difficult guys ???

We not need to "hijack" the Servo System for this.....

MF allow since V9.x the PWM Output System.....

How to do....

1. Build a Output Device "Typ LED Pin" and use a Pin that allow PWM ( Check your Arduino Manual or just check if MF offer the "PWM" Flag when you select for a Pin in settings)
2. Upload that Pin to the Board and wire your needed Device to this Pin.

3. Create a Output Config and use as Device that "LED" you define before.
Read the needed Raw Value. And eneable the PWM Checkmark !

Now... MF PWM is 8bit .... Means it allow a Value of 0 (0V Low) up to 255 ( 5V High)

So your only work now is to write a Formula that change the raw Value into that Range....
E.g. if Raw is 0-16383 simply say $/64
Good Luck !
2022-02-17 21:31
Avatar
Whiteknuckle157
From: Bayern - Bibertal, Germany
Posts: 50
Wow!

thank you very much. I didn't realize that this is a thing. Great!

cheers

Volker
2022-02-18 00:06
Avatar
Doon1
Posts: 53
Pizman to the rescue. Thank you!
2022-02-18 01:56
icon