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
PaulH
Posts: 15
I'm currently redesigning my old broken Open Cockpit MCP 737 IOCard Module for use with MobiFlight. The new IOCard PCB is ready for production. I have separated the connections of the Inputs and Outputs to the Arduino MEGA 2560 R3 into a small extra shield PCB.

The IOCard contains as inputs
- 6 rotary encoders
- 15 pushbuttons plus 5 encoder pushbuttons
- 4 toggle switches (SPST)
and as outputs
- 15 LED
- 22 7-segement digits (tubes) controlled by 3 chained MAX7219 display drivers

That requires all in all
36 input pins
18 output pins

For the design of the shield I need to assign the pins.

My Questions are:
Do any of the configurable devices in MobiFlight use interrupts?
Are there some specific pins on the Arduino that I should avoid? (like pin D13)
Which pins are recommended / discouraged to use for
- encoders,
- pushbuttons and switches,
- LED and
- the displaay drivers (CLK, LOAD, DIN)

Or are there no rules at all?

Happy to hear from the more experienced MobiFlight users.
2021-04-14 11:35
Avatar
pizman82
Moderator
From: ETSI, Germany
Posts: 6010
Supporter
Hi

Best way to talk about this is DISCORD.
If you open a conversation there please be so kind and LINK to this Topic so we know we talk to you again ( mostly the Discord User-name is different )

About Basic Questions.

Pins 0 and 1 is INOP. Pin 13 "can" be a Problem in Mega Pro Minis..... But i never heard about trouble with a Real MEGA 2560R3
AnalogPin A15 currently is bugged and work only as OUTPUT LED..... But this should be solved in the future!

So.... I personaly recommend to use AnalogPins for Buttons/LED..... All Other Pins (D02-D53) should work for everything. Technical also AnalogPins should work 100% for all devices, but in case we have not much feedback here ( most users work with DigPins Only) we not be sure if there are hidden problems if you use something else like Buttons/LED there.

Interrupt is currently not implemented and also not in the near future planed. We plan for PWM Support on special Pins in next release but thats no factor for a MCP.

********
My recommendatons:

1. Think about MAX/ Display Direction. Whatever we have now a "reverser" in MF..... If you still plan the Display please get sure you use correct Direction ..... Make a Breadboardtest to get sure your Displays work from Left to Right and not from Right to left. If needed reverse the Poin assigment on the Max Chips !

2. Think about a "One MAx - One Display (Diggitblock) Logic.
Splitting a Value over multiple Max Chips is a lot of Work..... And occure in bigger trouble if you also need Lighttest and Blank Systems ( Battery Off)
Also its more confusing if 2 Displays are controlled by same Max Chips ( E.g. a 5 Dig and a 3 Dig) in case both got same named Device !
With a logic.... 1 MAx = One Display you can name them same way as the Diggit and you know e.g. always Dig 0 is starting point.
If a Display is bugged you finaly directly know what MAxChip is involved and what 3 Lines(Pins) are effected.

3. If you have Pins Left..... Short down the Chains of Max Chips. You currently have 54 Pins in use. ( If i understand with 1 Max Chain) .
So if you have (with my logic above) 6 Display Blocks and you think about 6 MAx Chips.... Then i would make 3 Chains with 2 Chips.
The Additional 6 Pins are already available.
NOTE: This is my personal thought. In theory a Chain work fine up to 8 Chips.... But i always like to build the most conservative way.

4. Think about changeable aspects.
Instead of include (solder) the MEGA into the Board i would build a Conection Point.
From system aspects like this .....

So Pins on your PCB that allow to mount a MEGA backwards onto it.
If then soemthing is wrong with the mega you pull it off and simply set a new one on the connection..... 2 Min Work..... No Solder..... And Mega is changed.
Same for the MAX 7219
Instead of solder the Chip itself on the PCB i would make a area all lines come together and again Pins ( or female headers) on your PCB in same setup like the Max Tubes.
Then you buy the Max Tubes and remove the Displays.... And finaly set the Empty Tubes onto these headers.
Same benefit.... If a MAX is broke you not need to desodler a small SMD Chip on a PCB.... You pull of the broke MAxTube and set a new one within 2 Mins.
Finaly The Same System for the Display Diggits. Instead of solder them onto the PCB..... Solder Female Headers there in same Shematic like the Pins on the Diggits.
If e.g the 3rd Diggit of your ALT Display have a broke Segment in 1-2 Years you not need solder..... You open the Box.... Pull of Dig #3 and replace it with a new one.


In easy words.... Think already while design and build your panel that you can easy repair it and change parts in the most easy way !

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

I hope i gave some inspiration..... If you need more ideas and experience come to our Discord Groups !
Good Luck !
2021-04-14 12:55
Avatar
PaulH
Posts: 15
Thank you for answering so promptly.

Your comments regarding the pins let me design the shield to use Pins D14 up to D67. This leaves the PWM pins and the two last analog pins for future use.

Glad to hear that no interrupts are in use. This gives full flexibility for assigning the pins.

Regarding your recommendations:
1. Display Direction
I got a bit confused by that comment. Because in another topic you wrote that the tubes work from right to left. Right to left is also what I learned from my breadbord tests. When I press "Test" in the Display-ConfigWizard, MobiFlight outputs the value "12345678" and the number "8" is shown on the right most tube that is connected to pin D0 on the MAX. And the number "1" is shown on the left most tube which is connected to pin D7 on the MAX.

Like this:
iconCode:
D7 D6 D5 D4 D3 D2 D1 D0
 1  2  3  4  5  6  7  8


So the numbers in the value are in ascending order from from left to right. But the tubes themself are from right to left.

2. One MAX - One Display
If I understand correctly you suggest to not use chaining of the 3 drivers. But I do not split values across multiple drivers:
- first MAX drives 2 blocks of 3 tubes (COURSE and SPEED)
- second one drives 1 block of 3 and 1 block of 5 tubes (HEADING and ALTITUDE)
- the third drives 1 block of 5 and 1 block of 3 tubes (V/S and COURSE-2)

4. Changeable Aspects
My design has the Arduino MEGA not soldered onto the IOCard. There is a shield PCB in-between and everything is just stacked up
- top PCB is the IOCard with all parts
- middle PCB is the shield PCB distributing the signal to pins
- bottom is the ARDUINO.
All PCBs connected using pin headers and sockets for easy removal and access to parts.

The 6 tube blocks are small board modules attached to the front of the main IOCard. I'm going to use those modules also for other devices like radio stacks or similar.

Thank you for support.

Paul
2021-04-14 21:12
Avatar
pizman82
Moderator
From: ETSI, Germany
Posts: 6010
Supporter
Sorry for Confusing !

About Display Sequence.... I just mean you should get sure the Displays shows data in same way as you expect!
I never use the raw Max Chips myself ..... But some users do and most of them have the problem of reversed Numbers......

Do you make the test with a Empty MAX Tube OR do you make the test already with a raw chip ?

I not know what the other guys make wrong..... May they simply not think about the "reversed" logic that 7 is Left and 0 is right..... OR they think about that BUT the raw Max Chip work different to the China Tubes and here Dig 0 now is realy the left one and Dig 7 is the right.....
Simply try out by testing one of the DIG lines.... then you know how it will look like !

*****
About Number of Tubes/Chips.
This is my personal System.
I can say in the past i build for testing multiple chains.... (And sure i use them electrical correctly without Diode or with own 5v Power individual !)
My result.... Chains up to 3 Displays worked fine..... Chains 4-5 Displays worked 95% OK..... Longer Chains have sometimes issues.
Otherwise we get users who work with 8 Tube Chains without any problem..... So maybe my Tubes was low quality ???

BUT For myself i decide to reduce Chains from now till forever as much as possible to simply prevent this situations.!
Maybe senseless and not needed..... But result is fine and if Pins are left... why not !
Good Luck !
2021-04-15 01:01
icon