Arduino, Flight sims, and SPAD.neXt

Graphics Cards, Sound Cards, Joysticks, Computers, etc. Ask or advise here!

Arduino, Flight sims, and SPAD.neXt

Postby OldAirmail » Sat Jan 07, 2017 5:08 pm

This is just a heads up of something that may be (hopefully) coming soon.


The guy who developed SPAD.neXt has built, and is testing, an interface connecting FS9, FSX, P3d, and X-Plane to an Arduino board.

SPAD.neXt works with all of those already, but his Arduino-flight sim interface would allow the use of 7 segment displays & servo motors in addition to button/encoder/joystick with your flight sim.

In short - You could make your own digital & analog instruments.

He CAN do it now, but he has to make it fool proof. If he can do that, then the sky is literally the limit.

This is his short transponder code video. (this was a test WITHOUT the 74HC595 shift registers)




You can use an Arduino to make simple button boxes as I've already done, and you don't need SPAD.neXt to use a button box. SPAD.neXt just lets you do a lot more with it than the joystick buttons built into your flight sim.

However, you would also be able to make anything from Saitek type panels up to full cockpits.

The best thing is that this is not rocket science. And it also is not very expensive.



One of the two boards that he's using right now is the Teensy 3.5, so I ordered one and have been testing it with a digital display.

This picture shows several Arduino boards. The 7 segment display is hooked up to the Teensy 3.5.
Sorry for the poor picture quality. :confusion-shrug: In real life all the numbers are evenly lit, and quite bright.
Image
ALL of the Arduino boards above can use the same code to work the display.



If you want to play around with a similar display, you can use the code below.

NOTE - The display board that I'm using has two 74HC595 shift registers. These are very common, BUT they are not the only ones in use.

The display board that I'm using is this one - XINY 8-Digit Digital Display Control Module 8-Digit 7 Segment Digital LED Display Tube $7.60. Similar boards with two 74HC595 shift registers SHOULD work just as well.



Just copy and paste this code (from playground2014) into the Arduino IDE. No modifications needed.

/*
Modify from Liquid Crystal example
For 8 x 7 segment module
*/

#define LATCH 12 //pin 12 of BBFuino connect to RCK of 8x7segment module
#define CLOCK 11 //pin 11 of BBFuino connect to SCK of 8x7segment module
#define DATA 10 //pin 10 of BBFuino connect to DIO of 8x7segment module
#define LED 13 //LED is connected to pin 13 of Arduino
#define MultiplexDelay 1 //delay for multiplexing between digit on 8x7segment module
#define LEFT 0 // define the value for left justify
#define RIGHT 1 // define the value for right justify
#define BLANK 11 //array element to make 7segment blank


// array to activate particular digit on the 8x7segment module
// it is the common anode of 7 segment
byte anode[8] = { 0b10000000, //digit 1 from right
0b01000000, //digit 2 from right
0b00100000, //digit 3 from right
0b00010000, //digit 4 from right
0b00001000, //digit 5 from right
0b00000100, //digit 6 from right
0b00000010, //digit 7 from right
0b00000001 //digit 8 from right
};

//array for decimal number, it is the cathode, please refer to the datasheet.
//therefore a logic low will activete the particular segment
//PGFEDCBA, segment on 7 segment, P is the dot
byte cathode[12] = {0b11000000, // 0
0b11111001, // 1
0b10100100, // 2
0b10110000, // 3
0b10011001, // 4
0b10010010, // 5
0b10000010, // 6
0b11111000, // 7
0b10000000, // 8
0b10010000, // 9
0b01111111, //dot
0b11111111 //blank
};

//fucntion to send the serial data out to two 74HC595 serial to parallel shift register and activate the 7 segment.
void display8x7segment(byte datapin, byte clockpin, byte latchpin, byte digit, byte number)
{
digitalWrite(latchpin, LOW);
shiftOut(datapin, clockpin, MSBFIRST, digit); // clears the right display
shiftOut(datapin, clockpin, MSBFIRST, number); // clears the left display
digitalWrite(latchpin, HIGH);
}

//function to display value on 8x7 segment display according to the justify state
void displayNumber8x7segment(byte justify, unsigned long value)
{

byte decimal[8] = {0};
value = value % 100000000; //ensure the value is within 8 digits only
decimal[7] = value / 10000000; //extract digit 7 from value
value = value % 10000000; //extract the rest of 7 digit value
decimal[6] = value / 1000000;
value = value % 1000000;
decimal[5] = value / 100000;
value = value % 100000;
decimal[4] = value / 10000;
value = value % 10000;
decimal[3] = value / 1000;
value = value % 1000;
decimal[2] = value / 100;
value = value % 100;
decimal[1] = value / 10;
decimal[0] = value % 10;
byte zero = 0;
if (justify == RIGHT)
{
for(byte e = 8; e > 0 ; e --)
{
if(zero == 0)
{
if(decimal[e-1] != 0)
{
display8x7segment(DATA, CLOCK, LATCH, anode[e-1], cathode[decimal[e-1]]);
zero = 1;
}
}
else display8x7segment(DATA, CLOCK, LATCH, anode[e-1], cathode[decimal[e-1]]);

delay(MultiplexDelay);
}
}
else //if justify == left
{
byte d = 0;
for(byte e = 8; e > 0; e --)
{
if(zero == 0)
{
if(decimal[e-1] != 0)
{
display8x7segment(DATA, CLOCK, LATCH, anode[7], cathode[decimal[e-1]]);
zero = 1;
d ++;
delay(MultiplexDelay);
}
}
else
{
display8x7segment(DATA, CLOCK, LATCH, anode[7-d], cathode[decimal[e-1]]);
d ++;
delay(MultiplexDelay);
}

}

}
}

void setup() {
pinMode(LATCH, OUTPUT);
pinMode(CLOCK, OUTPUT);
pinMode(DATA, OUTPUT);
pinMode(LED, OUTPUT);
digitalWrite(LATCH, HIGH);
digitalWrite(LED, LOW); //off LED
// set up the LCD's number of columns and rows:

delay(1000); //delay for 1 second

}

void loop(){

//1st demo, 8x7segment will display decimal value from 0 to 9 and dot from 1st digit (most right) until the last digit (most right)
for(byte i = 0; i < 8; i++)
{
for(byte k = 0; k < 11; k++)
{
display8x7segment(DATA, CLOCK, LATCH, anode[i], cathode[k]);

delay(300);
}
}
delay(1000); //delay 1 second

//2nd demo, 8x7segment will display same decimal from 0 to 9 and dot across all 8 digit
for(byte k = 0; k < 11; k++)
{
display8x7segment(DATA, CLOCK, LATCH, 0xff, cathode[k]); //activate all digit

delay(300);
}
delay(1000); //delay 1 second

//3rd demo, 8x7segment will display a decimal value increasing like normal counter.
for (unsigned long value = 0; value < 100000000; value ++)
{
for(byte i = 0; i < 10 ; i ++)
{

displayNumber8x7segment(RIGHT, value); //display the value in right justify format
}
}
delay(1000);

}
.. .
Get the most out of your controls - SPAD.neXt

Image
. . . . . .Any time, any plane, any weather.
. . . . . . . . . . . . . Prepar3d V3
User avatar
OldAirmail
Major
Major
 
Posts: 4337
Joined: Sun Feb 17, 2013 3:06 pm
Location: Concrete, WA ICAO - 3W5

Re: Arduino, Flight sims, and SPAD.neXt

Postby ermias » Wed Jan 11, 2017 4:16 pm

Hi,

Very interesting project and exciting moment to do more around flights sim. I am also preparing to use Arduino Mega cards to convert my mostly real aircraft panels on my pedestal. I use http://www.mobiflight.com/ 's software to use the cards. Switches, Rotary encoders, LEDS and 7 Segment displays can be used using the above software. The website has English tutorial at the forum. There is also: http://www.jimspage.co.nz/Link2fs_Multi.htm

There are several tutorials on youtube too. I haven't tried the Spad next one.

It is pretty easy and at the same time hard to believe given how expensive replica radios have become. I have put aside my Saitek radio and other panels to build a smaller Cessna panel and replaced them with mostly real aircraft panels off eBay.

Image

Image

Thanks,
ermias
Image

Image
User avatar
ermias
2nd Lieutenant
2nd Lieutenant
 
Posts: 132
Joined: Sun Oct 02, 2005 10:15 pm
Location: KPHL/HHSB

Re: Arduino, Flight sims, and SPAD.neXt

Postby OldAirmail » Thu Jan 12, 2017 12:08 am

VERY impressive! :clap: :clap: :clap:

I'm more of a hack and a tinkerer.

Still, It's amazing how easy it is to make your own equipment with the microcontroller boards that are out there.


No comparison to your set up, but I made this GPS with an Arduino for about $80.

I'm in the process of redoing it now.
Image
.. .
Get the most out of your controls - SPAD.neXt

Image
. . . . . .Any time, any plane, any weather.
. . . . . . . . . . . . . Prepar3d V3
User avatar
OldAirmail
Major
Major
 
Posts: 4337
Joined: Sun Feb 17, 2013 3:06 pm
Location: Concrete, WA ICAO - 3W5

Re: Arduino, Flight sims, and SPAD.neXt

Postby ermias » Thu Jan 12, 2017 1:57 am

OldAirmail wrote:VERY impressive! :clap: :clap: :clap:
I'm more of a hack and a tinkerer.
Still, It's amazing how easy it is to make your own equipment with the microcontroller boards that are out there.
No comparison to your set up, but I made this GPS with an Arduino for about $80.


Thanks. I also like to try and make things before I give up and get the readily available replicas. Then came the idea of hacking the real panels. BTW: The pedestal box is made from plastic cutting boards....

Your GPS looks great. What is the size of the screen and where did you get the dual encoders from? What is your plan for it? Labels?

I had the GPS idea when I was thinking to make the Cessna panel. I am not sure if there was a library for GPS to be used with arduino in the mobiflight's software. I am thinking to install the GPS on the right side of the panel below where the empty space is.

The whole idea of making a smaller panel came because I wanted to use the saitek panels instead of selling them. I will use a flat screen for the gauges from peixsoft.com .

Image

ermias
Image

Image
User avatar
ermias
2nd Lieutenant
2nd Lieutenant
 
Posts: 132
Joined: Sun Oct 02, 2005 10:15 pm
Location: KPHL/HHSB

Re: Arduino, Flight sims, and SPAD.neXt

Postby Boromir » Thu Jan 12, 2017 10:48 am

OldAirmail wrote:VERY impressive! :clap: :clap: :clap:

I'm more of a hack and a tinkerer.


I wish I was half the hacker/tinkerer you are! I follow your posts with great interest and appreciate all you do and share. Do you plan to post your GPS build? (Or maybe you have?)

Anyway, thanks for all...I've learned some, but mostly I'm Thick As a Brick...

Greg
Boromir
Ground hog
Ground hog
 
Posts: 2
Joined: Thu Jan 12, 2017 10:35 am

Re: Arduino, Flight sims, and SPAD.neXt

Postby OldAirmail » Sat Jan 14, 2017 11:22 pm

Welcome, Boromir, and thanks for the compliments

I consider myself as a hack, because what I do is done just good enough to suit my needs. When I make a mistake I, usually, live with it if it can't be fixed.

I'm a tinkerer, because I like to find new ways, or uses, for what's available. Essentially, I don't make anything new, I just modify it to do what I want.


I STRONGLY dislike using a keyboard & mouse to fly. Imagine driving a car that way?

Yokes and joysticks are much better, but after using all their buttons you're back to using the keyboard and/or mouse. That distances you from the illusion of being in control of an aircraft.

Now, you're faced with three choices:
1) Build a full scale cockpit. That's great, IF you have the time, money, and space to build it. I have none of those.
2) Buy flight sim equipment from companies like Saitek or GoFlight. Some brands have greater fidelity to "real" aircraft, than others. They all cost anywhere from "a lot" to "a whole lot" of money.
3) Make or modify equipment. Lately, I've started doing just that.


I like to share what I come up with, always hoping that someone will show me a better way. :D


Before I get to the GPS, I'd like to say that I'm always trying to find better ways of getting things done.

I use most of the Saitek panels because they give you a lot for less money than the other companies charge. But they aren't all that cheap.

A real problem with Saitek is the software. While it does work, it isn't very good.

That led me to a program, SPAD. It's free and quite good. It'll give you much better control over the Saitek equipment. Also, it's pretty easy to use. SPAD should suite most people.

Another program that gives you a great deal of control is FSUIPC. There is, or used to be, a free version with limited capabilities. But most people use the paid version.

FSUIPC can be very easy on the surface, but you may be somewhat limited depending your ability to write programs.

But even on an "easy level" of 2 out of 5, you can do quite a bit. SPAD and FSUIPC, together, is for the adventurous who want to do just about anything.


The program that I'm using now is SPAD.neXt. The developer of the original SPAD was running out of energy to maintain SPAD and was looking for someone with more programming experience to take over.

The new version, SPAD.neXt is a real tour de' force. It'll do much more than SPAD and FSUIPC. At first it may appear complicated, but most of it is a matter of selecting things/actions from lists. Once you learn the structure, you can do a lot very easily.

Basically, it works with any version of FSX, Prepar3d, and both X-Plane 10 & 11. The program is a 64 bit program so your system has to be a 64 bit OS, even though you flight sim isn't.

At any rate, if you want to get the absolute most out of any flight sim equipment that you buy or build, OR you like to fly the high demanding aircraft from the likes of PMDG, A2A, then SPAD.neXt is for you.

If you want to build that supper cockpit, then SPAD.neXt will do it better than any other solution out there.

But as I said, most people will be happy with the original SPAD.


I'll get to the GPS, promise. :D


Question - What if you're a little handy and want to make something yourself?

There are controller boards from companies like Leo Bodnar that are very well designed, and somewhat inexpensive. The best thing about these is that there are a lot of people using them. These would be the controller boards for most people who have a limited interest in making their own control button boxes. The could even be used for making a GPS. :D

But I used to prefer to play around with simple electronics. And I'm just starting to get interested again. The cause - Arduino microprocessor control boards.

This is a magical device that is very simple to use and will do just about anything that you might want to do.

Figure it this way - almost everything that you use has a micro controller in it: vacuum cleaners, vending machines, car & home alarms, thermostats, the list goes on and on.

With the Arduino boards YOU decide what you want it to do, and how it'll do it. You can make a doggy door alarm, or a solar panel sun tracker. Make a coffee pot turn on when you enter the room, or a silly Halloween costume with lights that blink is a pattern.

You could even, and I am not kidding, use an Arduino to make a motion platform for your flight sim. You'd end up with a larger version of this.


Me? I keep it simple.



OK - the GPS project really starts here and continues, on and off, over several pages - The poor mans sim pit

You'll find the barebones monitor that I used.
Image

Information about Arduinos.
Image

Where your encodeder & buttons get connected on the Arduino.
Image

What I used.
Image

How to set up your GPS. (this is Prepared, but it's the same procedure in SFX)
Image

You'll even find the code needed for the Arduino. You just have to copy & paste it into the Arduino.


In short, you'll find a ton a useful stuff.

Even info on a VERY useful button box.

Image
.. .
Get the most out of your controls - SPAD.neXt

Image
. . . . . .Any time, any plane, any weather.
. . . . . . . . . . . . . Prepar3d V3
User avatar
OldAirmail
Major
Major
 
Posts: 4337
Joined: Sun Feb 17, 2013 3:06 pm
Location: Concrete, WA ICAO - 3W5

Re: Arduino, Flight sims, and SPAD.neXt

Postby Boromir » Sun Jan 15, 2017 1:07 pm

WOW, above and beyond my expectations! I thank you kindly for this reply. I have a hacked-out simpit of my own and do use many old-gen GoFlight modules and a couple of Saitek. I have a 14"laptop screen which at times I have display an analog six pack (Air Manager). The GPS that you made caught my eye and so, the request for info. That will be my next winter project (if I can find room on my panel, may have to make a new MIP).

One more question, those nice looking labels on the DSD button box: what program made those?

Thanks again, I follow all your posts and tinkering with much interest!

cheers,

Boro
Boromir
Ground hog
Ground hog
 
Posts: 2
Joined: Thu Jan 12, 2017 10:35 am

Re: Arduino, Flight sims, and SPAD.neXt

Postby OldAirmail » Sun Jan 15, 2017 5:57 pm

For the labels I use a Brother Pt-d400 Label Maker, About $25-$30. If you go to office auctions you can get one for about $10-$15. But that's only if you're lucky in finding one.

The big deal about that label maker is that it can "print" white on black. If you decide to get one, DO NOT buy Brother P-touch label tape, it'll cost too much. I bought two cassettes for only $9.20. Another nice touch about this tape is that it's laminated, meaning the the surface won't wear away very easily.


About the GPS. It's really, really simple. There are two parts to it.

Part 1
The monitor is just that, a VGA/HDMI monitor. I'm assuming that your laptop is capable of running a separate monitor in addition to you laptop screen?

If not, then you'll also have to buy a USB to VGA adapter for about $15+. Try to stay away from USB 3.x. Your laptop might not recognize it, Besides a USB 2 adapter will be more than adequate for anything 10" and below.


Part 2
If you use an Arduino for button input, you don't need ANY drivers, and you needn't worry about it slowing down your computer at all. After all, the Arduino IS a basic computer in it's own right. It'll be no more of a drag on your computer that the buttons on a joystick. So figure that it'll be impossible for you to notice any slowdown.
.. .
Get the most out of your controls - SPAD.neXt

Image
. . . . . .Any time, any plane, any weather.
. . . . . . . . . . . . . Prepar3d V3
User avatar
OldAirmail
Major
Major
 
Posts: 4337
Joined: Sun Feb 17, 2013 3:06 pm
Location: Concrete, WA ICAO - 3W5


Return to Hardware

Who is online

Users browsing this forum: zswobbie1 and 247 guests