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
richard.long
Posts: 8
Hi

I have Relays connected to the ouputs of my Arduino MEGA. These outputs are set to ON ass soon as the card is powered thus energising the relays. Is there a way to default the outputs to OFF untill MF actually commands them ON?

Thanks
2019-03-20 09:13
Avatar
Hannes
From: Austria
Posts: 164
Supporter
Hello, I can confirm this behavior. With me also the relays are set, with the start of MF on ON, although the appropriate switch is on OFF? Would be glad for a solution. Many Thanks
www.modellbau-technik.at
hannes.dobersberger@modellbau-technik.at
2019-03-20 10:26
Avatar
StephanHo
From: EDDG, Germany
Posts: 1867
Supporter
Hi Richard!

Welcome to Mobiflight.

How do I describe it best? If you turn on a device, no matter what, then the power is supplied to the power before it runs properly. For amplifiers, there is e.g. a delay for the speakers, so it does not crack.
With a MEGA, this switch-on delay does not exist. It comes the operating voltage and when it has stabilized (this is done in the millisecond range), the inputs and outputs are set to a value specific to the manufacturer. Then a software stored on the MEGA gets the GO and initializes itself. Only with this software, the inputs and outputs are then brought to the state specified by the developer.

What you want now is that the outputs are only available when the software is working, ie when the MEGA reaches the last state I have described.

This is only possible by interfering with your hardware. You must disconnect all the relays from the power supply and activate them via a circuit that only supplies the relays with voltage when, in this case Mobiflight, is active, that is, it is running.
So you release the main relay only when Mobiflight is running. Only then are all the other relays supplied with power. At this moment, the switching inputs of the relays already have the level for the state they should receive from Mobiflight at a defined time. This avoids switching operations forced upon switch-on.
Whether you take a mechanical relay, a solid state relay or a transistor switching stage, it's up to you. You just have to make sure that the relays are only supplied with power when Mobiflight is running.
Grüße,
Stephan (Time: UTC+2)
2019-03-20 10:46
Avatar
richard.long
Posts: 8
Hi Stephan

Thanks for your reply.

The problem isn't the transient at startup but rather that the outputs are held ON from Arduino power up and after MF is running. Furthermore it is only the outputs which have been assigned in MF that are active at powerup. No other outputs are on.

I've tried this using the Parking brake tutorial and the Output is on at all times other than when the park brake is ON - the output is ON when the brake is OFF; and OFF when the Brake is ON.

It seems that there's some NOT logic at play here?

Thanks
2019-03-20 11:25
Avatar
richard.long
Posts: 8
I believe this is likely to be related to the MF firmware on the board since it is only the outputs which have been configured which are powered - i.e. with the output assigned to PIN1, PIN1 is ON and all others are OFF whenever the Arduino is powered.
2019-03-20 12:03
Avatar
pizman82
Moderator
From: ETSI, Germany
Posts: 6010
Supporter
Hi

Is your Problem only tested with Pin 1 ???

NOTE: Pin 0 and Pin 1 are NOT for Puplic Use. This 2 Pins are blocked by Arduino.
Mobiflight users can create Devices on Pins 2 to 53.

Also Note:
You must check your Configs to get a good testing sequnece.

For example a Offset is still activ whatever in Virtual Cockpit the Master Electric Power Switch is OFF. In Case of Parking Brake.... The Offset is still >1 when brake is set... Whatever the Master switch is OFF and no LED should be lighted..... Basicly ALL Offsets shows status of Function ( Not related to other things like Master Power)
Also there must be a Clear ON and OFF command in Mobiflight. If you use for example the Precondition Tool and you Disable a Config by that ( Like you say "Only work if Gear is down" .... Then the Config is Disabled.... BUT It is still power the Pin ( If it was ON before disable command) ASLONG another Config is tell the Pin it should get OFF.

Summary:
Please do the Follow:

1. Set your Relais for testing to Pin 2-53 (NOT 0 NOT 1)
2. Use a Testing Config that can have no Issue. For example the Parking Brake without any Preconditions.
3. Check your Relais again.

Tell us experience!
Good Luck !
2019-03-20 12:56
Avatar
richard.long
Posts: 8
Hi Pizman

In fact I'm using pins 50 and 51. (I used "pin 1" in the example for simplicity).

When I test this with the Park Brake tutorial but using the relay at the pin I get the same issue. PINs 50 and 51 are ON. All other pins are OFF. When the simulator is running the script works but in reverse:

Park Brake ON; Pin OFF
Park Brake OFF; Pin ON

When I power the Arduino it immediately sets the configured pins (50 & 51) to ON but all other pins remain OFF even before MF has started.. Is this normal?

I'm using this setup to control my sidestick solenoids with Jeehell so I need the pins to always be OFF unless AP1 or AP2 is on (as per the script you and Ben Lim developed). Ben has this same problem.

Thanks
[Last edited by richard.long, 2019-03-20 16:01]
2019-03-20 15:52
Avatar
StephanHo
From: EDDG, Germany
Posts: 1867
Supporter
Hi Richard,

no, that is not normal.

Do you use a brand Mega or a chinese clone?

What happend if you take a new MEGA, save the firmware on it and assign the pins 50 + 51 only as button devices. Are they now, without a connected device on or off? If possible, test it with a LED with protective resistor. Do the LED light on both pins if you connect it to GND?

The firmware uses the MEGA feature to activate pull-up resistors for the pins so it is possible that you measure +5V at the pins if they are unloaded.

I myself use 7 MEGA-modules (chinese clones) and these pins are all working normal. So I think it is not an issue with MF.
Do you have the opportunity to upload a schematic and the configs here? If not then email them to stephanho [ a t ] t-online.de. I will have a look on it.
Grüße,
Stephan (Time: UTC+2)
2019-03-20 16:41
Avatar
richard.long
Posts: 8
Hi Stephan,

I'm Using a genuine MEGA board. flashed with MF firmware and only used specifically for the purpose of running my relays.

I'll set the board up to test with LEDs and Buttons and let you know.

I'll send to schematics/pictures/configs to your email.

Thanks
Richard
2019-03-21 12:27
icon