Interfacing - Raspberry Pi

From FlightGear wiki
Jump to navigation Jump to search



Expanding the flight simulator system beyond the primary Raspberry Pi4, that is running FlightGear, is one way to increase the computing power of such a small computer.

Avare

Avare connected to the Raspberry Pi4 and FlightGear. Avare is a moving aviation chart app.

Avare is a free aviation app, with no ads, that works well with FlightGear. It is an app that is used by many pilots. It will provide a moving map of the FlightGear aircraft, using all FAA charts and a lot more. These charts are for the USA, however some of these FAA Charts cover Puerto Rico, plus parts of Canada, Mexico and the Caribbean. For other parts of the world, there are other apps that might work. Avare can be downloaded from Google Play Store. A tablet is a good choice for running this app.

FlightGear and Avare are easy to bind together. Along with the main Avare app, the I/O app will also need to be installed on the tablet. This app is ‘Avare External I/O Plugin’. The scheme is that the Raspberry Pi4 and FlightGear will become the GPS signal used by the Avare app, this position is transferred via WiFi. So, the tablets internal GPS needs to be OFF. Avare will always prompt you to turn ON the internal GPS, so when asked to ‘Turn On GPS’, choose ‘No’. In ‘Preferances’ the GPS position source can and should be set to ‘Avare IO Module Only’, however the prompt to turn ON the internal GPS will still pop up when starting the app.

The below command tells FlightGear what to connect to and it's protocol. This can be placed in the GFly type programs or if in Terminal, place the command after fgfs. The address, 192.168.??.?, needs to be the address of the tablet running Avare. Some home networks will randomly choose an address, hence this could change. It will be displayed in the IO app. The number 49002 needs to be the same number that is in the Avare IO app. Use the Xplane option.

Comm Comm Type Direction Hertz Machine Address Port Style Protocol
--generic socket out 2 192.168.??.?? 49002 udp avare

The table above helps to explain the command line below.

--generic=socket,out,2,192.168.??.??,49002,udp,avare

After FlightGear has started with the above command, open the Avare External I/O Plugin app. Choose the Xplane option and then tap on ‘Listen’. There should be lines of communication being displayed after ‘Listen’ is enabled. Leave this running and now open the main Avare app. Do not choose to use the internal GPS. Now your FlightGear aircraft placement should be displayed on the FAA map of choice.

Official 7" Touch Screen

The Official 7" Touch Screen for the Raspberry Pi with an external numeric keypad.
Bottom view of the 7" touch screen for the Raspberry Pi.
The Phi PFD displayed on the official Raspberry Pi touch screen.

There is the Official 7” Touch Screen for the Raspberry Pi. This screen will work with a number of different models of the Raspberry Pi’s. There is a case for it (there is no Official case) and the Pi, however the new Pi4 doesn’t fit this case, seen in the photo at the right. This combination does resemble a modern aircraft instrument. There is a new case that will fit the Pi4 and other models, SmartPi Touch 2.

SmartPi Touch 2

Phi will work with almost any device with a browser. In this example the Touch Screen is used with a Raspberry Pi3 B+. There is a screen touch keyboard, however only the numeric keyboard is needed to operate the Radio Stack and the full keyboard doesn’t make efficient use of the screen area. To the right, an external numeric keypad is being used. It makes an interesting combination to touch on screen hot spots and use the external keyboard to input the radio frequencies. A numeric touch screen keypad is being looked into.

Pass the below command to FlightGear, during startup, using your favorite method:

--httpd=8080

In the browser address bar, the one with the 7” Touch Screen, type the below address. Replace the '??' with your numbers. This address needs to be the address of the Raspberry Pi4 that is running FlightGear. Some home networks randomly assign addresses, so when launching FlightGear it is good practice to check the address. To easily find this address, place the mouse cursor on the WiFi/Network icon that is on the top menu bar. It is to the far right.

192.168.??.??:8080

In order to adjust the screen brightness use the below command to write a value into the brightness file. Adjusting the number ‘128’ to a lower value will reduce the brightness of the screen.

sudo sh -c ‘echo “128”>/sys/class/backlight/rpi_backlight/brightness’

Other, less expensive, models of Raspberry Pi’s should also work. As long as it has the port for the Official Touch Screen and can run a browser. There are also third party touch screens on the market. However, purchasing official Raspberry products help to support the Raspberry Foundation promote computer education. Hopefully some of the young budding computer scientists will find value in FlightGear!