Board index FlightGear Support Interfacing

Got Arduino connected to windows10

Connecting two computers, using generic protocol, connecting with Matlab?

Got Arduino connected to windows10

Postby bill516 » Wed Jun 26, 2019 3:16 pm

Started this thread as I didnt want to jump on the thread viewtopic.php?f=36&t=35973#p349764 by simone04.

I have managed to get the Arduino to talk to FG via win10 after much trials, testing and various examples on the net. I eventually used the example control test on the wiki but had to change some things.

Every example I have come across for windows has had --generic=serial,in,30,(port),(baud), file.xml. or some slight variation on it. After reading the thread above I started playing around and found that if I put \com9 for port9 \\.\com10 for port 10 I could connect to FG, but only if I had run this terminal program from I dont know what difference this make to unpluging the arduino after viewing the serial monitor but for me FG would freeze at finalising display. Running the terminal program shoed that the arduino was sending the correct info to FG and after closing the terminal prog FG started normally and I could see the switch for strobe working on the a/c panel.

The throttle didnt work so I had a re-read on simone04 thread and read about the engine protocol. Changed the protocol to read engine/current engine/throttle</node> and lo and behold the throttle responded to the turn of my test pot.

So far I have to use the following procedure to get FG and arduino to work, on my setup it is:

after loading program to arduino and viewing serial monitor disconnect arduino and close ide.
start FG and enter into settings --generic,serial,in,30,\com9,9600,controltest (note there is no fullstop before the backslash for com), If using com port above 9 then use \\.\com(port number)
close FG
run terminal program verify data is being sent, close terminal program.
run FG.

Your --generic,serial,in might be different from mine if you use a different com port speeds and .xml file

I would love it someone would confirm this works on their computer and not just on mine. I would use linux but my FG install in linux is giving me a hard time and I want to keep this specific to windows.

Edited to add Arduino to title
Last edited by bill516 on Thu Jun 27, 2019 11:08 am, edited 1 time in total.
Posts: 5
Joined: Tue Jun 25, 2019 4:20 pm

Re: Got connected to windows10

Postby Alant » Wed Jun 26, 2019 10:50 pm

Welcome to Flightgear.

Thanks for the input of your experiences.


P.S. Adding "Arduino" to the subject title might help people to see this ;)
Posts: 927
Joined: Wed Jun 23, 2010 5:58 am
Location: Portugal
Callsign: Tarnish99
Version: from Git
OS: Windows 10

Re: Got Arduino connected to windows10

Postby bill516 » Thu Jun 27, 2019 11:09 am

Thanks for the welcome Alant, I've added Arduino to the tilte as per your suggestion.
Posts: 5
Joined: Tue Jun 25, 2019 4:20 pm

Re: Got Arduino connected to windows10

Postby wlbragg » Thu Jun 27, 2019 3:58 pm

I think part of the confusion with the serial ports is (at least in Linux) that "first plugged in, first assigned". Meaning that every time you plug or unplug a serial device it gets assigned the next available identity.. So if one time you plug in the FG device first and the next time you plug in some other serial (usb) device, your serial ID (actually I guess it would be the port ID) can change. That appears to be a major cause for confusion when programming a serial device interface. Being able to list the ID's of all currently connected devices at any given time is very helpful when working with serial devices. It makes it clear what is what and when things change.
Kansas(2-27-15)/Ohio/Midwest scenery development.
KEQA (2-27-15), 3AU, KRCP Airport Layout
Intel i5 3570K AMDRX480
User avatar
Posts: 5194
Joined: Sat Aug 25, 2012 11:31 pm
Location: Kansas (Tornado Alley), USA
Callsign: WC2020
Version: next
OS: Win10/Linux/AMDRX480

Re: Got Arduino connected to windows10

Postby WoodSTokk » Fri Jun 28, 2019 2:39 am

If it is a real serial port, it is mostly '/dev/ttyS0' (or, if your computer have 2 serials build in, it can be '/dev/ttyS1').
If you use a USB-serial converter, you can look into the last kernel messages with:
Code: Select all
sudo dmesg | tail -n 20

This show you the last 20 lines of kernel messages triggered by events.
In my case (i have now pluged in a USB-serial converter), the last lines shows:
Code: Select all

[ 2253.987219] usb 5-2: new full-speed USB device number 5 using ohci-pci
[ 2254.187618] usb 5-2: New USB device found, idVendor=0403, idProduct=6001, bcdDevice= 4.00
[ 2254.187627] usb 5-2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 2254.187631] usb 5-2: Product: usb serial converter
[ 2254.187635] usb 5-2: Manufacturer: ftdi
[ 2254.187639] usb 5-2: SerialNumber: ftE1MFQF
[ 2254.298921] usbcore: registered new interface driver usbserial_generic
[ 2254.298951] usbserial: USB Serial support registered for generic
[ 2254.308488] usbcore: registered new interface driver ftdi_sio
[ 2254.308497] usbserial: USB Serial support registered for FTDI USB Serial Device
[ 2254.308576] ftdi_sio 5-2:1.0: FTDI USB Serial Device converter detected
[ 2254.308604] usb 5-2: Detected FT232BM
[ 2254.311668] usb 5-2: FTDI USB Serial Device converter now attached to ttyUSB0

The numbers in brackets are the seconds since last boot of the system.
The last line show the assigned device node 'ttyUSB0'. So this serial port can be used as '/dev/ttyUSB0'.
Posts: 426
Joined: Tue Oct 17, 2017 2:30 pm
Location: Milky Way/Sol/Earth/Europe
Callsign: OE-WST
IRC name: WoodSTokk
Version: 2018.3.1
OS: Debian Buster/Sid

Return to Interfacing

Who is online

Users browsing this forum: No registered users and 1 guest