Headless Setup GoPiGo3 Over PiOS
(adds VNC for Mac Screen Connect)
As Of: 14 Oct 2021
Check for latest PiOS:
Check for latest GoPiGo3 Software:
- Check last commit date at https://github.com/DexterInd/GoPiGo3
- Check last commit date at https://github.com/DexterInd/DI_Sensors
Write Latest PiOS to SDcard with Raspberry Pi Imager
Preconfigure WiFi SSID/PW and enable SSH
- touch /boot/ssh.txt (or create the empty file)
- write /boot/wifi_supplicant.conf (example USA WiFi)
country=US
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
network={
ssid="wifissid"
psk="wifipassword"
key_mgmt=WPA-PSK
}
First Boot: (With amplified speaker or headphones connected)
- Announces bot IP
- Will keep playing “To Install Screen Reader - press cntrl-alt-space” through audio jack
(until you ssh in and rename the prompt in the next step)
First SSH:
- ssh pi@X.X.X.X (The IP spoken by bot at boot)
- (If needed: ssh-keygen -R X.X.X.X , then try ssh again)
- pw: raspberry
- To stop incessant message:
$ sudo mv /usr/share/piwiz/srprompt.wav /usr/share/piwiz/srprompt.wav.bak
Change password:
$ passwd (do not use sudo passwd, will mess up pw table, use sudo vipw, save, exit to fix)
Update OS
$ sudo apt update
$ sudo apt full-upgrade
a readme will pop - press q
(Now go out for lunch/dinner, takes a long while)
$ sudo reboot
[Optional] Install espeak-ng Text-To-Speech
$ sudo apt install espeak-ng
$ espeak-ng "Hello"
===Install GoPiGo3 software
$ curl -kL dexterindustries.com/update_gopigo3 | bash
$ curl -kL dexterindustries.com/update_sensors | bash
$ sudo reboot
(Note green pwr LED will be solid after this indicating gpg3_power.service is running)
(Note red/green "yellow" WiFi LED means connected to WiFi)
Test GoPiGo3 Software Installation
$ cd Dexter/GoPiGo3/Software/Examples
$ ./Read_Info.py
- check gpg3_config.json for ticks
$ more ~/Dexter/gpg3_config.json
* "Old GoPiGo3":
{"wheel-diameter": 66.5, "wheel-base-width": 117, "ticks": 6, "motor_gear_ratio": 120}
* "New GoPiGo3":
{"wheel-diameter": 66.5, "wheel-base-width": 117, "ticks": 16, "motor_gear_ratio": 120}
- Continue with test effectors and sensors
$ ./Motors.py
$ ./Servo.py
$ ./Grove_US2.py (with Grove Ultrasonic Ranger in AD1 for time being)
$ ./easy_Distance_Sensor.py
$ python3 ~/Dexter/DI_sensors/Python/Examples/IMUSensor.py
(Put IMU in AD1, move Grove US ranger to AD2 and
change Grove_US.py GPG.GROVE_1 to GPG.GROVE_2 two places)
=== Configure for locale, timezone (US-Eastern Timezone in my case), add VNC
$ sudo raspi-config
-
(You can exit menus by using Tab key, move to Finish, enter key)
-
Network Options: change hostname if desired (default is raspberrypi)
-
change Localisation:Locale
- unselect en_GB with spacebar,
- select en_US.UTF8 with spacebar
- Tab to OK, Return
- default local? down to en_US.UTF-8, return
Â
-
change Localisation:Timezone-> US->Eastern
-
change Localisation:WiFi Country->US
-
Interfacing:PiCamera enable
-
DisplayOptions:Resolution:1920x1080
-
SystemOptions:BootOptions:Desktop GUI, requiring user to login, Return
-
Interfacing: VNC enable
-
Tab to Finish, reboot now? yes
=== Configuring vncserver
$ nano /home/pi/.vnc/config.d/vncserver-x11-virtual
add to file these two lines, save and exit (ctrl-x):
Authentication=VncAuth
Encryption=PreferOff
Continuing:
sudo cp .vnc/config.d/vncserver-x11-virtual /root/.vnc/config.d/vncserver-x11
sudo vncpasswd -service (set the password you want for vnc logins)
sudo systemctl restart vncserver-x11-serviced.service
vncserver -kill :1
vncserver :1 -geometry 1920x1080 -depth 24 -Authentication VncAuth -Encryption PreferOff -SecurityTypes StandardUser
- Use “Mac splat-k” (Command-k) to bring up “Connect to Server”
vnc://ip.ip.ip.ip (no port), press enter
enter vnc service password
Pi will guide through setting up like a new user, just go with it
- set timezone,
- connect to WiFi,
- set a password (I used pi user password set earlier),
- skip the OS update,
- Done
=== Run Desktop "GoPiGo3 Control Panel"
- asks what do you want to do? Click Execute
- Try all the buttons
=== Run Desktop "GoPiGo3 Calibration"
- Asks what to do: Execute
- For my bot at this speed: 66.5mm and 104.5mm WOW!! worked best
- This must because it is at 300DPS.
- I usually run my bot at 150DPS so config closer to the physical 117mm
- Save and Exit
- Check that it saved:
$ more ~/Dexter/gpg3_config.json
{"wheel-diameter": 66.5, "wheel-base-width": 104.5, "ticks": 16, "motor_gear_ratio": 120}
=== Check File Space
- $ df -h
=== Check Memory
- $ free -h
=== Test Camera
In an ssh terminal or terminal on the desktop:
$ cd ~/Dexter/GoPiGo3/Projects/RemoteCameraRobot
- BTW - Read the README at: https://github.com/DexterInd/GoPiGo3/tree/master/Projects/RemoteCameraRobot
$ sudo pip3 install -r requirements.txt
$ python3 remote_robot.py
- Open a browser to http://<your bot’s IP>:5000 (note: http not https )
- Hold down mouse button and drag it fwd to go forward,
- try dragging right/left/back etc.
=== SHUTTING DOWN
$ sudo shutdown -h now
- NOW WATCH FOR THE GREEN LIGHT TO START BLINKING - (may take a minute or two)
- Turn power off, recharge battery