Change PlotttyBot default configuration - CodeClubLuxembourg/plottybot-toolkit-web GitHub Wiki
TL;DR
sudo nano /etc/hostname
sudo nano /etc/hosts
sudo raspi-config nonint do_wifi_country LU
sudo timedatectl set-timezone Europe/Luxembourg
sudo nano /etc/hostapd/hostapd.conf
sudo nano /etc/wpa_supplicant/wpa_supplicant.conf
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
country=LU
network={
ssid="Code Club"
psk="Kxxxxxxx0"
key_mgmt=WPA-PSK
}
#reboot
sudo pip3 install websockets
sudo cp codeclub/calibration.php /var/www/html/.
sudo cp codeclub/gcode.php /var/www/html/.
sudo cp codeclub/javascript.js /var/www/html/.
sudo cp codeclub/plottybot.py /usr/local/bin/.
sudo cp codeclub/plottybot_scratch.py /usr/local/bin/.
sudo chmod 555 /usr/local/bin/plottybot_scratch.py
sudo chmod 555 /usr/local/bin/plottybot.py
sudo cp codeclub/rc.local /etc/rc.local
#fix IP address on wifi router
Hostname Setup
sudo hostnamectl set-hostname plottybot01
- Updates system hostname to
plottybot01
.
sudo raspi-config nonint do_hostname plottybot02
at the end the following is still better to change its name (none of the command above change the hosts
file):
sudo nano /etc/hostname
sudo nano /etc/hosts
Wi-Fi Country
Set the Wi-Fi country to Luxembourg:
sudo raspi-config nonint do_wifi_country LU
AP Configuration
Modify the hostapd configuration for unique SSID and password:
sudo nano /etc/hostapd/hostapd.conf
Update:
ssid=PlottyBot01
wpa_passphrase=1234567890
Save and exit.
Wifi connection to Code Club
Normally http://10.0.0.5/ -> to setup wifi but that anyway create a connection if US
Static IP Address
Ensure dhcpcd.conf
has the proper fallback IP:
sudo nano /etc/dhcpcd.conf
Add:
interface wlan0 static ip_address=10.0.0.5/24
DNS Configuration
Ensure fallback DNS:
echo 'nameserver 1.1.1.1' | sudo tee /etc/resolv.conf echo 'nameserver 8.8.8.8' | sudo tee -a /etc/resolv.conf
Persistent AP Fallback
Ensure the cron job runs correctly for fallback:
sudo nano /etc/cron.d/autohotspot
Ensure content:
* * * * * root /usr/bin/autohotspot
Testing the Configuration
Reboot and verify:
sudo reboot
After reboot:
- Connect to
PlottyBot01
AP. - Access the interface at
http://plottybot01.local
orhttp://10.0.0.5
.
This ensures each PlottyBot has a unique hostname, AP, and fallback behavior. Repeat for other PlottyBots by incrementing numbers in hostname
, hostapd
, and autohotspot
configurations.