Split Lap Timing – Slave Timers Setup
In this section we will look at configuring the RotorHazard split timers or “slaves”, install and configure the NTP server and install the Random Number Generator for increased WiFi range and connectivity.
We will configure a master timer with 2 slaves connected via a WiFi cluster, with the master being the wireless access point. The idea of this is to have the slaves all connect to the master timer which is out AP.
For the slaves, we do not need to install HostAPD or DNSMasq as our slaves are not offering DHCP leases and will not be WiFi hotspots, rather act as WiFi clients connecting to the master AP.
First, we will start by installing our NTP server. The master acts as a NTP server and gives out its time and date to the slaves so they are always exactly in sync. Install the NTP server on all the timers, both master and slaves, then we will configure the master as the NTP server and the slaves become clients.
sudo apt-get install ntp
Now, we tell the master that it is the NTP server and will handle all NTP requests. Edit /etc/npd.conf and setup as per your subnet. Here we are using the 192.168.10.0/24 network
192.168.10.0 will be our NETWORK address and 192.168.10.255 is our BROADCAST address.
sudo nano /etc/npd.conf
restrict 192.168.10.0 mask 255.255.255.0
broadcast 192.168.10.255
Now, on all slaves do the same and edit /etc/npd.conf. This time we will tell the slaves NTP where the server is located. 192.168.10.1 being the master timers static IP.
sudo nano /etc/npd.conf
server 192.168.10.1
Now, we force a time sync and restart the NTP server. Run these commands on all timers.
sudo systemctl stop systemd-timesyncd
sudo systemctl disable systemd-timesyncd
sudo /etc/init.d/ntp restart
Now all times and dates across all timers should be perfectly synced. Next we install the Random Number Generator. This will help improve WiFi integrity. Install on master and all slaves.
sudo apt-get install rng-tools
Now, edit the /etc/default/rng-tools file
sudo nano /etc/default/rng-tools
Find the line that reads
#HRNGDEVICE=/dev/hwrng
And uncomment the line too look like this.
HRNGDEVICE=/dev/hwrng
Hit ctrl + x and Y to save the file.
Now, we look at configuring the Master. We need to specify where the slaves are located by adding each individual slave in the config.json file.
Here is an example JSON configuration file of the Master timer
{
"GENERAL": {
"HTTP_PORT": 80,
"SECRET_KEY": "secret!",
"ADMIN_USERNAME": "admin",
"ADMIN_PASSWORD": "rotorhazard",
"DEBUG": false,
"CORS_ALLOWED_HOSTS": "*",
"SLAVES": ["192.168.10.2:80", "192.168.10.3:80", "192.168.10.4:80", "192.168.10.5:80"]
},
"LED": {
"LED_COUNT": 150,
"LED_PIN": 10,
"LED_FREQ_HZ": 800000,
"LED_DMA": 10,
"LED_INVERT": false,
"LED_CHANNEL": 0
}
}
The following line will specify where each slave is located. Edit these IP addresses as per the slaves you have running. Also specify the PORT that the rotorhazard web server is running.
"SLAVES": ["192.168.10.2:80", "192.168.10.3:80", "192.168.10.4:80", "192.168.10.5:80"]
In this example, we have 4 salves with addresses 192.168.10.2 – 5 operating on port 80. Now save the configuration with crtl + x and lets boot the rotorhazard server. We will boot the server manually to check for any errors and to ensure the configuration files has been loaded successfully.
Addition options can be configured here.
"SLAVES": [{"address": "192.168.1.2:5000", "mode": "timer", "distance": 5}, {"address": "192.168.1.2:5000", "mode": "mirror"}],
"SLAVE_TIMEOUT": 10
Please see the rotorhazard documentation, as I cant be %^$&%^ going into this!
When the server starts, you will see the first line print
Configuration file imported
If you see an error such as
Configuration file invalid, using defaults
You have invalid code in your config.json file. Check your code and try again. You can use a JSON online validator here to check your JSON code.
Running OTA Updater
The latest ready to flash images now includes the OTA (Over The Air) updater for flashing the nodes easily. This requires a hardware mod unless using the latest PC board which includes all hardware mods.
The OTA updater now includes a lot of additional features, such as configuring the hotspot, choose previous version of RH to install, backup existing RH installs. More information can be found at
https://github.com/szafranski/RH-ota
To launch the RH OTA tool in the ready to flash images.
cd ~
cd RH-ota
sudo python3 start_ota.py
To update the OTA updater software
cd ~
cd RH-ota
sudo python3 update.py
A list of additional scrips can be run by executing them from the root ota directory, however most of these are accessible from the main menu when running start-ota.py
cd ~
cd RH-ota
ls
sudo python3 SCRIPTNAME.py
Configuring The Slaves
Next we move onto the SLAVES. Slaves are required to connect to the Master timer, to do this we will simply edit the wpa_supplicant with the relevant WiFi details to allow the host to connect to the Master AP. I would suggest starting with a fresh install of buster lite and rotorhazard on all slaves for a smooth configuration.
Lets setup a static IP on our first slave.
sudo nano /etc/dhcpcd.conf
We will set a static IP and static router and bind it to a relevant interface. In our case, wlan0. We can also setup our eth0 interface to be DHCP to allow for updating the timer.
interface wlan0
static ip_address=192.168.10.2/24
static routers=192.168.10.1
Here, we have configured our first slave with an IP address of 192.168.10.2/24. Next we will connect the slave timer to the Master AP. Again make sure that HostAPD and DNSMasq are not installed on the slaves.
sudo nano /etc/wpa_supplicant.conf/wpa_supplicant-wlan0.conf
Add the following and hit ctrl + x to save.
crtl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
country=YOUR COUNTRY
network={
ssid="racetimer"
psk="rotorhazard"
}
In the above example, we specify the SSID and password of the Masters AP. Now, the slave will successfully connect to the master timers WiFi network with a static IP address of 192.168.10.2/24. To confirm this, we can power on the Master followed by the slave. From a SSH session on the Master, we should now be able to ping the slave at 192.168.10.2
ping 192.168.10.2
PING 192.168.1.1 (192.168.10.2) 56(84) bytes of data.
64 bytes from 192.168.10.2: icmp_seq=1 ttl=64 time=3.15 ms
64 bytes from 192.168.10.2: icmp_seq=2 ttl=64 time=1.29 ms
64 bytes from 192.168.10.2: icmp_seq=3 ttl=64 time=0.728 ms
64 bytes from 192.168.10.2: icmp_seq=4 ttl=64 time=1.11 ms
This confirms that the Slave has successfully connected to the master, and is reachable via its static IP address.
All Comments
Awesome bro
Awesome article about the racetimer, but username and password dont work and the Admin login is also missing.
Could you please be so kind and share those information with us.
Hey man. The admin login for the web server didnt work? Should be admin and password as rotorhazard. Are you able to browse to the web server?
Yeah, that work. Thank man
Thank you for the guide and the pre-built image. Made it super quick to switch over from Delta5!
Great, glad it helped you. Stay tuned for new releases of RotorHazard, there are some cool upcoming features including split timing!
I flashed the 2.1.1 .img, but I don’t see the AP, how can I enable the AP to get the SSID to show up?
Thanks,
Hi Quy, the easiest way to do this is to plug in a second USB wifi dongle. You should then get your SSID show. If you do not have one, do the following after connecting your timer to your router via Ethernet. This is because the WiFi AP is assigned to WLAN1 but the default wifi interface built into the PI is on WLAN0. Here we need to reassign the AP and DHCP server to use WLAN0 instead of WLAN1.
1. run sudo mv wpa_supplicant-wlan0.conf wpa_supplicant-wlan1.conf
2. sudo nano /etc/dhcpcd.conf
Find the following line and replace wlan1 with wlan0
interface wlan1 – Replace with wlan0
static ip_address=192.168.10.1/24
static routers=192.168.10.1
static domain_name_servers=192.168.10.1 8.8.8.8
3. sudo nano /etc/dnsmasq.conf
replace interface=wlan1 with interface=wlan0 – Hit ctrl x and y to save.
4. sudo nano /etc/hostapd/hostapd.conf
replace interface=wlan1 with interface=wlan0 – Hit ctrl x and y to save.
5. sudo reboot
You should now see the ‘racetimer’ SSID broadcast.
Hi Dean,
So I got it figured out with some ‘googling” … LOL
So I reimaged the SD card again to be sure to start fresh and when I ssh to the PI, I noticed a message saying WLan0 was disabled by rfkill, so I entered the following command:
ifconfig – (I was not able to see the WLan0 interface)
I then did the commands:
sudo rfkill unblock 0
sudo reboot
once I made a ssh connection again, I tried:
ifconfig – (I was now able to see the WLan0 interface)
I went back through your instructions, but for the wpa_supplicant-wlan0.conf .. this was located in /etc/wpa_supplicant/ folder correct?
I’m now able to see the “racetimer” SSID
Thanks.
Hi Dean,
Thanks for the instructions, unfortunately it didn’t work for me or I may have missed something.
First off, I’m not a linux expert by any means, but when I do the “ifconfig” command I don’t see the Wlan0 interface. Is this why the commands you provided did not work?
I tried another image 2.0.1 and was able to get the Wlan0, so is the 2.1.1 img missing something?
Thanks.
Yes, you should be seeing a wlan0 or a wlan1 interface. If you don’t see any interfaces this would mean that your wlan interface is either faulty, or down. To bring the interface up you could try
sudo ifconfig wlan0 up
i figured it out in the comment above… thanks.
No worries. Glad you got it sorted.
When i download image 2.1.1 the .rar file does not open. It gives me a message saying this file is not an archive.
Nevermind, seems my rar software is corrupt.
Glad you got it sorted.
hey thanks for the hard work .im having a hard time trying to boot from the compiled image.
the normal raspberry buster works but lots of the commands come back as fails and the compiled sd card 2.1.1 dosent boot and show on putty at all. ive been at this all day and im at a loose end now . is there a problem with the stable img? should i be doing something different than the normal boot version.. please help man . cheers . Nick
Hi Nick! I’ve updated the image. Could you try downloading again and flashing the new image and see if the SSID is broadcast as “racetimer”. I have moved the wpa_supplicant to wpa_supplicant-wlan1.conf so if you need internet access, you either need to use Ethernet or insert a USB wifi dongle and edit the wpa_supplicant-wlan1.conf in /etc/wpa_supplicant to your wifi details.
Cheers
hey Dean
Awesome ill try that again and let you know.
i got the buster one to almnost complete after 10 hours the other day lol but now plugging it back in i get this looping constantly “Raspbian GNU/Linux 10 raspberrypi ttyS0” so ive just formatted sd and started again.
Sweet, if you’re having consistent boot issues its almost 99% of the time a bad SD card. Try a different SD card!
Its weird as the sd is fine for the buster image. its writing the image now .did you change it to the 2.1 beta image as that is what its downloading as now? cheers
hey dean its booted from sd card but its maybe something I did loading all the files on the buster img.but im getting this login loop constantly
▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒ ▒▒▒ѥ▒▒Ɂlogin:
Raspbian GNU/Linux 10 racetimer ttyS0
god this is not my forte lol .
Yup, boot loops and hangs are generally SD cards! Especially if its a fresh install.
ok ill try another one. its showing in my wifi though as racetimer so something is working . thanks man
[ 16.256020] i2c /dev entries driver
racetimer login:
Raspbian GNU/Linux 10 racetimer ttyS0
▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒ѥ▒▒Ɂlogin:
Raspbian GNU/Linux 10 racetimer ttyS0
▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒ѥ▒▒Ɂlogin:
Raspbian GNU/Linux 10 racetimer ttyS0
▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒ѥ▒▒Ɂlogin:
Raspbian GNU/Linux 10 racetimer ttyS0
▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒@▒▒▒ѥ▒▒Ɂlogin:
Raspbian GNU/Linux 10 racetimer ttyS0
▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒ѥ▒▒Ɂlogin:
Raspbian GNU/Linux 10 racetimer ttyS0
4-fs error (device mmcblk0p2): ext4_lookup:1590: inode #21315: comm systemd: ige t: bad extra_isize 65535 (inode size 256)
[ 179.958102] EXT4-fs error (device mmcblk0p2): ext4_lookup:1590: inode #2065: comm rs:main Q:Reg: iget: bad extra_isize 65535 (inode size 256)
[ 179.988175] EXT4-fs error (device mmcblk0p2): ext4_lookup:1590: inode #21315: comm systemd: iget: bad extra_isize 65535 (inode size 256)
Raspbian GNU/Linux 10 racetimer ttyS0
▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒ѥ▒▒Ɂlogin:
Raspbian GNU/Linux 10 racetimer ttyS0
▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒ѥ▒▒Ɂlogin:
Raspbian GNU/Linux 10 racetimer ttyS0
so ive tried another sd card and the same happens .with the additional error lines now and then.
I haven’t got any nodes connected as I haven’t finished the build yet but im sure that’s not the problem .thanks for any help you can give me .
Very weird. How are you powering your pi? What is the current output?
its off the usb from pc .all working ok now im just triyng to update everything manually to the latest version from the 2.0.1 bad wifi connection is not fun with all this though :{
Cool. Yea I would recommend Ethernet
Hi Dean hope your’e well man ..Everything is working great with this timer ive got the external antenna installed and can connect over Ethernet too if i need to but im really struggling getting a wifi dongle working! Ive purchased one that is regocnised and is showing in ifconfig in wlan1 and i think the firmware is loaded ok but its the registering it on my network im having trouble with.. in the /etc/wpa_supplicant/wpa_supplicant.conf folder its empty and if i add credentials in there nothing happens .aloso same with /etc/wpa_supplicant/wpa_supplicant-wlan1.conf folder. I added stuff to the interfaces folder but then my ssh stopped working and i had to dig out the usb serial one again lol ..please help brother ,your’e much better at this than me .. cheers
Hi Nick
Can you post your WPA supplicant.
Also, is the wifi dongle acting as a client? And if so make sure the network you are connecting to is offering DHCP.
Thanks Dean, haven’t had chance to look recently but I had an idea to connect to my android phone via USB.. I cannot connect to it via ethernet as my phone doesn’t seem to pick it up using a ethernet to USB dongle. So I’ve managed to get the command line to connect to the broadcast ip using a USB cable and would like to know if I could adjust the broadcast of race timer to run out through the ip of the USB? Is this possible? Would be so much easier that way and I could get a 10m cable and have solid connection just unsung my phone.. Thanks for any help dude
Can you elaborate a little more. Are you trying to use an external AP connected via Ethernet?
Hi thanks for the guide! I used the image provided for 2.1.1 on a pi 3B+
The AP seems to be running out of the box, but the dnsmasq service fails to start.
The AP shows up and I can connect, but it just sits there “obtaining Ip address” and does nothing.
Any ideas? Reflash?
Also, just noticed the link to the 2.1.1 file is the same as the 2.1.0 beta 1…
Is there a link to the 2.1.1 image?
Many thanks!
Hey Jaemie.
Sorry the link is
https://mega.nz/file/77oSCAQa#dS9icw8gu9WxiH7Vo4kAIgMjwX1FcsmbRaCOHXX1iL0
Cheers.
Thanks Dean!
Pending this flash I have some RSSI issues. Is there a way I can chat or talk this issue through? I’m happy to pay for the help!
I’m in Australia if timezones are an issue.
You can throw your adapter on a static address on the 192.168.10.0/24 network.
Set a static IP on the adapter and your computer.
IP: 192.168.10.100
Mask: 255.255.255.0
No gateway or DNS
Try connect again and you should be able to ping or SSH 192.168.10.1.
Now you can check the issue with DNSMasq once connected.
I’m getting this error now…
● hostapd.service – Advanced IEEE 802.11 AP and IEEE 802.1X/WPA/WPA2/EAP Authenticator
Loaded: loaded (/lib/systemd/system/hostapd.service; enabled; vendor preset: enabled)
Active: activating (auto-restart) (Result: exit-code) since Mon 2020-05-25 06:32:14 BST; 879ms ago
Process: 774 ExecStart=/usr/sbin/hostapd -B -P /run/hostapd.pid -B $DAEMON_OPTS ${DAEMON_CONF} (code=exited, status=1/FAILURE)
why attached a wifi antenna before powering? without this mod there is also a open circruit and we powering it up where is the diffrent?
Sorry I dont understand your question. Cheers
When I start a race the laps aren’t being recorded. Sensor tuning seems good. Any ideas?
Make sure you are getting RSSI readouts on the tuning graph. Also make sure the peaks go above your enter at RSSI.