Disabling HiWonder TurboPi WiFi Access Point - GMU-ASRC/turbopi GitHub Wiki

How to convert from Point-to-Point (ad-hoc) connection to centralized

Out-of-the-box, these HiWonder TurboPi robots will create their own Access Point (AP) to allow you to connect them to your laptop via a direct WiFi connection.
However, doing this is inconvenient for a number of reasons, i.e. your laptop and the TurboPi won't have internet access, connecting is slow, it can be confusing which robot is which, etc.
This is a guide on how to convert the robots to connect to a router.
If you connect to the router, you'd be able to control any of the robots connected to the router.

Here's how to do it:

First, connect to the robot via an ad-hoc direct WiFi connection (the same way you've been doing).
Then, connect via either VNC or ssh, open a terminal, and run the following line:

echo -e "\n" | sudo tee -a /etc/wpa_supplicant/wpa_supplicant.conf

Then, manually type and run the following line.
Hint: You can try hitting tab halfway through typing certain words to autocomplete.

wpa_passphrase SPARXmobil PASSPHRASE | sudo tee -a /etc/wpa_supplicant/wpa_supplicant.conf

You will need to replace PASSPHRASE with the password, which can be found in the slack.

To check your work, type the following.
sudo nano /etc/wpa_supplicant/wpa_supplicant.conf This will open an editor for the file wpa_supplicant.conf. You should see something like this:

ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
country=CN


network={
        ssid="Hiwonder_5G"
        psk="hiwonder"
        key_mgmt=WPA-PSK
}

network={
        ssid="SPARXmobil"
        #psk=SECRET
        psk=3875a6faf6f27e45e353ca6327c6880a97bd2f90896eea38ef028af74dc6ce3f
}

Remember to save if you've made changes, and exit nano.

Then, type this line, replacing XX with the number on the front of the robot.
echo -e "interface wlan0\nstatic ip_address=192.168.9.1XX/20" | sudo tee -a /etc/dhcpcd.conf
This IP address will become the new IP address of the robot.
Then, copy and paste these lines.

echo -e "static routers=192.168.0.1\ndomain_name_servers=192.168.0.1" | sudo tee -a /etc/dhcpcd.conf
sudo systemctl enable wpa_supplicant
sudo systemctl enable dhcpcd

To double-check the values, look at the bottom of the file:
nano /etc/dhcpcd.conf
You should see something like this near the bottom:

# fallback to static profile on eth0
#interface eth0
#fallback static_eth0

interface wlan0
static ip_address=192.168.9.103/20
static routers=192.168.0.1
domain_name_servers=192.168.0.1

Again, replace the last two digits of 192.168.9.103 with the number of the robot.
Crucially, there should be no duplicate entries for interface wlan0. The lines beginning with the # character indicate that the line is commented out, so those don't affect anything and are fine to leave in.
Once you're done, save and exit nano.

Now we can disable the built-in direct-connection WiFi script, and restart.

sudo systemctl disable hw_wifi

This should show the following message:
Removed /etc/systemd/system/multi-user.target.wants/hw_wifi.service.

Then, type the following, replacing XX with the two-digit number on the front of the robot:

sudo hostnamectl set-hostname turbopi-XX

This sets the hostname.

Finally, reboot the pi by running the following command:

sudo reboot now

You will now need to connect to the router using the IP you specified above.