Setting up WIFI
WIFI support requires a Raspberry Pi with onboard WIFI. USB WIFI devices are not supported.
WIFI uses the standard wpa_supplicant to provide access to secure networks using WPA2. In order to configure WIFI support you must add your network settings to the wpa_supplicant.conf
file that can be found in the root directory of your SD card. The default state of the file is as below.
#
# wpa_supplicant.conf
#
country=<2 char country code>
network={
ssid="<your router name>"
psk="<your router password>"
proto=WPA2
key_mgmt=WPA-PSK
}
Edit the country=
, ssid=
and psk=
and replace the default strings with your country code, the name of your router and the password. Here is an example:
#
# wpa_supplicant.conf
#
country=GB
network={
ssid="BT4355-2"
psk="aE65gh23DE"
proto=WPA2
key_mgmt=WPA-PSK
}
You must get the country code right or the connection might fail. Don’t pick a random country code. Find out the proper code for your country and use it.
Reboot the device and it should connect to your network. To verify it is connected, either connect to your router and view the list of connected devices, or use the SDC Tools to verify it is broadcasting its presence. SDC broadcasts its availability every 5 seconds when connected to a network. In addition, the default XML configuration that ships with the system will place a WIFI icon on the top right of the page when it is connected to the network. The WIFI icon is on the Always Page so it will be present no matter which page is being displayed.
Limiting WIFI to a specific frequency
wpa_supplicant is a standard system used for establishing a secure connection to a WIFI network. It supports many configuration settings, with the above examples being only basic ones. If you have any difficulties getting connected to your router, you may wish to force the connection to a specific BSSID (Base Station ID).
The BSSID is a mac address of the form hh:hh:hh:hh:hh:hh where hh are a 2 digit hex numbers.
Typically routers that support both 5Ghz and 2.4Ghz frequencies will have separate BSSID’s for the two interfaces. They may be both published under the same SSID (which is what is used in the examples above). Therefore to force a frequency you can pick the interface representing the frequency you want.
Depending on which type of Raspberry Pi you are using, it may prefer to connect to a 5Ghz network over a 2.4Ghz because typically 5Ghz networks are faster. Sometimes though, you might find that your vehicle is within range of your 5Ghz network but in fact the signal strength is too poor for it to complete the connection reliably. In such a case, forcing the device to use 2.4Ghz instead may help, as typically 2.4Ghz networks are a bit slower but have better range.
Some Raspberry Pi’s do not support 5Ghz at all, so be aware of which one you have and what it supports, and configure it appropriately. Don’t try and force a 5Ghz connection on a device that doesn’t support it.
To force a specific BSSID, you can use the following example:
#
# wpa_supplicant.conf
#
country=GB
network={
ssid="BT4355-2"
psk="aE65gh23DE"
proto=WPA2
key_mgmt=WPA-PSK
bssid=04:a2:22:2c:d5:0f
}
Just replace the mac address with the one of the interface you want to connect to, and of course make sure the ssid, psk and country entries match your router’s details as previously outlined. To find the mac address, you can use a WIFI scanner application on your phone, or you may find it on the administration page of your router (not all routers will show it though).
Wired Networks
Wired networks are obviously not much use when your device is in the car, but if you are bench testing and you have a device that has an Ethernet port on it, then if you connect it directly to your router with an Ethernet cable it should automatically connect to your network. This can be useful if you are trying to get WIFI working and want to look in the Application Log to find out whether there are any error messages.
If you have a wired network connected and enable WIFI, then SDC will be connected to your router twice, and with two different IP addresses. This is not a problem but don’t be lured into thinking that WIFI is connected if you can access the device over the network because it could be using the wired connection instead. To verify WIFI is working properly, disconnect any wired networks and reboot the device.
Alternative network connection methods
If you are having trouble achieving a network connection, then there is an alternative WIFI connection method you can try. This involves switching from the “software supplicant” mode (the default as-shipped) to the “firmware supplicant” mode. This does not work on a Raspberry Pi Zero2W but it should work on the other supported devices.
- Remove the SD Card and edit the sdc.ini file in the root of the file system. Change
usesupplicant=1
tousesupplicant=0
in the[wifi]
section. - Edit the file cmdline.txt in the \kernel folder and fill in the gaps for SSID, KEY, and COUNTRY entries. For KEY used the value you previously used for psk in the wpa_supplicant.conf file. Do not leave the angle brackets in the file and do not add double quotes around the values e.g. if your SSID is “MYNET” and your password is “12345” and your country is the UK, then the entry should say
SSID=MYNET KEY=12345 COUNTRY=GB SHELL_UPDATE...
(with the rest of the line kept intact as it was before).
Important: After editing this file YOU MUST MAKE SURE THAT THERE IS STILL ONLY ONE LINE IN THE FILE i.e. all of the entries are on the same line with a space in between each one.
You can now reboot the device and see whether the network connection is successful.
If you want to revert back to the software supplicant mode, you can restore the usesupplicant=1
entry in the ini file and leave the cmdline.txt file as is.
If you still cannot get WIFI to connect then try an alternative router if you have one. One possibility is to use your mobile phone as a hotspot and connect both your PC and Raspberry Pi to it.
For people with problems connecting I am happy to try and collect data from the network connection attempts in order to establish what the issue is. This is a bit more involved and requires enabling of certain system logging that is turned off by default. Instructions can be provided for this if such a a point is reached. Contact me via the support channels for help.