Arduino FlightGear Cockpit (AFGcockpit)

Page last changed: March 2011

Contents

What is it?

This is a project which uses the Arduino Duemilanove to control an aeroplane (Cessna) in the Flightgear flightsimulator (FG). The communication between Flightgear and Arduino is with the serial cable (USB). A future plan is to display different data using voltmeters as well, however far away in future in case I don't get bored before that.

AFGcockpit stands for Arduino FlightGear cockpit.

Please feel free to contact me if you have any questions or are interested about this.

Why

  • I want to learn electronics, especially with Arduino in mind.
  • Since it is open source, everything is possible. Since it is possible, I want to do it!
  • I like the FG simulator, and this would be a fun project!

Features

The current features are:

  • Two 4051 muxers connected in parallell (only uses 3 pins to control, 2 analog ins). Can now read input from up to 16 different sources (this can be expanded to 6 muxers, ie 48 controls, on the Duemilanove).
    • Aileron, rudder, elevator, elevator trim controlled by rotary pots
    • Throttle and flaps (value is converted to 4 discrete steps; 0, 0.3, 0.6, 1) controlled by fader pots
    • Breaks (parking, left, right) are controlled with buttons connected to second muxer. Values converted to bools.
  • LEDs and 7 segment displays controlled by 74HC595 shift registers (require 3 pins). Current uses:
    • Parking brake LED
    • Sync LED (lits when FG and Arduino are not in sync)
    • Two 7 segment displays showing the air temp (!)
    • ...but can be expanded easily to show more important stuff or build a digital autopilot or comm radio!
  • LCD to show different values read from FG. This is mainly for debug and is planned to be removed.
  • Switch to enable/disable sending data to FG, in case you want to use mouse, autopilot etc.
  • 20 different data read from FG over serial port (ascii format).
  • Main loop runs at around 300 times per second if FG send data at 2 Hz and Arduino send at (if necessary maximum) 10 Hz.

Communicating With FG

The communication with FG is carried out over the USB serial port cable. A generic protocol is created, actually two at the moment. One is used for sending and the other for recieving.

FG is started with the following commands:

--generic=serial,out,2,/dev/tty.usbserial-A800eIbT,38400,AFGcockpitout
--generic=serial,in,10,/dev/tty.usbserial-A800eIbT,38400,AFGcockpitin

This will cause FG to read data from the serial port at 10 Hz and send data at 2 Hz at the baud rate of 38400.

Download the protocols:

and place in the protocols folder of FG, ie. $FG_ROOT/Protocol.

PCB Layout

I don't have this, but I have an SVG sketch showing how everything is connected at the moment.

Source Code

Big and messy source code

Pictures

Yes, the wiring is messy!

Image Image Image Image

Version History

Previous versions on a separate page.

fg-arduino is a related project.