If You Must Have Bullseye - Successful GoPiGo3 over Bullseye Install

While ModRobotics is working hard to get an official install over PiOS Bullseye, I took a shot at bringing up a “no desktop tools” GoPiGo3 over PiOS Bullseye.

My install passed the following tests:

=== Test GoPiGo Functions

$ cd ~
$ python3 Dexter/GoPiGo3/Software/Python/Examples/Read_Info.py
$ more ~/Dexter/gpg3_config.json
$ python3 Dexter/GoPiGo3/Software/Python/Examples/LED.py
$ python3 Dexter/GoPiGo3/Software/Python/Examples/easy_Distance_Sensor.py
$ python3 Dexter/DI_Sensors/Python/Examples/IMUSensor.py
$ python3 Dexter/GoPiGo3/Software/Python/Examples/Servo.py
$ python3 Dexter/GoPiGo3/Software/Python/Examples/Motor_Turn.py

Now I have a GoPiGo3 to begin exploring the libcamera change.

UPDATE 28Nov2021: Figured out the VNC setup for remote desktop access from Mac OS (Big Sur)

INSTALL GOPIGO3 OVER PiOS BULLSEYE

Setup GoPiGo3 on PiOS Bullseye

*** Download latest Raspberry Pi Imager

https://www.raspberrypi.com/software/

*** Flash SD card with Raspberry Pi Imager / Etcher

  • Select the Raspberry Pi OS
  • Select the 16GB SD Card
  • Flash

=== Mount the card to allow headless configuration

  • Pull card out, reinsert for next steps

=== Enable SSH

  • create a file called “ssh” (or ssh.txt) in the Boot partition
    (touch /boot/ssh)

=== Setup WiFi Headless

  • create the file /boot/wpa_supplicant.conf
    (quote chars must be straight up/down, traditional, not slanted/matched Unicode chars
    use ssid=“XXXX”
country=US
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1

network={
    ssid="XXXX"           
    psk="XXXX"
    key_mgmt=WPA-PSK
}

=== disable ipv6

  • Browse the disk (boot)

  • Rt Click on System Volume Information->Open Terminal Here

  • cd …

  • cp /boot/cmdline.txt /boot/cmdline.txt.bak

  • nano cmdline.txt
    add to end of line/file:

ipv6.disable=1
  • save, exit editor
  • eject disk

==== Raspbian First Boot
-insert micro SD card
-power on

  • on mac: arp -a to check IP

=== First Login

  • ssh pi@10.0.0.XX

  • The default login for Raspbian For Robots is username pi with the password raspberry

First Boot:(With amplified speaker or headphones connected)

  • 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)

=== If see SSH HOST KEY verification failed
on mac: ssh-keygen -R 10.0.0.XX

Login: username: pi password: raspberry

=== To stop incessant message:

$ sudo mv /usr/share/piwiz/srprompt.wav /usr/share/piwiz/srprompt.wav.bak
$ sudo rm /usr/share/piwiz/srprompt.wav
($ sudo reboot)  or turn off speaker until reboot

(May have to rm the file one more time after reboot??)

=== Configure for locale, timezone, and expand filesystem to fill card
$ sudo raspi-config

  • (You can exit menus by using Tab key, move to Finish, enter key)

  • change password to XXXXX

  • System Options: change hostname to XXXX

  • change Localisation:Locale → remove en_GB, add en_US.UTF8, return

    • default local: en_US.UTF-8
  • change Localisation:Timezone-> US->Eastern

  • change Localisation:WiFi Country->US

  • Interfacing:PiCamera enable

  • Interfacing:SPI enable

  • Interfacing: VNC enable

  • reboot now yes

=== LOG IN Again

pi:XXXXXX

=== Change TightVNC password ====

At a terminal:

  • sudo vncpasswd -service
    • new password
    • new password

=== update OS

  • sudo apt update
  • sudo apt full-upgrade

==== Check TEMPERATURE

To view the Pi’s temperature

  • vcgencmd measure_temp

It’s generally a good idea to keep the core temperature below 70 degrees

==== Install espeak-ng Text-To-Speech**

  $ sudo apt install espeak-ng
  $ espeak-ng "Hello"

=== info about processor, memory, disk partitions ===

cat /proc/cpuinfo
cat /proc/meminfo
cat /proc/partitions
cat /proc/version

Linux version 5.10.63-v7+ (dom@buildbot) (arm-linux-gnueabihf-gcc-8 (Ubuntu/Linaro 8.4.0-3ubuntu1) 8.4.0, GNU ld (GNU Binutils for Ubuntu) 2.34) #1459 SMP Wed Oct 6 16:41:10 BST 2021

=== Memory Usage
free -h displays memory usage

               total        used        free      shared  buff/cache   available
Mem:           922Mi       144Mi       175Mi       2.0Mi       603Mi       717Mi
Swap:           99Mi       1.0Mi        98Mi

=== check memory usage and running programs

htop
q to exit

==== Record the IPv4 addresses:
wired:
wifi:
GoPiGo3 : 10.0.0.XXX

=====GETTING WIFI NETWORK DETAILS

To scan for WiFi networks, use the command

  • iwlist scan | less

=== check time zone
$ date to check if correct time

========= SSH from mac to Pi =====

ssh -l pi 10.0.0.xxx (wireless)
or
ssh pi@10.0.0.xxx
password: default was raspberry (changed to XXXX)

===== rebooting ====
sudo shutdown -r now (or sudo reboot)
(if doesn’t come back up try
sudo shutdown -t9 -r now
or (sync;sync;sudo reboot -d -f -i)

==== check disk file systems =====

df -h  
FFilesystem      Size  Used Avail Use% Mounted on
/dev/root        15G  3.2G   11G  23% /
devtmpfs        333M     0  333M   0% /dev
tmpfs           462M     0  462M   0% /dev/shm
tmpfs           185M  852K  184M   1% /run
tmpfs           5.0M  4.0K  5.0M   1% /run/lock
/dev/mmcblk0p1  253M   50M  203M  20% /boot
tmpfs            93M   24K   93M   1% /run/user/1000

==== disk space of a directory:

$ du -hD

===== test internet speed ====
$ sudo pip install speedtest-cli
$ speedtest

Speedtest Result
Download: 28.75 Mbit/s
Upload: 12.47 Mbit/s

===== describe hardware =====

sudo apt-get install lshw

sudo lshw

====== Testing Disk speed =====
sudo hdparm -t /dev/mmcblk0 (sudo apt-get install hdparm)

reports
Pi3: 62 MB in 3.06s = 20.27 MB/sec
pi B+: 54 MB in 3s = 17.7 MB/s

======= check OS version ======

cat /etc/os-release
 
PRETTY_NAME="Raspbian GNU/Linux 11 (bullseye)"
NAME="Raspbian GNU/Linux"
VERSION_ID="11"
VERSION="11 (bullseye)"
VERSION_CODENAME=bullseye
ID=raspbian
ID_LIKE=debian
HOME_URL="http://www.raspbian.org/"
SUPPORT_URL="http://www.raspbian.org/RaspbianForums"
BUG_REPORT_URL="http://www.raspbian.org/RaspbianBugs"

==== check Pi firmware version

vcgencmd version
uname -a

==== SHUTTING DOWN Pi ======

sudo poweroff  ( or shutdown -h now )

Safe to remove power when green light blinks a bunch (12 times) and then stops blinking

=== Test audio

aplay /usr/share/sounds/alsa/*

if no audio:
amixer to see what is current setting: (0=auto, 1=analog, 2=HDMI)

sudo amixer cset numid=3 1 (set to output sound to 3.5mm jack

try again:
aplay /usr/share/sounds/alsa/*

========== If audio output is too soft =======
if soft: alsamixer
s (select card)
downarrow to “0 bcm2835 ALSA”
8 (4=default loudness, 8=100%, 9=125%)
Escape (press Esc)
then make setting default:
sudo alsactl store 0

=== setup audio IP service shortcut

  • on Mac in to_from_pi folder: scp ip_feedback.tgz pi@10.0.0.XX:/home/pi/
  • tar -xvf ip_feedback.tgz
  • config/setup_ip_feedback.sh

=== setup audio IP service from scratch:

add file /home/pi/config/etc.systemd.system.ip_feedback.service

[Unit]
Description=IP Feedback on Boot
After=syslog.target network.target novc.service


[Service]
Type=simple
user=ubuntu
WorkingDirectory=/home/pi
ExecStart=/bin/bash /home/pi/ip_feedback.sh

[Install]
WantedBy=multi-user.target

add file /home/pi/config/home.pi.ip_feedback.sh:

#!/bin/bash

echo "starting"
COUNT=0
IPs=$(hostname --all-ip-addresses)
while [ -z "$IPs" ]
do
    echo "loop"
    sleep 1;
    IPs=$(hostname --all-ip-addresses)
    COUNT=$((COUNT+1))
    echo "count: "$COUNT > /home/pi/ipcount
done

echo "done looping "

echo "count: "$COUNT > /home/pi/ipcount

ifconfig wlan0 | grep 'inet ' | awk '{print $2}'  > /home/pi/ip.number
read -r IP_NUMBER < /home/pi/ip.number
echo $IP_NUMBER

# remove previous IP info
sudo rm /boot/*.assigned_ip &>/dev/null
sudo rm /home/pi/Desktop/*.assigned_ip &>/dev/null

# remove previous Failed IP
FAILED=/home/pi/failedIP
if test -f "$FAILED"; then
    sudo rm $FAILED &>/dev/null
fi
sudo rm /home/pi/Desktop/failedIP &>/dev/null

if [ ! -z "$IP_NUMBER" ]
then
        echo "saving IP info"
        sudo bash -c "echo $IP_NUMBER > /boot/$IP_NUMBER.assigned_ip"
        echo $IP_NUMBER > /home/pi/Desktop/$IP_NUMBER.assigned_ip
        echo "IP info saved"

        su -c "espeak-ng 'WiFi IP'" pi
        su -c "espeak-ng $IP_NUMBER" pi
        su -c "espeak-ng repeating "  pi
        su -c "espeak-ng $IP_NUMBER" pi
else
        espeak-ng "no IP number"
        echo "no IP number"
        echo "no IP" > /home/pi/failedIP
        echo "no IP" > /home/pi/Desktop/failedIP

fi
echo "done with IP feedback"

chmod 777 ip_feedback.sh

create config/setup_ip_feedback.sh:

#!/bin/bash
echo "Setting up ip_feedback"

cp /home/pi/config/home.pi.ip_feedback.sh /home/pi/ip_feedback.sh

echo "copying ip_feedback.service to /etc/systemd/system"
sudo cp /home/pi/config/etc.systemd.system.ip_feedback.service /etc/systemd/system/ip_feedback.service
sudo systemctl daemon-reload
sudo systemctl enable ip_feedback
sudo service ip_feedback start

chmod 777 config/setup_ip_feedback.sh

$ sudo config/setup_ip_feedback.sh

==== GOPIGO3 LIBRARIES

$ python --version
Python 3.9.2

$ pip --version
pip 20.3.4 from /usr/lib/python3/dist-packages/pip (python 3.9

$ dpkg -l | grep setuptools
$ dpkg -l | grep wheel

$ cd ~
$ sudo git clone http://www.github.com/DexterInd/GoPiGo3.git /home/pi/Dexter/GoPiGo3

$ sudo curl -kL dexterindustries.com/update_tools | bash -s -- --system-wide --use-python3-exe-too --install-deb-debs --install-python-package

$ sudo apt-get install --no-install-recommends python3-pip python3-numpy python3-curtsies


$ sudo git clone https://github.com/DexterInd/DI_Sensors.git /home/pi/Dexter/DI_Sensors

=== copy the 16 tick serial number list

$ cp ~/Dexter/GoPiGo3/Install/list_of_serial_numbers.pkl ~/Dexter/.list_of_serial_numbers.pkl

==== [Already installed] RPi.GPIO

dpkg -l | grep python3-rpi.gpio

sudo apt install python3-rpi.gpio  

==== PIGPIO ===

$ wget https://github.com/joan2937/pigpio/archive/master.zip
$ unzip master.zip
$ cd pigpio-master
$ make
$ sudo make install
$ cd ..
$ rm master.zip

=== pigpiod

wget https://raw.githubusercontent.com/joan2937/pigpio/master/util/pigpiod.service

(Replacing with the non-forking version - don’t know why)

$ sudo nano pigpiod.service
[Unit]
Description=Pigpio daemon
After=network.target syslog.target
StartLimitIntervalSec=60
StartLimitBurst=5
StartLimitAction=reboot

[Service]
Type=simple
ExecStartPre=/sbin/sysctl -w net.ipv4.tcp_keepalive_time=300
ExecStartPre=/sbin/sysctl -w net.ipv4.tcp_keepalive_intvl=60
ExecStartPre=/sbin/sysctl -w net.ipv4.tcp_keepalive_probes=5
# Don't fork pigpiod
ExecStart=/usr/local/bin/pigpiod -g
ExecStop=
Restart=always
RestartSec=10

[Install]
WantedBy=multi-user.target
$ sudo cp pigpiod.service /etc/systemd/system

$ sudo systemctl enable pigpiod.service
$ sudo systemctl start pigpiod.service
$ systemctl status pigpiod.service

● pigpiod.service - Pigpio daemon
     Loaded: loaded (/etc/systemd/system/pigpiod.service; enabled; vendor preset: enabled)
     Active: active (running) since Tue 2021-11-23 12:24:59 EST; 14s ago
    Process: 2864 ExecStartPre=/sbin/sysctl -w net.ipv4.tcp_keepalive_time=300 (code=exited, status=0/SUCCESS)
    Process: 2865 ExecStartPre=/sbin/sysctl -w net.ipv4.tcp_keepalive_intvl=60 (code=exited, status=0/SUCCESS)
    Process: 2866 ExecStartPre=/sbin/sysctl -w net.ipv4.tcp_keepalive_probes=5 (code=exited, status=0/SUCCESS)
   Main PID: 2867 (pigpiod)
      Tasks: 4 (limit: 1597)
        CPU: 1.397s
     CGroup: /system.slice/pigpiod.service
             └─2867 /usr/local/bin/pigpiod -g

Nov 23 12:24:59 gobullseye systemd[1]: Starting Pigpio daemon...
Nov 23 12:24:59 gobullseye sysctl[2864]: net.ipv4.tcp_keepalive_time = 300
Nov 23 12:24:59 gobullseye sysctl[2865]: net.ipv4.tcp_keepalive_intvl = 60
Nov 23 12:24:59 gobullseye sysctl[2866]: net.ipv4.tcp_keepalive_probes = 5
Nov 23 12:24:59 gobullseye systemd[1]: Started Pigpio daemon.

=== R4R_Tools (for I2C_mutex)

$ sudo git clone https://github.com/DexterInd/RFR_Tools.git /home/pi/Dexter/lib/Dexter/RFR_Tools
$ sudo apt-get install libffi-dev
$ cd /home/pi/Dexter/lib/Dexter//RFR_Tools/miscellaneous/
$ sudo python3 setup.py install

==== wiringPi ====

cd /home/pi/Dexter/lib
git clone https://github.com/DexterInd/wiringPi/
cd wiringPi
sudo chmod +x ./build
sudo ./build

==== [SKIP] antenna wifi service

sudo mkdir -p /etc/systemd/system/antenna_wifi.service.d/

sudo cp /home/pi/di_update/Raspbian_For_Robots/upd_script/antenna_wifi_override.conf /etc/systemd/system/antenna_wifi.service.d/
sudo nano /etc/systemd/system/antenna_wifi.service.d 
  change Restart=always to =no
sudo systemctl daemon-reload
sudo systemctl restart antenna_wifi.service

systemctl status antenna_wifi    shows it ran once, exited and not restarted

- to disable it:
sudo systemctl disable antenna_wifi

==== GPG3_POWER SERVICE ===

  cd ~
  sudo cp /home/pi/Dexter/GoPiGo3/Install/gpg3_power.service /etc/systemd/system
  sudo chmod 644 /etc/systemd/system/gpg3_power.service
  sudo systemctl daemon-reload
  sudo systemctl enable gpg3_power.service
  sudo systemctl start gpg3_power.service

==== [SKIP] AUTODETECT ROBOT ===

X mkdir /home/pi/Dexter/R4R
X cd /home/pi/Dexter/R4R
X wget https://raw.githubusercontent.com/DexterInd/Raspbian_For_Robots/master/buster_update/auto_detect_robot.service
X sudo cp /home/pi/Dexter/R4R/auto_detect_robot.service /etc/systemd/system/
X sudo systemctl daemon-reload
X sudo systemctl enable auto_detect_robot.service
X sudo systemctl start auto_detect_robot.service

==== SETUP GoPiGo3 and DI_Sensors Python3 eggs

$ cd /home/pi/Dexter/GoPiGo3/Software/Python
$ sudo python3 setup.py install
$ cd /home/pi/Dexter/DI_Sensors/Python
$ sudo python3 setup.py install

==== [SKIP - already present] Setup non-root access rules ====

==== FULL POWEROFF FOR CLEAN TEST
$ sudo shutdown -h now

Boot up in GoPiGo3

$ ssh pi@X.X.X.X

=== Test GoPiGo Functions

$ cd ~
$ python3 Dexter/GoPiGo3/Software/Python/Examples/Read_Info.py
$ more ~/Dexter/gpg3_config.json
$ python3 Dexter/GoPiGo3/Software/Python/Examples/LED.py
$ python3 Dexter/GoPiGo3/Software/Python/Examples/easy_Distance_Sensor.py
$ python3 Dexter/DI_Sensors/Python/Examples/IMUSensor.py
$ python3 Dexter/GoPiGo3/Software/Python/Examples/Servo.py
$ python3 Dexter/GoPiGo3/Software/Python/Examples/Motor_Turn.py

=== VNC Setup for Mac OS (BigSur) Remote Desktop Connection

$ dpkg -l | grep vnc
$ vncserver 
$ sudo nano /root/.vnc/config.d/vncserver-x11

add to file these two lines, save and exit (ctrl-x):

Authentication=VncAuth
Encryption=PreferOff

Continuing:

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
2 Likes

Wow. Great work. Looking forward to updates.
/K

2 Likes

I remembered last night that the whole ip_feedback thing was already in the Dexter repository, so I didn’t need to port those files back from ROSbot Dave! That might have been an hour I could have saved.

I had an old “GoPiGo3 over PiOS Buster” note, and a more recent “GoPiGo3 over Ubuntu 20.04” note that I merged to make the “GoPiGo3 over PiOS Bullseye”, and lastly add the official GoPiGo3 install script handling of the 16 tick serial list to get the gpg3_config.json file to be correct.

@jimrh was chasing the desktop apps using an obsoleted QT module. Hopefully MR and Jim will have the official install working again … soon:

curl -kL dexterindustries.com/update_gopigo3 | bash
curl -kL dexterindustries.com/update_sensors | bash
2 Likes

I absolutely agree - this is outstanding work.

More important is that it is well documented so that others can try to duplicate your success.

Right now I’m a bit behind the 8-ball, so working with this will have to wait, but this should be a huge help once I get back to it.

@cleoqc,
Did you see this?  It’s incredible!

3 Likes