Howto:Use Arduino with FlightGear: Difference between revisions

From FlightGear wiki
Jump to navigation Jump to search
m (Initial description updated)
Line 50: Line 50:
* [http://playground.arduino.cc/Main/FlightGear FlightGear Serial Communications with Arduino] (tutorial)
* [http://playground.arduino.cc/Main/FlightGear FlightGear Serial Communications with Arduino] (tutorial)
* [http://forum.flightgear.org/viewtopic.php?f=18&t=11126 Arduino LCD and FlightGear] (FlightGear forum)
* [http://forum.flightgear.org/viewtopic.php?f=18&t=11126 Arduino LCD and FlightGear] (FlightGear forum)
* [https://sites.google.com/site/flightgeararduinoandlinux/ Flightgear, Arduino and Linux] (potentiometer and switch interfacing tutorial


[[Category:Cockpit building]]
[[Category:Cockpit building]]
[[Category:Hardware]]
[[Category:Hardware]]

Revision as of 05:44, 24 December 2014

Arduino LCD panel displaying speed, heading and altitude.

Arduino is an open-source electronics prototyping platform based on flexible, easy-to-use hardware (consisting of a board designed around an 8-bit or a 32-bit microcontroller) and software (based on an integrated development environment (IDE)). FlightGear's IO interface allows easy development of hardware that can improve the immersion and realism of the simulation. The output protocols allow hardware to response to simulation data (like shown in the image on the right), while the input protocol allows FlightGear to reply to hardware events (eg. on the press of a button).

Display/Generic protocol Example by rubdos

Rubdos (Ruben De Smet) has built an example using the Generic Protocol and an Arduino Mega 2560. The code used to control the Arduino with generic protocol was:

<?xml version="1.0"?>
<PropertyList>
   <generic>
       <output>
           <binary_mode>false</binary_mode>
           <line_separator>newline</line_separator>
           <var_separator>newline</var_separator>
           <preamble></preamble>
           <postamble></postamble>
           <chunk>
               <name>Altitude</name>
               <node>/position/altitude-ft</node>
               <type>integer</type>
               <format>altitude=%i</format>
           </chunk>
           <chunk>
               <name>RPM</name>
               <node>/engines/engine/rpm</node>
               <type>integer</type>
               <format>rpm=%i</format>
           </chunk>
       </output>
   </generic>
</PropertyList>

It is a simple plaintext protocol, which can easily be parsed by an Arduino. The code used on the Arduino is available on github as a gist: [1]

As hardware, five seven segment displays were used, multiplexed straight on the Arduino device. In production, you'd rather use some 74HC595 or other shift register chips to drive them, to unload the Arduino and have more current. A demo is uploaded to youtube, with voiceover in which the display shows the RPM of the first engine of (the single engine) DR400: [2]

Related content

External links