Page 1 of 11

Arduino controler

Posted: 16 Oct 2016, 20:00
by OldAirmail
Please read everything BEFORE commenting.

I know that Leo Bodnar boards are supported, but the simple fact is that they are somewhat limited in their capabilities.

For instance, the BBI-32 Button Box Interface - With Connectors (€35.97 / $40.15) will control "32 button / 16 rotary encoders / 11 BBI-32 rotary switch inputs".

That sounds great until you consider that it can't output to motors and LEDs, never mind 7 segment displays.


The Teensy 3.2 Arduino microprocessor controller (€35.97 / $24.55) is an input/output device that can act as any USB/HID/MIDI device controlling buttons, joysticks, stepper & servo motors, encoders, 7 segment LED displays, even work as a USB keyboard. Or just about anything (serial or analog) that you want to it do. Want it to play/control sounds through a speaker? It can do that too.

It has 27 Digital I/O pins, and 13 high res Analog inputs. And with cheap Shift Registers ($5.95 for 5) it can be chained together to control FAR MORE Inputs (buttons, etc). Cheap MAX7219 LED display drivers ($10 for 5) can do the same for 7 segment displays.


As far a using it to control FSX/P3d, that can be VERY easy.

This has been set up as an example, with only one button, to send the letter "g" as a keyboard input.
Image

Of course you can set up as many keyboard inputs as you want, but I thought that I'd keep it simple.



And just how simple is this to program?

I didn't really program it. I just downloaded a keyboard example program.

This is it in it's entirety;
int buttonPin = 9; // Set a button to any pin, it doesn't matter all that much in this case

void setup()
{
pinMode(buttonPin, INPUT);
// Set the "buttonPin" as an input
digitalWrite(buttonPin, HIGH); // Pull the button high (send power to that pin)
}

void loop()
{
if (digitalRead(buttonPin) == 0)
// if the button goes low
{
Keyboard.write("g");
// send a 'g' to the computer (prepar3d in this case) via Keyboard HID
delay(1000); // delay so there aren't a kajillion g's
}
}


Adding more input pins (buttons/keyboard inputs) should be easy for everyone here to figure out.



The important thing is that you can ALSO use this Arduino to act as a series of joysticks with programmable buttons too.

Using the EXACT same breadboard setup, this is an example of the Teensy 3.2 being programmed as a joystick button in Prepar3d V3.
Image

This is an example of the Teensy 3.2 being programmed as a joystick button in SPAD.neXt.
Image

Again this isn't something that I wrote, this was just an example that came with the Teensy Arduino.
Image


But sending input to FSX/P3d is not the problem.

What's needed is a better way to have FSX/P3d send data TO the Teensy.

Right now there are two programs that will send info TO Arduino's.

One is Link2fs Multi for FSX. It's creator was upset by a detractor and pretty much stopped developing the program in 2014.

The other program is MobiFlight (in English and auf Deutsch MobiFlight)

The problem with MobiFlight is that it's development is limited to one older, MUCH slower, and MUCH less capable, Arduino. Unfortunately, it's development seems to be somewhat stalled.

I'm simply reluctant to invest much time and effort in either program.


Sending button commands isn't a major problem, especially with SPAD.neXt already recognizing the Teensy as a USB/HID device.

Getting the readings from FSX/P3d and sending them TO 7 segment displays is where I'm hoping that SPAD.neXt can come in.




Image

Re: Arduino controler

Posted: 16 Oct 2016, 20:14
by OldAirmail
Speaking of "analog" controls, this is something that I made up with a servo motor.

Flaps setting display :D

Image

Image

Re: Arduino controler

Posted: 16 Oct 2016, 20:44
by OldAirmail
Looking at my last post I noted the "Com" number on the chip and thought that I might offer a couple of tips to anyone who's as new to Arduinos as I am.

1) Whatever Arduino you get, you'll need to go to Arduino.cc to download the free software - ADE.

2) To use your Arduino you'll need to tell the software at least two things; What type of Arduino you have, and what Com port it is on.

I have several different types of Arduino's, each with a different Com port. That's why I labeled then.


Also a note - not all Arduino's have USB/HID communications built into them, even if they are plugged into your computer via a USB port. There are, however, add-on boards (called shields) that will, for most part, give a general Arduino that capability. Check before you buy.

BTW - "arduino's" (lower case "a") are open source. ANYONE can make and sell them. The Teensy is one of the better one in many ways, but an Arduino UNO or MEGA might be the best to learn on.

Re: Arduino controler

Posted: 16 Oct 2016, 20:49
by c0nnex
OldAirmail wrote: Sending button commands isn't a major problem, especially with SPAD.neXt already recognizing the Teensy as a USB/HID device.

Getting the readings from FSX/P3d and sending them TO 7 segment displays is where I'm hoping that SPAD.neXt can come in.
Actually I have been looking into Arduino Controllers already.
But since it do not have any, and was totally lost what to order at Amazon for a basic staring kit , i did not put it on top of my todo list ;)
(Been playing round with some old ATMega since I have a ATMega Development board, but as they are no longer produced i stopped that)

Basically the support for the Backchannel should not be that hard to implement. maybe it's just a 2-liner ;)

If you are ready to do some tests etc, please open a ticket (email support@fsgs.com or use SPAD.neXt) so I can send you some tools for basic testing.

For Servo-Control SPAD.neXt will support the Pololu Servo-Controller-Board in Version 0.9.5

Re: Arduino controler

Posted: 16 Oct 2016, 20:55
by OldAirmail
The post timed out before I could add Teensy 3.2 (and up) can be found at the PJRC Store, not to mention Amazon. eBay, etc.

Re: Arduino controler

Posted: 16 Oct 2016, 21:59
by OldAirmail
c0nnex wrote:....

If you are ready to do some tests etc, please open a ticket (email support@fsgs.com or use SPAD.neXt) so I can send you some tools for basic testing.

For Servo-Control SPAD.neXt will support the Pololu Servo-Controller-Board in Version 0.9.5
Sent via email support@fsgs.com under the title "Arduino controller".


All in all, the Arduino's make it very simple to do difficult things with relative ease. :D

Two of the Arduino's that I know can be recognized as USB/HID devices are the Teensy 3.2 ($24.55), and the Pro Micro ATmega32U4 ($18.99 for 3). The Teensy 3.2 is the better of the two. And if you want to do anything very large & complex it's far faster. But for most simple things, like sending button/key presses to a flight sim, the Pro Micro will work just as well.

An important note - the "Pro Micro" IS NOT the same as the Arduino "Micro".

The chips that I bought to efficiently address 7 segment displays are the MAX7219 LED display drivers.

The 7 segment displays that I bought are the Common Cathode 10 Pin 2 Bit 7 Segment 0.4" Red LED Display, and the Common Cathode 12 Pin 3 Bit 7 Segment 0.4" Red LED Display.

Also bought, with the intention of making a 7inch GPS, was a Dual Concentric Encoders w/ Push Switch, knobs included for $9.50. BTW- the original knobs were loose but that's been corrected.

Image


Anyone interested in making a GPS, the screen that I bought is this one - Makerfire 7-Inch. Raspberry Pi LCD Display Screen - $39.98.

Image


The project box that I bought to put it all in is this one - BUD Industries PC-11491 Plastic Style F Box - $18.50.

Image


The planned GPS is really just two parts. One part is a monitor. The other is all small components - a dual encoder, buttons, and a box of some sort. Put it all together with an easy to control Arduino and you have a GPS. :D


Ah, yes. The buttons if anyone in interested are these - uxcell 20Pcs AC 125V 3A 13mm Dia SPST Momentary Push Button - $11.24 of 20.

Image

Re: Arduino controler

Posted: 17 Oct 2016, 23:28
by Oz Flyer
Hi OldAirmail,
Would like to catch up some time re the GPS project.
What time zone are you in?
I am in Melbourne Australia (UTC+11) at this time of year.

Re: Arduino controler

Posted: 18 Oct 2016, 04:15
by OldAirmail
Hi, Dave. I'm in Philadelphia, Pennsylvania - UTC-05:00.

So far I've been, casually, collecting the parts that I need and learning about Arduinos. Well, mostly working, resting from work, and THEN learning about Arduinos. :D

I've just touched the surface as to what they can do. Searching YouTube for Arduino tutorial would be the best way to get an idea of what they can do. A great many things that would be very hard to make without an Arduino, are no harder than what you can do with general handyman skills.

As I said, I'm the rankest of beginners, but by using the programming of what others have already produced, I can say that building your own GPS is practically a no-brainer. Really.

And whether you program it directly into FSX/P3d, or use SPAD.neXt, is unimportant.

Actually, it isn't even programming.

Some Arduinos, Teensy 3.2 & Pro Micro in particular, can be recognized by both the flight sim and by SPAD.neXt. So what follows is simply assigning the built in GPS commands to the buttons. Nothing more complicated than assigning commands to joystick buttons.


At this point I'm thinking that, because the subject is so focused, and may be of interest to many others, that a new post describing the project would be appropriate.

It'll be called Arduino controller - Building a GPS.

If you want to ask questions, ask away. But you'll be surprised at how simple it's going to be. :D



Actually, I'm running out of time tonight. I'll start it tomorrow, if possible.

Re: Arduino controler

Posted: 18 Oct 2016, 04:22
by OldAirmail
Just a taste of what's to come. :D

Image

Re: Arduino controler

Posted: 18 Oct 2016, 09:10
by Oz Flyer
OK OldAirmail,
I have all the switch's and Encoders already setup for GPS control using a leo board so really all I need is the Makerfire display which I can get on Ebay fo AU$40.

To get started and then look at replacing the leo board with to get more from it