- Max7219 & 7 Segment Displays
Wiring And Basic Tutorial for Mobiflight & Prosim using Ardunio Mega
Wiring 7 segment displays (MAX7219 boards) to Mobiflight & Prosim can be a little taxing at times. However, 7 segment displays play a very important part in the sim and make various panels come to life. At the start I was fascinated by them. It took a little while to get my head around how you could have so many led segments light up using just 5 pins. I had each 7 segment display using 3 pins each of the Arduino. At that rate, it would have needed a lot of interface cards. I soon learned that the 7 segment displays could be daisy-chained and up to 8 units (Mobiflight limit for daisy chaining) can be controlled by just 3 pins on the Arduino. (This is future Karl here, if you want 100% RELIABILITY, Use 3 pins per display!)
7 Segment Display - General
The first thing you need to know about standard 7 segment displays from eBay or other providers that come with the attached PCB is that they are driven by a MAX7219 chip at 5VDC. The displays are normally Common Cathode!
This is important if you want to connect different size/amount of segments or colour of segments to the boards.If you want to change the colour/size/amount of digits you will need to purchase these from eBay or elsewhere seperately and wire them to the boards instead of the two, 4 digit-seven segments.
I have had a few people state that, "they are running up to 30 max 7219 boards direct off there Arduino Mega Board". However, from my personal experience and a lot of testing. I can only get a max of 6 working in one daisy chain and that nearly pulls the maximum allowable current from the Ardunio. Running all those LED’s, 7 segment display’s and encoders, I have found is just too much for the Arduino mega on the current draw.
When i first tackled this hurdle, I connected as many boards in daisy chain to minimise pin usage, but strange things started to happen, I would turn an encoder and the whole unit would switch off and restart. Very annoying at best. The other fault was that the 7 segment displays started to indicate gibberish. This was all fixed by wiring the encoders and 7 segment displays to an external 5v power source.
7 Segment colour
During my prototyping and my build of version 1 SIM, I was not bothered about the colour of the LED segments, as this was just a prototype to see if i could get it to work. It was more a matter of getting it done cheaply and effectively.
Red is the most common colour and readily available. It also appears to be the cheapest. Red usually comes with the Max7219 Boards. As time progressed, I discovered other colours. Blue, Yellow/Amber & white, depending on your preference. I now have a blue MCP, but also have the option of yellow as I bought multiple colours, recently.
7 Segment Display - Daisy Chain Realiabilty
After several weeks of testing every combination possible, I came to the conclusion that the more modules you daisy chain together, the less reliable they become. This is regardless, if you are powering from the Ardunio direct or external power source.
Here are my current recommendations for Daisy Chaining 7 Segment displays:
Which Max7219 Board?
Predominately, there are three different types available on eBay. They are colour coded by PCB.
A green PCB normally has detachable displays, and comes with attaching hardware. This is great for ease of removal so you can then change the size or color as required.
This also allows you to place the two halves (4 digit displays) anywhere you like. These are my preferred type.
The Blue backed PCB's are great when you have a narrow space top and bottom. But the displays will need to be removed with a heat gun.
The Red backed PCB's are great for applications where space at the ends is a priority. They have the shortest width. Again, if you want to separate the displays you will require a heat gun.
Purchasing Max7219 Boards
When buying from eBay I tried several variants from eBay. This is where I learned the quality really does depend on who you buy from. Make no mistake, I went cheap from china and it took several attempts to find the right one. The biggest problem I found, was that they worked fine individually, but some just refused to daisy chain. Push on the PCB and it would work fine. Release the pressure and utter disaster. Some just decided they would rather heat up and burn out.
Once I found the right supplier of MAX7219, I bought in bulk, 20 in fact, at an incredibly cheap price and free shipping. Your going to need plenty of these when you full on, From MCP to radios and other panels. It also means you have spare for when you find an unserviceable one.
Here’s some tips on buying the right MAX7219:-
•Ensure it has 5 pins at both ends to allow daisy chaining.
•Look for the units that have the display units with sockets rather than soldered (usually the PCB is coloured green). This will allow you to split the displays and place them where ever you want by using additional wiring.
•Its great when you also find the ones that come with the PCB mounting screws and stand offs included.
7 Segment Wiring - Using Ardunio Power
There are generally 5 input pins and 5 output pins on each board. The 5v VCC must be connected in parallel to each board and not daisy chained through the board itself, like the other pins. This VCC line has a diode fitted and will reduce the voltage through each board until it stopps working.
The ground can be daisy chained but I prefer to wire in parallel like the VCC.
The next 3 input pins (DIN,CS,CLK) can be daisy chained through the board by using the same output pins, as shown below.
Test, Test & Test Again!
Test, Test & Test Again!
Always test your 7 segments in the conﬁguration your going to use before putting them into anything. This includes the length or the cables, the amount you wish to daisy chain. Are you still having problems with strange digits after all this? One ﬁnal thing to check is the power at the last 7 segment unit. Ensure its at 5V. If not adjust your power supply until it reads 5V. “CAREFULLY!”
MAX7219 - WIRING 3 & 5 DIGIT DISPLAYS
Up to 50 switches can then be added. I have shown only two switches to help keep the diagrams simple. But the principle is the same. You can see how the ground is simply daisy chained. This is to keep the wiring back to the Arduino to a minimal amount. The looms already can get quite big in size with 52 wires.
Daisy Chained Grounds
There are only 3 or 4 grounds on the Arduino Mega to connect all your devices too.
Sometimes its easier to connect all the grounds in daisy chain configuration. Linking devices to one and another using a single ground back the Arduino Mega.
Another way would be to used a break out board with a common ground connected line.
But by daisy chaining grounds, the wiring loom can reduced drastically.
MAX7219 - WIRING 3 & 5 DIGIT DISPLAYS
As stated before, you dont have to stick with 4 & 4 displays. You can have any combination:
3 & 5 Digits
2,2,2,2 (4 sets of 2 digits)
4,2,2 (one four digit and 2, 2 digit displays)
6 Digit Display, etc.
Below is how to wire up a 3 & 5 Digit display to the MAX7219 board to be controlled by the Ardunio and Mobiflight. The first diagram are the pin allocation of the MAX7219 Boards. (D#=Digit Common Cathode Number one to eight, the letters represent the segment letter)
3 DIGIT, 7 SEGMENT DISPLAY, Picture, Segment diagram and pin layout.
5 DIGIT, 7 SEGMENT DISPLAY, Picture, Segment diagram and pin layout.
Converting a 4 & 4 digit display to a 3 & 5 Digit Display WD
Please Note: You must connect the ground cable from the 7 segment boards, the external power supply and the Ardunio board for everything to work.
7 Segment Wiring - Using External Power
Wiring the MAX7219, 7 segments displays boards to an external power supply helps reduce the current draw on the Arduino.
As you can see from the diagrams, the 5v VCC line is connected in parallel to all 3, 7219 PCB's.
The GND line in also connected in parallel and also connected to the Arduino.
The data pins are then daisy chained as normal.
A to G 7 DP
You can connect the letters A-G & DP from one side of the max board by daisy chaining them to the 3 & 5 digit dispalys. You do not need to connect wires from the right to the 3 digit display, and the wires from the left side of board to the 5 digit display. They are common or connected together!
YOU CAN NOT DAISY CHAIN THE D1 TO D8 COMMON CATHODES!