MCP x737 for XPlane with Arduino - Homemade Homecockpit
This is not a tutorial, it's just some notes about my experience building an MCP 737-like compatible with XPlane 10 using Arduino.
I based my work on the x737 of Benedikt (http://www.eadt.eu
), which is a bit different from others XPlane planes, but the MCP can be easly adapted to other planes.
To realize the MCP it took 6 months of studies in different fields, hardware, software and research of suitable electronic compontents.
Here i'm explaining the phases of my experience:
Communication between XPlane and Arduino
It took some time to understand the best way to make Arduino to comunicate with the x737. I started analyzing the XPlane datarefs but than i discovered they was not compatible with x737 Plugin. Than I analyzed the x737 datarefs and started to make some tests. In a first moment i developed a plugin in c++ for Xplane which was working quite well but after some times i discovered the existance of a plugin which is called ExtPlane (https://github.com/vranki/ExtPlane/) which is very useful for my needs. So I stopped developing my plugin and i concentrated on ExtPlane. ExtPlane is very useful to read and write datarefs and very simple to use.
Once I decided what was the plugin to use in XPlane, i started coding my Arduino to receive and send data to XPlane. Here you can find the ZIP with my Arduino code to comunicate with XPlane. This is the not the final release (the code is also very messy, but it works) of my MCP, but it includes other features like reading encoders, writing 7segment displays, etc.
The communication is done via TCP protocol. Arduino connects to standard port 51000 of ExtPlane and subscribe to datarefs MCP will need. From this moment the plugin will start send all relevant infos to Arduino which will read and execute.
Understanding which hardware to use was a difficult part, also because I had to check everything in Internet from datasheets since i could not find any specialized shop in my city where to buy or check components.
My MCP panel is using:
To drive the displays i used 5 MAX7219 (http://playground.arduino.cc/Main/MAX72XXHardware). With this amount of leds, it was required to use not more than 2 or 3 MAX7219, but in the reality wiring all these displays was quite difficult, so i decided to use more MAX and make things easy for me.
To drive such amount of buttons and leds i had to use some shift-out registry 74HC595 and shift-in CD4021. You can easily find tutorial how to use these 3 components in internet or in Arduino forum.
- Arduino Mega with Ethernet shield. Probably is possible to use a smaller Arduino. (Im using 9 digital pin and 10 analogic inputs for 5 encoders)
- 7 segments display with different sizes (2,3 and 4 digits) 0.36 inch. For 5 digits display I used 2 displays 2+3 digits.
- Course1, HDG, Course2: 3 digits
- IAS/MACH: 4 digits
- Altitude and Vspeed: 5 digits
- 13 buttons with led, for H1, SPD, HDG; CMDA, ecc. I used these buttons (EAN: 2050000219917 - Link) but i needed to adapt a bit.
- 2 leds squared
- 3 switches
- 3 rounded buttons
- 1 squared button
- 5 encoders with leds (EC12PLRVF-D-24K picture here)
- a lot of wiring and some proto board
- 6 MAX7219
- 2 74HC595
- 3 CD4021
To connect all the compontents it took a lot of time and test. Some wiring was quite difficult.
Once identified the hardware i needed to understand how to create the panel. I have been searching for different materials like wood, plastic, alluminium but in the end my decision was to use the plexiglass.
A friend of mine has a small factory and he has a machine to cut plexiglass with laser so it was a great opportuinity to cut such difficult design.
Next step than was to realize a CAD (download here DWG PDF) model of the panel. I drew it checking carefully all the size of the components (some of them i didn't even had phisically with me) from datasheets and with some luck i managed to draw the model.
I cutted it and this was the result:
The plexiglass size was about 450x75x6mm.
The cut was perfect and i had some troubles only with the 13 buttons with led. They couldn't fit inside but trimming them with some tools i managed to fit them. I also had troubles with rounded buttons because the top of the button was high only 6mm exactly like my plexiglass panel. After a bit of thinking i decided to drill the panel from the back for around 3mm, so the button could go inside, and the head go out from the front.
Assembling the MCP
To assemble all the components it took about 2 weeks of hard work. Since some of them are not projected to be assembled on the board, it was quite difficult to create a unique big board containing all the components. I decided, first of all, to use one proto board for each couple of 7segment display and encoder. On each board i added also the required resistors, capacitors and everything else was needed. I added some input and output pins to connect the board and also the power plugs.
About all the other components i decided not to use any board and to apply them directly on the panel and wire them together.
Plexiglass is a great material and very useful for this kind of applications, but unfortunately is quite difficult to color. I used 2 different color cans. One is the "primer" as base to allow the color to sticks to the plexiglass, than I use the color RAL 7031. Of course the panel was colored before assembling the components. The result, in the first moment, was quite satisfactory, but on the plexiglass the color is removing very easily. So probably in future i will disassemble again the MCP and I will try to scratch a bit the surface of the panel to make it more rough.
After 6 months of work, this is the result. For sure is far to be a professional work, but the satisfaction to see what you was thinking is now a reality is huge! The only missing thing at the moment is the labels on the panel, because with plexiglass i think will be quite difficult to find a way to draw it in a permanent way.
I hope this short guide will be useful for someone and if you have any question you can write me at antonio(A T)lapadula.eu