Skip to content

The Geek Forge . com

I will only ever be, half the Geek that I wished I was.

November 17, 2014

A few folks have asked me how to connect a MAX7219, 8 Digit, 7 Segment, Tube Display Module to an arduino and code it to display information from Flight Simulator X (FSX) via Link2FS.
Below are pictures and explanation of one way to set this up.
At the bottom of this article is a working but limited Arduino Sample Sketch that will only display the Autopilot Altitude Set from FSX via Link2FS.  The Arduino Code has been mostly stripped down to this one function for simplicity and is remarked heavily for educational purposes.

20141116_020052_800x

In the picture above I am using an Arduino Leonardo Clone.  An Uno or Mega will also work.
To connect the MAX7219 to the Arduino, we use 5 wires connected to the 5 pins on the left side of the module.  Three of them are for communication and two are for 5 Volt and Ground connections.
In this particular example I use pins 10, 11, and 12.  If you compare the wire colors in the picture below with the picture above, you will see Orange, Data (DIN) is connected to pin 12, Yellow, Load (CS) is connected to pin 11, and Green, Clock(CLK) is connected to pin 10.
Red and Brown are connected to 5Volt (VCC) and Ground (GND), respectively.

The Modules have another set of pins on the right side of the Printed Circuit Board (PCB), that are labeled nearly identical to the left side. The right side pin labels are on the backside of the PCB.  They are VCC, GND, DOUT, LOAD, CLK.  If you have more than one module that you want to “chain” together then you do it through these pins.  The second module’s left side, DIN, CS, and CLK would go to the first modules right side DOUT, LOAD, and CLK.

NOTE:  Do NOT chain the VCC 5Volt and GND from one module to another.  As I understand it there is a diode in each module that will drop the voltage on the out going side.  It may work ok with 2 or 3, but if you chain more you may be looking at dimming digits or failure to function.  So, it’s easy enough to run the 5Volt and Ground to a common bus from the Arduino.

20141116_020130_800x

In the picture below you can see we are connected to Link2FS and receiving the Autopilot Altitude Set as it is present on the display.

20141116_020212_800x

 

Link2FS Output to Arduino

20141116_020246_800x

In the above picture you can see what Link2FS sends to the Arduino when the Autopilot Altitude Set is at 18000.
=b18000
First the Arduino Code looks for the “=”.
After finding the “=” it checks the next character and find a “b”.
The “b” tells the “Switch Case” in the code to start storing and display the Autopilot Altitude set “18000”.

20141116_020238_800x

 

Hardware Notes:

20141116_020359_800x

The picture above is just to show how the displays can be tethered away from the module.  On my first go, I used male/female jumpers.  I found that the female connection to the displays would sometimes become loose and subject to vibration making the connection intermittent.  This would result in some or parts of the display digits to flicker or go off completely.  Jostling the wires would cause it to work again.  This picture has soldered connections on the display side, with heat shrink covering.

The Jumpers and Heat Shrink

20141116_020450_800x

Pictured above is the type of jumper wires needed to tether the displays away from the module.
The leads have round male connectors.
NOTE: Dupont brand wire jumpers with square male connectors that work fine with Arduinos, will not fit the female connection on the Max7219 display module.

The picture below:
If you find the need to do a lot of soldering and cover the connections with heat shrink, it is far cheaper to buy heat shrink by the 100ft spool.
I used 3/32 for the above wires.  I found the 100 foot spool on ebay for about $13 US.

20141116_020518_800x

 

Here is the Code with a lot of Remarks
I tried to format it for understanding.

 

August 5, 2014

This project was conceived and started with the ordering of parts around Sept-Oct, 2013.
Functional construction and coding was completed mid Nov, 2013.
A friend and I worked on this together.  He was also building a radio.  His was a bit different than mine with a smaller footprint for a fighter cockpit setup.

20140107_105555_640x480If you are an ate-up, Flight-Sim geek, then you may have a setup similar to that above.
In the picture we have MicroSoft Flight Simulator X (FSX),  CH Yoke, CH Throttle Quadrant, CH Rudder Pedals (on the floor), three 24 inch displays in span view, a single 21.5 inch overhead display, TrackIR (head tracking device), and on the right side of the desk, lit up with red 7-segment displays, is a custom built Radio Stack of which this article is about.

 

Here is a close up with a $1 bill for scale.

Acknowledgements

This project would not have been possible without a software interface program that allows Arduino cards to talk to FSX.  The program is called Link2fs and was written by a man named Jim who lives in New Zealand.  I have been following Jim at jimspage.co.nz for a number of years.  He has built at least two incarnations of a flight simulator motion platform.

A motion platform is the dream.

I had dabbled a bit, in the past, with Arduino.  Once I built an interface for a recumbent stationary bike-to-PC using an Arduino, a magnetic reed switch, and a game controller.  It allowed the user to run in first person shooter games by pedaling the bike.
When I read that Jim had discovered Arduino and he had written the Link2FS interface software to talk to FSX, I had to give it a shot.

 

Disclaimer

Let me warn you…
If you start down this path of building interface devices for Flight Simulator, it is a dark path and it never ends.  Each new buzzer, bell, or whistle that you make will give you a “discovery and accomplishment” high.  It will make you feel as if there is nothing you can’t do.  But the high is fleeting.  It does not last. You will soon become discontent with the status quo.  Then you start thinking, “Well it would be easy to add this or to add that.”  It won’t stop until you have a full scale replica cockpit consuming substantial square footage of living space in your home.  If your family is lucky, you prefer small general aviation aircraft over commercial jets.

 

First We Crawl

The first thing I needed to do before ordering some of the more pricey parts was some proof of concept testing.  I had downloaded Jim’s software and had confirmed that it did indeed connect to FSX and could change things, like radio frequencies.
Next, I hooked up a simple push button switch on an Arduino clone and modified some of Jim’s example code, to make the switch change one of the radio frequencies in one direction.
That’s all it did, you press the button and the Mhz go up by one tick.
As simple as it was, it gave me the first rush.
One of the other things I did, not pictured, is wire up some LEDs as Landing Gear status lights and used some more of Jim’s sample code to make them work.  By experimenting with the Link2FS software and different Arduino code, it allowed me to learn more about the nuance and communication relationship of FSX to Link2FS and Link2FS to Arduino.

20131003_155237-640x480Arduino Leonardo Clone with simple push button switch.

Pictured below is a snapshot of an older version of Jim’s Link2fs_multi program.  It is the program that interfaces FSX to Arduino.  It is the middle man, that sends and receives from FSX and also sends and receives from Arduino.  The “multi” version allows you to control multiple Arduinos with one instance of the Link2fs program.  Need more Arduinos than one instance can handle?  Not a problem.  You can also run multiple instances of Link2fs_Multi.
FSX <-> Link2FS <-> Arduino.

20131003_155349-640x480Link2fs_Multi, interface program for FSX to Arduino.

The Acquisition

Now that I have proved that it is possible to change things in FSX from an Arduino, it is time to start finding components to build a Radio Stack.
Many different aircraft avionics utilize “Dual Concentric Rotary Encoders”.  These are basically 2 dials in one.  Elma makes a good one in the E37.  Unfortunately, they aren’t cheap and they aren’t easy to come by.  There is one guy on the planet, that I know of, that sells them in single quantities and that’s Leo at leobodnar.com in the UK.  At the time of this writing one E37 with knobs, from Leo, shipped to the US via Royal Mail Airmail would be $40.26 USD.  In Dec of 2013, I had enquired at Elma to see what I could get if I wanted to buy bulk.  At 100 units they would cost $17.50 per each not including knobs.

I bought three E37s from Leo, one for me, one for a friend and one for a spare or future project.

20131026_214818-640x480Elma E37 Dual Concentric Rotary Encoders.

Since I didn’t want to drop big money for multiple Encoders, I decided to use a Rotary Switch as a function selector on the Radio.  You dial the function you want with the switch and then use the encoder to change the frequency.
Functions that I coded in were: COMM/NAV 1, COMM/NAV 2, TRANSPONDER, ADF, and a limited AUTO PILOT function for experimentation.

20131029_125459-640x480Rotary Encoder on the left.  Rotary Switch on the right.

The Elma E37 Rotary Encoders are not plug-and-play.  They come with a small Printed Circuit Board (PCB) that needs to be soldered to the encoder.  The PCB has marked pinout holes in it that allows you to also solder wire leads to it.
When I first coded the Arduino to work with the Encoder, again taking Jim’s sample code and modifying it for my purpose, I got the accomplishment rush again,  “I am turning a knob and the frequencies in the sim are changing!  So cool, so cool!”   When I showed it to my friend, his response was a satisfied,  “Ok, that’s perfect.  I’m done.”  As if that is all he needs to make him happy, he needs no more.  But no, that was just his first “high“.  We didn’t even have the 7-Segment Displays yet.

20131029_125714-640x480MAX7219 8-Digit 7-Segment Tube Display Module

While looking for a 7-segment LED display solution, I came across a number of possibilities.
Some were serial driven modules that had 16 digits.  I had also seen other folks actually drive multiple single digit 7-segment displays by multiplexing outputs on Arduino.  An incredible accomplishment with an insane amount of wires but way too complex for me.  Plus it uses too many Arduino input/output pins.
I finally stumbled onto the MAX7219 8-Digit 7-Segment Tube Display Module.  The chip on the Module is the MAX7219 which is the driver for the displays.  In short, it receives a serial instruction, displays what the instruction told it to display, and holds that display until told to do otherwise.
These displays work with the LedControl library for Arduino.
The beauty of these display modules is that they are comprised of two 4-digit displays that are not soldered to the board.  They are in sockets.  This got me to think that I can tether these displays with wires and place them any where I want to on my radio without the PCB getting in the way.
The other great thing about these displays is that you can chain up to eight of them together and only have to use three pins on the Arduino.

20131029_021651-640x4803 MAX7219 Display Modules chained together for testing, pre tethering.

 

20131102_023537-640x480Here are 3 MAX7219 Modules with the 7-Segment Displays tethered away from the boards.
Also pictured is the Rotary Encoder, Rotary Switch and Arduino and experiment board for wire junctions behind the Modules.

Box It Up

The hardware and software are now working together.  We need to get all of those wires in a box.

20131107_121005-640x480This is the face plate that my friend helped me come up with.

 

20131107_232320-640x480The rough fit.  I added a 4th MAX7219 Display Module for Transponder and DME.

20131108_234100-640x480The back side fitting after paint had been applied.

20131109_024326-640x480Lexan cover for the face plate.

20131109_021000-640x480Backside with a dollar bill for scale.

Acceleration on the Encoder and updated functions.

Notes

After months of use and testing, some things I would do differently…

The female end of the tether wires on the 7-segment displays doesn’t cut the mustard.  Sometimes, from movement, the segments on the displays will flicker because of the female ends slipping.  A little jostling and they work.  To do it better, the tether wires need to be soldered to the 7-segment displays.  The other end of the tether wire can still be plugged into the MAX7219 Module without problem.

I am planning on designing and building a new Radio Stack with multiple displays and multiple encoders instead of sharing the main display and encoder with multiple radios.

The Sickness Continues…

20140124_212133-640x480Scale print out of the next project, a Mode Control Panel (MCP)/Auto Pilot for a Boeing 737.

 

 

 

May 30, 2014

Catch Up

Good golly, it’s been almost a year since my last post.  I blame apathy. Last November I built a Radio Stack for Flight Simulator X (FSX).  It uses an Arduino Leonardo clone, and third party software called “Link2FS_Multi”.

I didn’t have to use a clone, its just what I had on hand.

Other parts used:
4 MAX7219 display modules to drive the 7 segment displays
1 Elma E37 Dual Concentric Rotary Encoder with push button
2 Momentary Push Switches
1 Toggle Switch
1 Rotary Switch

FSX Radio Stack

FSX Radio Stack

After the Radio Stack, I got cocky and started work on a 737 style MCP/autopilot.
It uses the same type of interface, Link2FS_Multi to talk to FSX, but this time I used an Arduino Mega.
As of this writing the MCP is still under construction, but is partially functional.
I plan to program it to work with the PMDG 737NGX.  Not a walk in the park, as PMDG uses proprietary offsets with their aircraft. Fortunately they publish the offsets.

FSX 737 MCP Autopilot

FSX 737 MCP Autopilot

 

I NEED TO…

I need to document these projects with more photos and detailed explanation.

 

June 28, 2013

This is to help others figure out how to send data from an
ARDUINO with ETHERNET to a MySQL database
via the POST method through a PHP page.
 

 

Arduino Uno with Ethernet Shield

Arduino Uno with Ethernet Shield

I am not an expert. 
I am just a hack.
I do not understand all of the code nuance.
I take what others have done, substitute my variables and modify the code to my requirements.
There are a million ways to skin a cat.
This is one way that I have muddled through.
I don’t go into how to set up a MySQL data base, try google.

ARDUINO CODE 

Next…
Make a PHP file called config.php.

CODE for config.php

 

AND ‘DEN…
Make a file called update.php

CODE for update.php

 

NOTES

Multiple variables being posted might look like…

In PHP you can break lines for readability.
End of line or statement is denoted by a semicolon.

 

May 29, 2013

I had decided to try and document my projects for posterity, and to possibly aid others with similar projects of their own.  Hence, this site.  The documentation of these said projects, is a project in and of itself.  It takes time to take pictures, upload them, and write things about them.  It takes even more time to take good pictures, upload them, chronologically display the progress and write coherent things about them.  Time is probably my biggest hurdle…next to The Latest PC Game addiction (which eats up time).  But also, there is that whole… working a full time job, being the “engineer” that keeps a house of six occupants operational, being a Dad, being a husband, being a car mechanic, being a computer tech, being a plumber, being a contractor, etc.

 

So far, I have failed at project completion and documentation.

 

I have ideas.  I have experimented with my ideas for proof of concept.  If I can focus, pull it together, follow through, get it done, and document it, I think I’ll have something worthy to share.

January 19, 2013

I will only ever be, half the Geek, I wished I was.

Fortunately this allows ample room to grow.

I go by a number of names, Fess_ter_Geek, Fess_ter, Fess, and at work, they call me Fesstus.  I’m married with four, home schooled children, seven desktops, and two laptops in the house.  I build my own desktops and usually overclock to boost the price/performance ratio.

The first pre-built, store bought, desktop that I purchased was a Packard-Bell 486sx 25Mhz sporting a 5.25in floppy and a 3.5in floppy. It did not come with a CD-Rom drive or a sound card. I had to add those later and I also upgraded the processor which was the start of my computer hardware knowledge that eventually lead me to build my own.

atari_800_20001a

My first exposure to a computer was about 1979 when I was 11 years old. My Uncle Norm, sold computer learning systems to schools, so as a salesman he had one for demonstration.

It was an ATARI 800, 8 bit computer. It was big, beige and brown and it was beautiful.  When my mother and I would go and visit them, 3 hours away with a “55 stay alive” speed limit, I would stay up until 3 or 4am playing Star Raiders until my eyes bled.

atari800xl

Around 1983-84 my mother relented and spoiled me with an ATARI 800xl of my own. It was a more modern looking machinealthough, disappointingly, it couldn’t run some of the original 800 software.  As I recall, some of the older titles could be run by using a “Translator” disk but there were others that wouldn’t run at all.  I still have my old 800xl in the closet.  Every four or five years or so, when the nostalgia hits me, I pull it out, plug it in, and relive a few old memories.  I took that machine to college with me and turned in a crappy paper or two written on ATARI Writer word processor and printed on an ATARI daisy wheel printer. (Whrrrrrr chunk chunk chunk whrrrr)

After college, the procurement of employment, and marriage, I started to get into the IBM type of machines or “clones” as they used to be called.  Today we call them “PCs” (pee-sees).  My wife brought to the marriage, in her dowry, an actual IBM PS2 that cost as much as a used car.  It was a 386 16 Mhz and sported the new IBMMicro Channel Architecture, MCA.  IBM was going to change the industry with MCA.  It was kind of like PCI slots. They were faster and “better” than ISA slots.  But, the “industry” thought otherwise and MCA was short lived.  The 386 had no sound card, most computers didn’t, and you couldn’t find one for it because there were very few MCA cards around.  With no upgrade options this led me to buy the first Packard-Bell.

p2450

Over the years as computers got faster and my knowledge grew, I started learning about overclocking.  When Intel came out with the Pentium II, their top end was a 450 Mhz processor. I was contemplating building two identical machines, one for my wife and one for me. It was going to cost a “Mint” for two top end processors. Fortunately, my timing and research revealed that Intel’s lower end processor, the Celeron 300a with a smaller on die cache could easily overclock to 450 Mhz and yield identical performance, in some cases higher, than Intel’s PII 450.  That was my first stellar overclock and price/performance, value success.  In the years since, my system builds have migration between AMD and Intel systems depending on which one was deemed best at the time for the price/performance ratio.  As of this writing I have both AMD and Intel systems running in my house.

In the last couple of years I have started tinkering with Arduino. If you have to ask, Google it.

I have been slowly remodeling my house. If you have ever dug remotely, into a home repair or modification job, you have likely found out that attempting to do one job usually reveals two other things that need fixing.

I like computer games, BF3, Flight Simulator, and others. One of my all time Uber Geek dreams is to build a full motion flight simulator platform. Oh yes, someday it will be mine and I will make it. In the mean time, I intend to learn to interface Arduino with Flight Simulator X via FSUIPC.  Speaking of Flight Sim, at one time I was involved with a Virtual Airline on VATSIM and did a lot of PHP web work for our site, learning as I went.  Then we had child number 4 and leisure time was gone.  I learned just enough PHP/MYSQL to be dangerous but not proficient.

I play guitar, rhythm and chords mostly.  If you don’t play guitar, I sound really good.  If you do play guitar then, I’m just a hack like all my other “talents”.

Well that’s the start, anyway…