SimpleINS - a X-plane/DCS INS/UFC

A month or two ago I came across a really neat unit on aliexpress:

It’s a TM1638! Though that is technically the name of the chip, these boards can be found online on more local hardware websites or the massive juggernauts for less then 2 euro’s!

The chip got my interest because I had been building a INS unit(still am) with a MAX7219 chip. This board had a whole 4x4 button matrix already integrated!
The QYF-TM1638 is the version with more buttons and less LED’s. There is also a 8 button and 8-LED version floating about that works almost the same.

So I ordered two of these and got to work. The idea is to get a cheap INS unit that requires no coding, just uploading on the users part and can be done by anyone that can read.

The TM1638 is controlled by an Arduino/python compatible board. Currently I am developing the code on my laptop with Pyfirmata/Pymata, a python implementation with the firmata protocol that runs on the Arduino, which itself is based on the well known MIDI protocol(yes the audio one).

The code I am developing is suitable for X-plane 10/11 and DCS(with a operational DCS-BIOS installation) and communicates over the UDP protocol. This means that you can run it locally on the same computer or networked over a computer.

For those of you playing along a home there is a Github repository at GitHub - TheAlmightySnark/SimpleINS: Flightsimulator INS files.

I will not place direct buy links for products given that the hardware is easy to find locally or internationally if one so desires.

The Bill of Materials currently stands at:
QYF TM1638 (About 2 euro’s)
Arduino based board(Nano/Uno original/clone) (about 2 euro’s)
Laptop or computer with USB output and a cable that fits the Arduino board of choice. (yeah erm… you ough to have this already :wink: )
Python 3.7 installed with Pyfirmata. (free!)
3D printed enclosure(unknown price)

The end goal is to produce a small INS unit as cheap and easy as possible and have a relative accessible way for people to learn interface building for simulators!

Some ‘vanity’ shots to show that it is currently communicating with X-plane.

Happy to discuss/share/receive idea’s and input! Been working on this almost daily for about two months now and making some good progress.

15 Likes

Fun project!
I’m following…

3 Likes

It is! Happy to discuss any specific questions related to inputs and outputs! That’s question with myself kicked off this project

Viggen computer possibilities?

@outbaxx has done some work on that…

3 Likes

Yes relatively easy too, it’s a matter of changing the commands the computer needs to send. For example pressing the UFC button 1 on the Harrier is a matter of sending a UDP command to the computer running DCS and DCS BIOS. It’s something like “command UFC_1 1\n”. Not quite sure, I already forgot exactly which one I used for testing. It’s easy, that’s what I am saying :wink:

3 Likes

I’m looking at the video and I’m thinking how great that would be…and then remember that I couldn’t see it while using VR…quite the conundrum :thinking:

3 Likes

I would like to try and build it and place it in real space, where my VR image tell me it should be, and see if I can use it. Wouldn’t need the display, if that works in VR.
Sorry for the hijack. @TheAlmightySnark :slight_smile:

3 Likes

No worries, I am fully open to expand the conversation here. I just try and use off the shelf parts, but making an input panel that is viggen like suited for VR ough to fit right in!

@Hangar200 just checked, the UFC clear button on the harrier can be controlled by sending a UDP command “UFC_CLEAR 1\n”. Where by 1 is pressing it down and 0 letting go.

It’s quite easy making a simple input panel for DCS once you get DCS-BIOS functioning!

On another note, the TM1638 now fully works with X-plane. It’s not as fast as I’d like but let’s call it V0.1!

Now to finish the housing!

1 Like

I know this is a old post but I was wondering if you ever finished the project. I am trying to share a radio project with DCS and x-plane. I have tried you example Python scripts and they do not work. Specifically the decoding of the UDP data. I am not sure witch version of Python you were using, I am using the latest Python 3, It does not like this statement “unpacked = struct.unpack(”<4fHH%ss"%(len(data)/4-20), data)"
Any help would be appreciated.
Dave

Hey Dave! I did at one point and switched a bunch of stuff around. Let me dig in for a minute. Did you install any extra packages with the pip command?

Thanks, I truly appreciate it.
Dave

I did install pyfirmata with PIP and maybe a few more. I am not much of a programmer so I have hit a lot of road blocks I have difficulty overcoming. Thanks again for getting back to me. Looking forward in seeing what you have done.
Dave

Been looking into it for a bit but not quite sure what could be causing this not to work to be honest. Got any specific error you can post for me, perhaps that could put me on a path to finding what is going wrong!

I have made three radio panels for DCS that work just fine. I also fly in X-Plane and would like to use the radios while in X-plane. In DCS everything is good, I use SOCAT to make the connections. The idea is to make a program that receives X-plane data and translates it to drive the displays. I wanted to use your code as a base to get started. I have been able to receive and decode X-plane data. I can receive UDP data from DCS now but only a limited amount so far.

I did use your code as a starting point. Over the last day or so I have made some progress. I have not coded in Python much so the going is slow.

The errors I received with your UDPcapture.py were :

  1. Line 11 sock.bind((MCAST_GRP, MCAST_PORT))
    sock.bind((MCAST_GRP, MCAST_PORT))
    OSError: [WinError 10049] The requested address is not valid in its context

If I change the line to: sock.bind((’ ', MCAST_PORT)), it works.

  1. line 22 unpacked = struct.unpack(“<4fHH%ss”%(len(data)/4-20), data)
    unpacked = struct.unpack(“<4fHH%ss”%(len(data)/4-20), data)
    struct.error: bad char in struct format

I have managed to work around these issues but I do not know why your code did not work.

Thanks for your help.
Dave

2 Likes

That is a beautiful stack!

Secondly, no idea why it should fail, the MCAST_GRP is a way to define multicast groups and I have no idea why a static class call would fail… Glad to see you managed to work around it but I am out of idea’s currently, haven’t programmed in a little while so i’ve been digging in my own grey matter regarding this :wink:

I got ti working I can now receive data from X-Plane 12 and run the displays programmed in DCS bios.

It took me a few weeks but I solved issues one at a time. Thanks to you and other that have posted their code helps people like me who have never programmed in Python get things done.

The code is not clean and tidy but it works. If you are interested take a look at my github page

Thanks again for your help
Dave

2 Likes

Correction
https://github.com/DaveC3/Xplane2DCS_Bios

2 Likes

It shows a 404, have you perhaps set it to private?

I do see this one as public in your profile, but it is empty:

~~https://github.com/DaveC3/Python-Xplane2DCSBios~~

EDIT: link above from Dave works now: GitHub - DaveC3/Xplane2DCS_Bios: Receive xplane data to display on DCS Bios panel