Configuring Node.js for EFIS

Updated: August 09, 2020

 

Node.js is the heart and the souls of the tablet-based EFIS. This technology allows us to display the “Glass Panel” practically on any device that has a browser. The flight instruments can be displayed on iPad, iPhone, Android, Windows or Linux laptop, etc, and there is no need to install anything on these devices. Simply enter the IP address (192.168.4.1) in the browser and the instruments will just show up just like any other web page.

Node.js is a very nice lightweight and efficient environment perfectly suited for running on small single-board computers like Raspberry Pi. It uses JavaScript language that allows us to leverage the skills and knowledge of really large community of developers.

Install Node.js and npm on your Raspberry Pi by runing the following commands:

sudo apt-get update
sudo apt-get upgrade
sudo apt-get install nodejs npm

Install socket.io

sudo npm install socket.io

Install sqlite3 component

sudo npm install sqlite3@4.2.0

Please note, the latest library for sqlite (ver 5.0.0) didn’t work for some reason. So the command above loads previous version.

Download the code from the GitHub: https://github.com/ExperimentalAvionics/GlassPanel

Create a folder for the EFIS web server

mkdir GlassPanel
cd GlassPanel

Place the downloaded code into this folder

Configure automatic start-up for this Node.js script (run the script as a service)

Create a config file:

sudo nano /etc/systemd/system/GlassPanel.service

Copy-paste the following text into the file

[Unit]
Description=Get Node.js EFIS server service running at boot
After=CAN_Listener.service

[Service]
User=pi
Group=pi
WorkingDirectory=/home/pi/GlassPanel
ExecStart=node webserver.js
Restart=always
StandardOutput=syslog
StandardError=syslog
SyslogIdentifier=GlassPanel

[Install]
WantedBy=multi-user.target

Enable the service:

sudo systemctl enable GlassPanel.service

Start the service

sudo systemctl start GlassPanel.service

Check the status:

systemctl status GlassPanel.service