Software can be built and installed on a Raspberry Pi 3B+, and set up as a service that starts automatically when the LED board is powered on. Command line options are available for the initially displayed text, text color, scrolling style, TCP/IP port, and LED board configurion.
TCP connections by ethernet from race timers will update the display using an Alge protocol.
-
-
-
-
-
-
- -SOFTWARE setup (hardware setup is separate set of steps)
Raspberry Pi software setup
- -SOFTWARE setup (hardware setup is separate set of steps)
-
-
-
-
-
- Install Raspberry Pi OS Lite (command line only)
a. Download and install official raspberrypi.com / Software / Raspberry Pi Imager
b. Put SD card in reader, insert in PC
c. Run c:\Program Files (x86)\Raspberry Pi Imager\rpi-imager.exe
d. Raspberry Pi 3
e. Raspberry Pi OS (Other)
f. Raspberry Pi OS Lite 64-bit
g. Next
h. Edit Settings (“customization”)
i. On General tab - Set hostname, such as lugedisplay2
- Set username and password, login name pi, with password selected
- Set locale settings, time zone America/Detroit, keyboard layout US
ii. On Services tab - Enable SSH (“use password authentication”)
iii. On Options tab - Eject media when finished
- Uncheck “Enable telemetry” (no need to send data over network)
iv. Save
v. Yes (to apply custom settings)
vi. Carefully CONFIRM that the text says it is going to overwrite the SDHC card (not your computer’s drives!)
then choose Yes (to erase all existing data on SDHC Card)
i. Remove SD card from computer, remove micro SD card, and insert it into the Pi - Set wireless locale
a. sudo raspi-config
b. Cursor down to Locale settings
c. Choose WiFi Locale
d. Choose country
e. Save and exit - Connect via secure shell
a. Connect Ethernet cord from LED case to local switch or router with Ethernet access (for later step to download RGB Matrix software)
b. Use PC browser to access router and determine what IP address the Pi is on
c. On PC:
ssh [email protected]
when prompted, type:
yes [enter]
to accept new fingerprint key, and continue to access Pi - Edit /boot/firmware/config.txt (for x64)
or /boot/config.txt (for x32) to disable WiFi and Bluetooth:
sudo nano /boot/config.txt
a. Added lines to disable WiFi and Bluetooth support (to improve security):
dtoverlay=disable-wifi
dtoverlay=disable-bt
b. Commented out the audio enable (required for proper use of matrix bonnet):
#dtparam=audio=on
c. Change line to add “,noaudio” parameter, thus disabling hdmi audio:
dtoverlay=vc4-kms-v3d,noaudio
5. Edit /boot/firmware/cmdline.txt (or /boot/cmdline.txt) and isolate a cpu:
a. Add at the end of the argument entries (no newline):
isolcpus=3
6. Blacklist start of default audio device process
(required for proper use of matrix bonnet):
a. sudo nano /etc/modprobe.d/blacklist_snd_bcm2835.conf
b. blacklist snd_bcm2835
7. Disable ssh root login
a. sudo nano /etc/ssh/sshd_config
(find #PermitRootLogin line, uncomment and change it to)
PermitRootLogin no
8. Optionally, change Pi’s hostname by: sudo nano /etc/hostname
9. Config static IP address when no DHCP server found (notably, at direct connect from timer like RTPro)
a. Optionally, confirm current interfaces, IP address, gateway, dns (from terminal or ssh):
nmcli device status
nmcli device show eth0
b. If OS does not have dhcpcd via this check: sudo systemctl status dhcpcd
Then set backup static address by (text came from entry in nmcli device status:
sudo nmtui edit “Wired connection 1”
‘Edit’
Leave on Automatic (no need to change to Manual)
Add Address with unique Address (192.168.1.50/16 for first displayboard, perhaps ….1.51/16 for second display board); may also add second 169.254.x.y/16 static for LAN without router.
(leave Gateway and DNS server blank)
OK to save, then restart Pi to update parameters:
sudo reboot now
Can alternatively just restart the network via:
sudo nmcli connection reload
or
sudo systemctl restart NetworkManager
- Installed RGB Matrix packages (can take ~15 minutes)
a. curl https://raw.githubusercontent.com/adafruit/Raspberry-Pi-Installer-Scripts/main/rgb-matrix.sh > rgb-matrix.sh
b. sudo bash rgb-matrix.sh
c. ‘y’ to confirm installation
d. ‘1’ to install for Bonnet (not Hat+RTC)
e. Choose ‘Quality’ setting (not ‘Convenience’)
f. Read list to ensure you chose as intended, then:
‘y’ to confirm installation choices - Reboot:
a. sudo reboot now - Check control of display board, then download and build program
a. ssh [email protected]
b. sudo apt update
sudo apt upgrade
sudo apt install gh
sudo apt install git
if needed: gh auth login
git clone https://github.com/mcder017/led-timer-display
make
c. Check that the program runs and displays on the LED board:
sudo ./display/led-timer-display -Q abcd
or perhaps (can also see option detail led-timer-display.cc, or in rpi-rgb-led-matrix library code):
sudo ./display/led-timer-display --led-rows=16 --led-cols=32 --led-chain=3 --led-slowdown-gpio=2 -f ./fonts/10x20.bdf -C 255,0,0 -t-1 -y-1 --led-gpio-mapping=adafruit-hat-pwm -s 0 Test
if git auth was done, can remove those keys: rm ~/.ssh/id_ed*
d. Optionally, browse the examples folder from hzeller’s rpi-rgb-led-display library repo
e. Optionally, browse ./fonts folder with BDF fonts required for use with text display; consider ./fonts/10x20.bdf or alternately export your own and copy to the Pi).
f. Note that this repo’s library code base is MODIFIED from hzeller’s, in particular to add the ability to load a bdf font from a text string.
See led-timer-display / display / bdf-10x20-local.h as an example.
g. Note: can copy files to/from windows, via cmd (not yet in ssh), using scp:
scp [email protected] :/path/folder/* /localpath/folder
and optionally use -r at the beginning to recursively copy subfolders
- Set up automatic run of program when Pi boots
a. sudo nano /etc/systemd/system/led-timer-display.service
b. Type:
[Unit]
Description=LED Timer Display
After=network.target
[Service]
ExecStart=sudo python /home/pi/timerdisplay.py
WorkingDirectory=/home/pi
User=pi
Restart=always
[Install]
WantedBy=multi-user.target
c. sudo systemctl enable led-timer-display
d. sudo systemctl start led-timer-display
e. Note, from ssh can stop the service (to permit testing program changes):
sudo systemctl stop led-timer-display
Can reload the executable after modifications by rebooting the Pi, or:
sudo systemctl daemon-reload
sudo systemctl start led-timer-display
f. Other useful tidbits for working with the Pi services
note, from ssh can use: sudo systemctl status led-timer-display (then q to end)
sudo journalctl > /tmpjournal.txt/tmpjournal.txt .
then in Windows, scp [email protected]:
systemd-analyze plot > output.svg
If multiple ssh sessions:
wall Hi Everyone!
To leave ssh session:
exit
• Note RTPro uses fixed port 21968 for communicating data out to PC software (like SplitSecond Timing software).
• Note RTPro uses port 21967 (by default) for communicating to Display boards, such as via Alge protocol. Must be in a race (New or Reloaded) to find the Displayboards settings (gear menu at top right, then Displayboard List for the IP address, and Displayboard Settings for net port.
• If making code updates on a remote system and pushing to GitHub, then in the ssh session:
cd ~/led-timer-display
git fetch
git pull origin master (if errors, then remove whatever locally modified files you tinkered with)
make clean (preferably, to ensure header changes don’t break the linker)
make
o To kill a process running, from ssh:
ps -e | grep LED (or whatever string)
pidof led-timer-display
kill pid_number
kill -9 pid_number (for hung process signal interrupt kill)
On a PC, can back up the microSD card to an image file. Example commands to help process…
• On mac, open a terminal.
diskutil list
(Look for size, e.g. disk4, with FAT plus Linux partitions.
Plan to insert “raw” command letter r before the disk4, e.g. rdisk4…)
• Make image from microSD to the Mac:
sudo dd bs=16M if=/dev/rdisk4 of=sd_backup.dmg status=progress
• To write image to a new microSD card:
sudo diskutil unmountDisk /dev/disk4
sudo gdd bs=16M of=/dev/rdisk4 if=sd_backup.dmg status=progress
Note some timers like RTPro have to be rebooted after setting its static IP address before it will take effect.
To monitor cpu, consider running top or htop:
if needed: sudo apt-get update && sudo apt-get install htop
htop
Display board address 0 is base display. Address 1 is “display A”.