TomBric / stratux-radar-display

Display for Stratux Europe Edition, can run standalone
36 stars 12 forks source link

stratux-radar-display

Implementation of a standalone Radar display for Stratux Europe Edition. Can run on a separate Raspberry (e.g. Zero W or Zero 2 W). Reads the aircraft data from Stratux and displays them on the specified display. You can connect 3 pushbuttons to the device and use them for changing the radar radius, the height difference and sound options. A clock with a stop and lap timer, a g-meter, an artificial horizon, a compass (based on GPS) and a VSI display are also implemented.

Current supported displays are:

3.7 inch Epaper for 80 mm instrument hole 1.54 inch Epaper for 57 mm instrument hole Oled for 57 mm instrument hole

More displays can be integrated. You can find instructions how to build the full instruments in the wiki. The Oled-case is designed for a 2 1/4 inch mounting hole, the E-paper case is designed for a 3 1/8 inch (80 mm) mounting hole. Instructions e.g. how to build an all-in one 2 1/4 Oled case, or all-in-one 3 1/8 Epaper instrument, or Epaper 3 1/8 display only can be found in the wiki.

Find below a photo of the current supported displays

Display photo

Hardware-List

Epaper photo

Radar Stratux-Status G-Meter Flightlogs
1.54in1 1.54in2 1.54in3 1.54in4
Connection PIN# on Raspberry Cable color
VCC 17 red
GND 20 black
DIN/MOSI 19 blue
CLK/SCK 23 yellow
CS/CE0 24 orange
DC 18 green
RST 22 white

Hardware connection of the Epaper 3.7 inch or 1.54 inch display

Connection PIN# on Raspberry Remark
VCC 17
GND 20
DIN/MOSI 19
CLK/SCK 23
CS/CE0 24
DC 22
RST 11
BUSY 18
PWR 1 e-Driver-Hat Rev. 2.3 only !!!

Important remark for e-Paper Driver Hat Waveshare 13512 Rev. 2.3: Waveshare introduced a 9-cable connection since Rev. 2.3. The additional cable PWR (red) needs to be connected to 3.3 V. So connect it to PIN#1 on the Raspberry GPIO.

Remark: If you have a barometric sensor or ahrs connected you may have conflict with GPIO Pin 11. You can also use PIN 16 (GPIO 23) for the RST line.

To do that please modify in /home/pi/stratux-radar-display/main/displays/Epaper_3in7/epdconfig.py line 38/39:

   # RST_PIN         = 17    # if directly as hat
   RST_PIN = 23  # for cable mounted in stratux on different GPIO 23, which is PIN 16

Hardware connection of the pushbuttons for the user interface

Pushbutton PIN# on Raspberry
Left 37
Middle 38
Right 40

All pushbuttons are used as pull down. Connect the other side of all buttons to GND (PIN39).

Software Installation Instructions

Standard setup

  1. Download the image under Releases/Assets to your local computer. Image with "oled" is preconfigured for the Oled 1.5 inch display. Image with "epaper_3in7" is the version for the waveshare 3.7 inch epaper display, "epaper_1in54" for the smaller epaper. Both versions will support Bluetooth
  2. Flash the image using Raspberry Pi Imager to your SD card (32 GB cards recommended). Use Pi imager with the following settings:
    • Operating system to select: "Use Custom"
    • Settings:
      • set a hostname (e.g. radar.local)
      • set a username and password (e.g. "pi" and "raspberry" or whatever you can remember)
      • set Wifi: "stratux" and leave the password empty
      • set language options to your preferences
      • optional: activate ssh, if you want to login later
  3. Insert the SD into your raspberry and let it boot. It should automatically startup and connect to the Stratux-Europe edition. Remark: Current configuration is for Stratux-Europe on IP address 192.168.10.1. using wifi SSID "stratux". If you have a different configuration please update the stratux IP in /home/pi/stratux-radar-display/image/stratux_radar.sh accordingly. To change the wifi network modify the Pi Imager Wifi Settings accordingly or use the "Display status" mode with the pushbuttons (expert only).

Expert setup

  1. Setup your main stratux in the following way: Install version eu-027 on ther stratux or newer. Go to "Settings" and set Wifi-Mode: AP+Client. Enable "Internet-Passthrough" as well. Then "Add wifi client network" and add the data of your local home network. This all enables your stratux to have Internet connection and gives the display the possibility to access internet as well.
  2. Configure a clean Raspbian installation on your SD card. E.g. using Raspberry Pi Imager. Image to flash is the standard image "Raspbian Pi OS Lite (64bit)". Using the Pi Imager use "settings" to set the network to "stratux" and no password. Also enable ssh in settings with the user pi and set a password ("raspberry" if you like).
  3. Startup your Stratux and boot your new raspberry. Connect your PC/workstation to the standard "stratux" wifi network and figure out the IP-adress of your display-raspberry, e.g. by using "arp -a".
  4. From your workstation open a remote shell on the display-raspberry with the ip adress from step 3: ssh pi@192.168.x.x. Password is the same that you set in step 2.
  5. Install git software by sudo apt install python3-git
  6. Clone the stratux-radar-display repository by the command: git clone https://github.com/TomBric/stratux-radar-display.git
  7. Execute the configuration script as user pi. /bin/bash /home/pi/stratux-radar-display/image/configure_radar.sh. This will take some time since it does an update on the pi.
  8. Depending on your display modify /home/pi/stratux-radar-display/image/stratux_radar.sh. In paramater "-c" enter the IP address of your stratux and in parameter "-d" the device. E.g.

    • cd /home/pi/stratux-radar-display/main && python3 radar.py -b -d Oled_1in5 -c 192.168.10.1 &
    • cd /home/pi/stratux-radar-display/main && python3 radar.py -b -r -d Epaper_3in7 -c 192.168.10.1 &
    • cd /home/pi/stratux-radar-display/main && python3 radar.py -b -r -d Epaper_1in54 -c 192.168.10.1 &

      The configuration script will configure the pi so that the radar display will start automatically after reboot.

Installation on a standard stratux device (for stratux versions eu027 or newer!)

stratux-radar-display can run also directly on your stratux device. You can find an example of a case with everything installed in the wiki. Connect the displays to the GPIO pins of the Stratux. Installation is only for expert users! To install the software perform the following steps:

  1. Connect your stratux to a network, e.g. by integrating into your WLAN: go to "Settings" and add your local wifi network. This will connect your stratux to your local wlan. Alternatively connect Stratux via network cable.
  2. Enable a writeable persistent filesystem in the settings tab by setting "Persistent Logging".
  3. Reboot and log on to your Stratux as user pi, directory /home/pi
  4. Install git software on the stratux: sudo apt install git
  5. Clone the stratux repository by git clone https://github.com/TomBric/stratux-radar-display.git
  6. Execute the configuration skript: sudo /bin/bash /home/pi/stratux-radar-display/image/configure_radar_on_stratux.sh It will take some time.
  7. The script configures stratux to work with the Oled display and without bluetooth or external sound. So if this is your configuration, you are fine. Otherwise you can configure the startup skript "image/stratux_radar.sh": Check that the bluetooth option is not specified (no "-b") and use the corresponding display option with "-d Oled_1in5", "-d Epaper_3in7" or "-d Epaper_1in54". You can use a simple editor like nano for this: nano image/stratux_radar.sh
  8. Reboot stratux. If everything if installed correctly, the display software will automatically startup.

The Oled display uses different GPIO-Pins as the baro-sensor, so there is no conflict. Also the e-Paper display can be connected (not the HAT version) with the baro and ahrs sensors in place.

External Sound output

You can connect your radar device with your intercom if it has an input for external audio (e.g. TQ KRT2 has one). This is possible on the Pi Zero with an external USB sound card. I used a simple "3D USB 5.1 Sound card" available for 4 Euro. The sound volume can be controlled via the option "-y 50" or can be modified with the pushbuttons under ->Status-> Net/Opt -> External Volume. The following link gives some good hints, which USB sound card can be used and it also shows how to solder it to the Pi Zero, if you do not want an adapter or space is an issue (https://www.raspberrypi-spy.co.uk/2019/06/using-a-usb-audio-device-with-the-raspberry-pi/).

If you are using a Pi3B or Pi4 for the radar-display you can use the builtin audio jack. To enable this, you have to specify "-mx PCM" (select mixer PCM) in stratux_radar.sh along with the option "-y 100" (for sound volume). If you are running the radar-display on the same Pi together with stratux this is currently not supported, since there are software conflicts.

Bluetooth devices

stratux-radar-display will automatically connect the your headset if their bluetooth is switched on. Please keep in mind that the bluetooth drivers on some pi-s have bugs. Sometimes pairing is not performed properly.

First, once you need to do the pairing of a new bluetooth device.

There are two options for pairing:

Option 1: Directly on the device via buttons:

Manual of stratux-radar-display (user interface with 3 pushbuttons) (thanks SiggiS)

In all screen modes:

Radar screen mode:

Radar

Recommended setting for normal piston aircraft is 5 nm and 2000 ft.

Timer screen mode:

Timer

AHRS mode:

AHRS

G-Meter mode:

- press short right to reset min and max values
- press middle for next mode

Gmeter

Compass mode:

- press middle for next mode

Compass

Vertical speeed indicator mode:

- press middle for next mode
- on epaper: press right to reset max and min values

Display status mode:

- press middle for next mode
- press right to start bluetooth-scan
- press left to show or modify network and other settings, press left again to select Options (external volume, registration, speak distance), press right to modify Network settings (Wifi, passphrase, stratux IP)

Stratux status mode:

- press middle for next mode

Flight log mode:

- press middle for next mode

Shell command parameters

usage: radar.py [-h] -d DEVICE [-b] [-sd] [-n] [-t] [-a] [-x] [-g] [-o] [-i] [-z] [-w] [-sit] [-chl CHECKLIST] [-stc] [-c CONNECT] [-v VERBOSE] [-r] [-e] [-y EXTSOUND] [-nf] [-nc] [-ci] [-gd] [-gb] [-sim]
                [-mx MIXER] [-modes DISPLAYMODES]

Stratux radar display

optional arguments:
  -h, --help            show this help message and exit
  -d DEVICE, --device DEVICE
                        Display device to use
  -b, --bluetooth       Bluetooth speech warnings on
  -sd, --speakdistance  Speech with distance
  -n, --north           Ground mode: always display north up
  -t, --timer           Start mode is timer
  -a, --ahrs            Start mode is ahrs
  -x, --status          Start mode is status
  -g, --gmeter          Start mode is g-meter
  -o, --compass         Start mode is compass
  -i, --vsi             Start mode is vertical speed indicator
  -z, --strx            Start mode is stratux-status
  -w, --cowarner        Start mode is CO warner
  -sit, --situation     Start mode situation display
  -chl CHECKLIST, --checklist CHECKLIST
                        Checklist file name to use
  -stc, --startchecklist
                        Start mode is checklist
  -c CONNECT, --connect CONNECT
                        Connect to Stratux-IP
  -v VERBOSE, --verbose VERBOSE
                        Debug output level [0-3]
  -r, --registration    Display registration no (epaper only)
  -e, --fullcircle      Display full circle radar (3.7 epaper only)
  -y EXTSOUND, --extsound EXTSOUND
                        Ext sound on with volume [0-100]
  -nf, --noflighttime   Suppress detection and display of flighttime
  -nc, --nocowarner     Suppress activation of co-warner
  -ci, --coindicate     Indicate co warning via GPIO16
  -gd, --grounddistance
                        Activate ground distance sensor
  -gb, --groundbeep     Indicate ground distance via sound
  -sim, --simulation    Simulation mode for testing
  -mx MIXER, --mixer MIXER
                        Mixer name to be used for sound output
  -modes DISPLAYMODES, --displaymodes DISPLAYMODES
                        Select display modes that you want to see R=radar T=timer A=ahrs D=display-status G=g-meter K=compass V=vsi I=flighttime S=stratux-status C=co-sensor M=distance measurement L=checklist
                        Example: -modes RADCM