These are the steps that I take to create a disk image for the DGTPi chess computer. I'm using an Apple iMac running Mac OS X.

1. Get your hardware right

To build the image you'll need an SD card of at least 8 GB. If your computer does not have an SD card slot, you'll also need an external SD card reader. You'll need the free utility Raspberry Pi Baker (or, for macOS, alternatively ApplePi-Baker) to burn the SD card.

2. Download the Raspbian Stretch image

First download the latest Raspbian image from the Raspbian Downloads site. You will get a zipped image file in your ~/Downloads folder.

3. Burn the image to the SD card

Now insert your SD card into the SD reader. Be careful, because in this step you will wipe your SD card and lose any information that is stored on it.

Start Raspberry Pi Imager (or ApplePi-Baker). Select the SD card and unselect "Auto eject after successful restore". Press "Restore Backup" and select the zipped Raspbian image in your Downloads folder. The image will now be written to the SD card.

When your card is ready, open Terminal and enable ssh on Raspbian by typing this command:

touch /Volumes/boot/ssh

Still in Terminal, enable WiFi on your Raspbian image:

nano /Volumes/boot/wpa_supplicant.conf

You'll get a black Terminal window. Just type the following text and finish by pressing Ctrl-X (confirm saving the file by answering "Yes"):

ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev

update_config=1

network={

     ssid="your-network-name"

     psk="your-secret-password"

}

Of course, you'd write your WiFi network name instead of "your-network-name" and your WiFi password instead of "your-secret-password".

Now eject the SD card in Finder and take it out of the card reader.

4. Installing on the Raspberry Pi or the DGTPi chess computer

You can proceed to installing the software either using a Raspberry Pi or using your DGTPi chess computer.

4a. When you have a screen connected to your Raspberry Pi

Insert the SD card into the Raspberry Pi and switch power on. Your Raspberry will boot. Login with username pi and password raspberry. Now type:

sudo raspi-config

Change the password into picochess and exit the configuration utility. You're back at the command line.

Now update Raspbian as follows:

sudo apt-get update && sudo apt-get dist-upgrade

If you're prompted to accept the upgrade, press "Y" to accept. The upgrade process can take several minutes.

4b. When your Raspberry Pi is running headless

Insert the SD card into the DGTPi chess computer and switch power on. Your DGTPi will boot. Open a Terminal and connect to the DGTPi with this command:

ssh Dit e-mailadres wordt beveiligd tegen spambots. JavaScript dient ingeschakeld te zijn om het te bekijken.

The password is raspberry. Accept any requests to allow the ssh connection. Now type:

sudo raspi-config

Change the password into picochess and exit the configuration utility. You're back at the command line.

Now update Raspbian as follows:

sudo apt-get update && sudo apt-get dist-upgrade

If you're prompted to accept the upgrade, press "Y" to accept. The upgrade process can take several minutes.

5. Install the necessary Raspbian packages

Install the necessary packages:

sudo apt-get install avahi-discover git libffi-dev libportaudio2 libssl-dev python-dev python3-cffi python3-dev python3-numpy python3-pip sox vorbis-tools

6. Install picochess

Now we're going to get picochess itself using git:

cd /opt

sudo git clone https://github.com/jromang/picochess.git

cd picochess

sudo pip3 install --upgrade -r requirements.txt

Please be patient at this last step. Installing the packages will take a couple of minutes (especially the 'cryptography' and 'pynacl' packages).

7. Get the system files in place

To have picochess loading automatically at boot, you'll need to copy some files from /opt/picochess/etc:

cd etc

sudo cp *.service *.target /etc/systemd/system

sudo systemctl enable dgtpi picochess

8. Bluetooth only: set permissions and set correct speed

Give user 'pi' permission to access Bluetooth:

sudo adduser pi bluetooth

To prevent problems with reconnecting to Bluetooth boards set the speed to 115200:

sudo nano /usr/bin/btuart

In this file, change the speed in lines 12 and 15 to 115200.

OPTIONAL: While we're at it, do this to prevent SAP error messages:

sudo nano /etc/systemd/system/bluetooth.target.wants/bluetooth.service

Change this line:

ExecStart=/usr/lib/bluetooth/bluetoothd

into this:

ExecStart=/usr/lib/bluetooth/bluetoothd --noplugin=sap

To prevent Bluetooth connection issues, you could use the script in the forum thread Raspberry Pi 4b and Picochess.

9. DGTPi only: Set the "-pi" flag and change the computer name

When you're using a DGTPi computer (not a DGT 3000 clock!), you'll need to set the "-pi" flag appropriately in picochess.service:

sudo nano /etc/systemd/system/picochess.service

Find this line...

ExecStart=/usr/bin/python3 /opt/picochess/picochess.py

...and change it into this:

ExecStart=/usr/bin/python3 /opt/picochess/picochess.py -pi

You may wish to change the computer name of the DGTPi into DGTPi:

sudo raspi-config

Change the hostname into DGTPi and exit the configuration utility. You're back at the command line.

10. Finished!

Reboot with sudo reboot and enjoy!

If you built the SD card on a Raspberry Pi but are going to use it in a DGTPi chess computer, then insert the SD card into the DGTPi, pull the power cord of the DGTPi and reconnect it. Picochess should start automatically.

If you'd like to backup your SD card to an image file, shutdown your Raspberry Pi (or DGTPi), take out the SD card and insert it into the card reader. Using ApplePi-Baker build an image with "Create Backup".

 

 

Agenda

Geen evenementen

Live Ratings

2700chess.com for more details and full list

Schaakpuzzel