OpenFJ / OpenSJ
This document contains the steps for building OpenFJ / OpenSJ.
OpenFJ is intended for use in a vehicle (Toyota FJ Cruiser) for driving around Africa.
OpenSJ is the version for the ocean sailing vessel Sojourner.
This is a collection of hardware and software combined into an appliance to do the following:
RaspAP - Routing and VPN access: one wifi SSID that routes traffic to a local wifi (hotel, marina, etc.) and activates a VPN.
LTE Modem - Add a local 4G SIM card for internet access
Airtunes - enable music streaming over airtunes to an amplifier
GPS NMEA - capture GPS data with gpsd
NTP - synchronize time over GPS
kismet: wardriving/warsailing data collection with a secondary wifi antenna
Camera capture
ALPR
People counter
Dashcam / Cabincam
OBD-II interface: capturing FJ telemetry
Accelerometer/gyroscope: capturing acceleration in three axis for
Thermometer: measuring internal temperature and humidity (i.e. for cigar storage)
360° camera capture and IPFS integration
Remote storage and backup support
USB drive
Flipper Zero
Dynamic sailboat polar calculation for optimizing weather routing
Sensor integration (bilge/water sensor)
Hardware
The base hardware configuration:
Device | Description | Approximate cost |
---|---|---|
Raspberry Pi 5 |
| $90(RPI 5, 8GB) |
64GB SD storage card | SanDisk 64GB | $12 |
NoIR / Wide camera | Raspberry Pi, V3 | $35 |
52Pi NVDAC NVMe hat | Provides an M.2 connector for the Hailo AI chip and HiFiBerry DAC for decent audio output | $30 |
7” touchscreen | Raspberry Pi, official 7” screen | $97 |
Garmin 296 GPS | My aeronautical / marine GPS | $25 GPS modules available |
LTE modem | Generic USB / LTE modem | $18 |
USB Wifi module | Realtek RTL8812 support | $19 |
USB extenders | Right angle USB extenders | $8 |
SmartiPi case | Small RPI dashboard case | $33 |
USB storage | 1TB storage device | $20 |
Flipper Zero | shop.flipperzero.one | $169 |
Thermometer | DHT22 AM2302 or similar | $7 |
Accelerometer | ADXL345 IIC/SPI | $4 |
AI Hat | Hailo 8L - 13 TOPS | $76 |
| Total | ~ $500 |
Raspbian install
Install the latest version of 64-bit Raspbian and configure to work headless.
Do this without first connecting the additional WIFI adapters.
There are many ways to install raspbian, but the easiest is by using the Raspberry Pi imager:
Customize settings to access headless.
To install bookworm on the Raspberry Pi 3b, select “No filter” for the device.
Install the SD card in the Raspberry Pi, find the IP address, and connect via ssh.
2c:cf:67:75:
mtb@MTBMBP ~ % arp -a
? (10.0.0.113) at b8:27:eb:b9:17:75 on en0 ifscope [ethernet]
mtb@MTBMBP ~ % ssh 10.0.0.113
The authenticity of host '10.0.0.113 (10.0.0.113)' can't be established.
ED25519 key fingerprint is SHA256:FFpeD1jIncN86IlDPaHfwOGKC1NuubTyEgwpq4nDTc.
This key is not known by any other names.
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Failed to add the host to the list of known hosts (/Users/mtb/.ssh/known_hosts).
Linux openfj 6.1.21-v8+ #1642 SMP PREEMPT Mon Apr 3 17:24:16 BST 2023 aarch64
The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.
Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
Last login: Tue Dec 5 00:10:33 2023
Afterwords, update:
sudo apt-get update
sudo apt-get full-upgrade
sudo reboot
Routing
Install RaspAP to enable routing across wifi networks. Crew members will connect to OpenFJ/OpenSJ, but RaspAP can be configured to route through any local wifi access point, Starlink, or LTE modem.
To utilize all of the network functions (like USB dongle support) RaspAP Insiders Edition is required. This requires becoming a patron for at least $10 per month of the RaspAP project.
To validate with the RaspAP repository on github, a ssh-key needs to be added on OpenFJ/OpenSJ to validate with github.
First, generate an ssh key with the GitHub email address:
ssh-keygen -t ed25519 -C "your_email@example.com"
Then copy the contents of .ssh/id_ed25519.pub and create a new ssh key on github.
Finally, create a Personal access token (classic) on github
Check the validity of the personal access token:
And install RaspAP using the easy installer (with insiders option enabled). During the installation, introduce the github username, and personal access token as the password:
The Quick installer will complete the steps in the manual installation for you.
After a reboot at the end of the installation, the wireless AP network will be configured as follows:
IP address: 10.3.141.1
Username: admin
Password: secret
DHCP range: 10.3.141.50 to 10.3.141.254
SSID: raspi-webgui
Password: ChangeMe
Your AP's basic settings and many advanced options are now ready to be modified by RaspAP.
Insider settings
Rerun the installer with the upgrade option for the insider settings
Basic Settings
After running the Quick installer or following the manual installation steps, RaspAP will start up a routed wireless access point (AP) with a default configuration. As part of this initial setup, the hostapd
service broadcasts an AP with the following settings:
Interface: wlan0
SSID: raspi-webgui
Wireless Mode: 802.11n - 2.4GHz
Channel: 1
Security Type: WPA2
Encryption Type: CCMP
Passphrase: ChangeMe
Each of these settings may be changed on the Hotspot > Basic and Security tabs. Your changes will be applied and made visible on the broadcasted AP by choosingSave settings followed by Restart hotspot.
At this point, a dialog will appear to indicate the progress of the RaspAP service. This is a Linux systemd
process that is responsible for starting up several network services in a specific order and timing.
WIFI Routing
With the USB dongle connected and AP active, use RaspAP's WiFi client interface to select and authenticate with your existing wireless router.
The current network configuration will display two default routes. This may be confirmed by checking the Routing table output on RaspAP's Networking interface. In the example below, wlan0
is the AP interface and has a default route (identified by the default
label) and a metric value of 303
:
Note that our USB adapter is on the wlan1
interface and has a higher metric value of 304
. It also has a default route. Until we configure these metrics, our WiFi repeater does not know how to route packets from wlan1
(the client interface) to wlan0
(the AP interface) and vice versa. Clients connected to the AP will not have internet connectivity. Fortunately, this is easily fixed.
Metrics and default routes are used by dhcpcd
, the DHCP daemon. Contrary to popular belief, RaspAP does not manipulate the IP routing table or set interface priorities without user input. The Linux kernel sets default metric values when the interface is brought up and will usually choose the network routes it decides is best. The DHCP daemon uses these metrics to prioritize interfaces, where lower values are given a higher priority.
To configure routing for our repeater, select wlan0
(the AP interface, in this example) from the DHCP Server settings interface. Be sure that the "Install a default route for this interface" option is disabled.
Scroll to the bottom and set a metric value of 305
for this interface, then choose Save settings:
This instructs the DHCP daemon to treat the wlan0
interface with a lower priority than the wlan1
interface. There's nothing magic about the value "305" in this example — the important thing is that the AP interface has a higher value, and thus a lower priorty, than the wlan1
interface.
For the changes to take effect, choose Restart hotspot from the Hotspot interface.
Behind the scenes, RaspAP has configured the wlan0
interface in /etc/dhcpcd.conf
like so:
This is reflected in the updated routing table, visible on the Networking interface. In the example below, the wlan0
interface hosting the AP no longer has a default route and shows a higher metric value (lower priority) than the wlan1
interface:
LTE modem
Connect the 4G LTE wifi dongle.
4G LTE WiFi Dongle,LTE WiFi Modem,Unlocked 4G Dongle - IMILINK
OpenFJ/OpenSJ static network configuration
SmartiPi Case setup
Now that the base operating system and networking have been configured, we can stuff the hardware into the SmartiPi case and utilize the touchscreen.
These instructions for putting the case together are an edited version of the assembly instructions found here. There will be leftover screws.
Step 1
Insert the female end of the Micro USB power splitter cable into the back cover as shown below.
Step 2
Use the two small black screws to secure the small plastic retaining part to the back cover. This will hold the power cable in the case.
Do not overtighten the screws!
Step 3
Assemble the metal base on the bottom of the plastic base. The metal base can only properly assemble onto the base one way. Please make sure all of the holes are aligned. Use the four silver screws to attach the metal base to the plastic base. Assemble the screws as shown in the photo. Then assemble the adhesive rubber feet in the locations show below.
Step 4
Assemble one of the white ribbon cables with the contacts facing up to the display connection on the display board. If using the fan, connect the red jumper lead that came with the display to the 5v connection on the display board GPIO pins and the black jumper lead to the ground pin. Remove the standoffs that attach the display board to the display and replace with the provided gold screws.
Step 5
Attach the display to the housing using the green screws as shown below. Feed the white ribbon cable through the slot in the center of the housing. Feed the fan power leads through the hole at the top.
Step 6
Assemble the port block part and the Raspberry Pi at the same time to the display housing. Use the standoffs that were removed in step 4 to hold the Raspberry pi in place.
Step 7
Connect the camera.
Step 8
Permanently cover the camera hole with the adhesive front panel.
Step 9
Assemble the display housing to the stand with the large black screws and nuts. DO NOT OVERTIGHTEN. Loosely attach the screws at this point.
Step 10
Attach the small rubber vibration mounts to the holes in the back cover as shown below. Push the small end of the mount through the back cover from the outside. Then pull it through the cover as shown.
Step 11
Then pull the rubbers mounts through the fan holes and pull the thin end of the mount until the
fan is mounted on the rubber mount as shown below. The fan should only be mounted in the way as shown below.
Step 12
Attach the power leads from the display to the red and black on the fan.
Step 13
Attach the power cables to the Pi and the display.
Step 14
Assemble the back cover to the display housing with the four black screws. The port blocking part should have tabs that fit inside the housing and cover.
Step 17
Adjust the angle of the display to suit you needs. Then tighten the pivot screws.
DO NOT OVERTIGHTEN. Tighten the screws just enough to hold the display in place.
Keyboard and Mouse
We need a keyboard and mouse to work with this device.
The Raspberry Pi touchscreen can work as a mouse, but not as a keyboard.
Airtunes
This tutorial involves configuring the the open-source AirPlay receiver called Shairport Sync. Most of the contents found in this section were directly lifted from here.
This software allows the Raspberry Pi to act as an AirPlay receiver by implementing Apple’s proprietary protocols so that it can stream music, from the output audio jack to the auxiliary input of the FJ’s amplifier.
This setup will allow you to play music from any AirPlay-enabled device to your Raspberry Pi meaning you can use any iPhone and some Android products with a compatible app installed.
First. we need to install several different packages, run the following commands on your Raspberry Pi to install all of the packages that we need.
We will now clone the shairport-sync source to OpenFJ.
We can now build and install the Shairport software.
The autoreconf command setups the basic config file. The configure command further sets up the build system, telling it to utilize the ALSA audio backend, the Avahi network and set it to use OpenSSL for encryption.
With the configuration process now completed we can compile Shairport-sync and install it.
To enable the Shairport Sync software to start automatically at system startup:
On an AirPlay-enabled device Openfj should appear in the devices list.
There are several different things we can do to improve the sound quality. The first of these is to change update the RPI firmware to a newer version of the audio driver.
Once the firmware update has completed, modify the RPI /boot/config.txt on the SD Card, with the following new line to this file.
Insure the analog jack is the main audio out and not the HDMI output.
We can utilize the following command in the Raspberry Pi’s terminal to do this.
Now modify the volume db Range that Shairport uses by changing the configuration file:
Find
Replace with
Finally, reboot OpenFJ:
To check the audio output:
And to adjust the output volume:
alsamixer
The pi uses a 4-Pole 3.5mm audio jack:
The sound quality of the on-board line-out jack on the raspberry pi is nominal.
GPS NMEA
Plug in the Garmin 296 GPS with a USB cable.
Does the RPI see the UPS?
Install gpsd
Deactivate gpsd
Start gpsd manually
Test (this may take several minutes to update, depending on GPS signal)
Edit the gpsd configuration file:
Enable the gpsd service
location
gpspipe -r
gpsbabel
foxtrotgps
gpsmon
Traccar
Traccar is the service for tracking the OpenFJ route, and providing a link for outside observers to follow.
Create the traccar directory
Download and unzip the server software for Linux ARM 64
Run the Traccar install/run procedure:
Start the Traccar server with systemctl:
Check the Traccar web portal:
Email: admin
Password: admin
time
sudo apg-get install ntp
sudo vi /etc/ntpsec/ntp.conf
ntpq -p
FindMyCar
OBD-II - over bluetooth
Camera Module
ALPR
People counter
360?
Environmental sensors
SDL
pwnagotchi
kismet
From this tutorial,
Install the kismet packages:
Add a kismet group and add a user:
Device Support
Check for device support:
This iw command should produce a list similar to the one above. Look for the wireless device that you intend on putting into monitoring mode (phy#1).
Now determine if the device can support monitoring mode. From the output of the iw phy phy1 info command, look for a section titled Supported interface modes:, and look for * monitor within it.
If this is not present, then this wireless adapter will not work.
Configure wireless adapter
Edit the interfaces file, including allow-hotplug, and disable the wlan1 interface from automatically being assigned an IP address. Also, set up the monitor mode of the interface before it is brought up by the operating system.
We then proceed to delete the wlan1 interface as we do not require it for what we are doing.
Reboot OpenFJ, and check to see if mon1: appears under ifconfig
Configuring Kismet
Edit the kismet configuration file
Start Kismet
WIGLE
TPMS
915Mhz sensor