Skip to content

Setup Steps for Raspberry Pi

David Witt edited this page Oct 16, 2021 · 8 revisions

Raspberry Pi based Electronic Flight Information System (PiEfis)

Setup steps on Raspberry Pi OS Lite (32-bit) Released 2021-05-07:

  • sudo raspi-config note: raspi-config changes from time to time so the selections below may not exactly match the version of raps-config installed on you Pi.
    • -> 1 System Options -> S5 Boot / Auto Login -> B2 Console Autologin
    • The following are optional
      • If you want to use Wi-Fi the country needs to be set.
      • -> 5 Localisation Options -> L4 WLAN Country -> select appropriate country
      • -> 1 System Options -> S1 Wireless LAN -> set the SSID and password as appropriate
      • If you want to change the host name so that it is easier to find on your network.
      • -> 1 System Options -> S4 Hostname
      • If you want to be able to SSH to your PiEfis. (This can be helpful while setting everything up.)
      • -> 3 Interface Options -> P2 SSH

Install packages

First update package list and update all installed packages

  • sudo apt update
  • sudo apt full-upgrade

The following packages install the required library to support WebGL, X11 (the graphical interface) the browser, uncluttered (to hide the mouse pointer)

  • sudo apt install libgles2
  • sudo apt install --no-install-recommends xserver-xorg x11-xserver-utils xinit
  • sudo apt install --no-install-recommends chromium-browser
  • sudo apt install unclutter

Setup the CAN interface

Follow the steps to enable your CAN interface. This will generally involve turning on the SPI interface and enabling the appropriate overlay for your CAN interface. For CAN interfaces based on the Microchip MCP2515 you will likely need to do the following, but you should always check the instructions for your interface. The steps below are just for reference:

  • sudo raspi-config
    • -> 3 Interface Options -> P4 SPI - enable the SPI interface. note: SPI is enabled in /boot/config.txt by adding or uncommenting the line shown below. This is what enabling the SPI option in raspy-config does.
dtparam=spi=on
  • Edit /boot/config.txt using the command sudo nano /boot/config.txt
  • Add the following line at the end of the file.
dtoverlay=mcp2515-can0,oscillator=12000000,interrupt=25,spimaxfrequency=2000000
  • You need to check the frequency of the oscillator/crystal on your CAN board and ensure that the frequency entered into the config.txt file matches. If you find your board doesn't work you can try reducing the spimaxfrequency value. Some boards need 1000000.
  • To save the file and exit the nano editor type ctrl-s and ctrl-x.

Set the screen resolution

If required, follow instructions on https://www.raspberrypi.org/forums/viewtopic.php?t=24679#p227301 to set the proper resolution

Create the local directories

  • mkdir ~/Python_Avionics
  • mkdir ~/Python_Avionics/support
  • Copy the files from RPi4 and RPi4/support in the repo to ~/Python_Avionics and ~/Python_Avionics/support

Add Files for python3

  • sudo apt install --no-install-recommends python3-pip
  • sudo pip3 install asyncio
  • sudo pip3 install aiohttp
  • sudo pip3 install python-can

Configure the Pi boot up to decrease the time required

  • Edit /boot/config.txt using the command sudo nano /boot/config.txt and add the lines below at the end of the file. This will enable turbo mode for 60 seconds to speed up booting. The splash screen will be disabled and the boot delay is set to 0 seconds
initial_turbo=60
disable_splash=1
boot_delay=0
  • Add quiet to /boot/cmdline.txt. note: Originally included fast boot after quiet

Configure the Pi to start the CAN interface, X and run Chromium on startup

  • Copy the file linux/interface-can from the repo to the directory /etc/network/interfaces.d
  • Add contents of linux/.xinitrc from repo into file ~/.xinitrc
  • Add contents of linux/.bash_profile from repo into file ~/.bash_profile
  • Copy the file linux/piefis.service from repo to /etc/systemd/system/piefis.service
  • sudo systemctl enable piefis.service
  • sudo /sbin/ip link set can0 up type can bitrate 500000

Disable unused services once everything is done. This decreases boot time substantially:

  • sudo systemctl disable ssh # If you don't need SSH to access the Pi
  • sudo systemctl disable hciuart # Disables the UARTS so you cannot connect vi Serial
  • sudo systemctl disable nmbd # If you have samba installed
  • sudo systemctl disable smbd # If you have samba installed
  • sudo systemctl disable systemd-timesyncd # Disables time sync across the network
  • sudo systemctl disable wpa_supplicant # Disables WPA for wifi network connections
  • sudo systemctl disable rpi-eeprom-update # Disables eeprom updates on boot
  • sudo systemctl disable raspi-config # Disables rasps-config from updating the system on boot
  • sudo systemctl disable dhcpcd # Disables dhcp

Now when you reboot the system should start into startx and run Chromium with http://localhost:8080.