ChessLink and Chessnut Air e-board support

1,066 views
Skip to first unread message

gkalab

unread,
Sep 16, 2022, 11:41:11 AM9/16/22
to PicoChess
Hi all,

I'm new to PicoChess and was intrigued when I found the PicoChessWeb description in the schachcomputer.info forum.

Since I don't own a classic DGT board I've added preliminary support for the Millennium ChessLink protocol and the Chessnut Air e-boards. Most of the code is based on python-mchess.

The commit and some other fixes are currently in this feature branch: https://github.com/gkalab/picochess/tree/feature/e-boards

Installation:
There is a new dependency needed for BLE, you can do a
> pip3 install bluepy
to install it.
Then make the changes in picochess.py, add the rest of the files and specify the board type in picochess.ini.

Current restrictions:
  • Millennium ChessLink: USB support is disabled.
  • Chessnut Air: sliding of pieces is not supported.
I'm only interested in the web interface, so that's what I've tested with. I used the last published PicoChessWeb image in the schachcomputer.info forum (2021-09-05) on a Raspberry Pi 3B and I also tested it with a DietPi image on a Raspberry Pi Zero 2W.

I will not provide an image myself but I can help out with the code changes if anyone wants to create one.

I don't know if I can add more time to expand this in the future, here's my own wish list:
  • Support sliding pieces on Chessnut Air
  • Menu entry to switch e-board (reboot may be required)
Cheers,
Gerhard

Alan Cooper

unread,
Sep 16, 2022, 12:03:48 PM9/16/22
to pico...@googlegroups.com
Hi Gerhard,

That’s very interesting, I’ll have a look when I return from my cruise …

Al

Sent from Scally's iPhone 13 Pro


On 16 Sep 2022, at 17:41, gkalab <gerhar...@gmail.com> wrote:


--
You received this message because you are subscribed to the Google Groups "PicoChess" group.
To unsubscribe from this group and stop receiving emails from it, send an email to picochess+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/picochess/e5970493-a1e2-4f92-bf7a-44c08a17bda1n%40googlegroups.com.

Randy Reade

unread,
Sep 16, 2022, 12:11:44 PM9/16/22
to pico...@googlegroups.com
Yes. Thanks for contributing, Gerhard. I'll have a look on my return as well.

Randy

gkalab

unread,
Oct 8, 2022, 8:59:02 PM10/8/22
to PicoChess
I've created two short videos showing PicoChess Web together with


I've changed the web interface a little bit to get more information on the 7" screen. For the opening book statistics an HTTP-Server is running locally on the Raspberry Pi. More information on the server and data format is following soon.

Gerhard

DannyN

unread,
Oct 9, 2022, 3:50:31 AM10/9/22
to PicoChess
Hi Gerhard.

Very impressive what you have done. I noticed that the leds are not working on the boards. Is that something you still plan to add or is it not possible? 

Danny

Op zondag 9 oktober 2022 om 02:59:02 UTC+2 schreef gkalab:

Scally

unread,
Oct 9, 2022, 4:07:08 AM10/9/22
to PicoChess

Hi Gerhard,

Nice work,

I’m particularly interested in how you got the opening books running locally on the RPi.

Al

gkalab

unread,
Oct 9, 2022, 4:45:03 AM10/9/22
to PicoChess
Hi Danny, 

If you refer to the videos, the LEDs are working. It's not really visible in the videos due to the camera angle and lighting conditions.

Gerhard 

DannyN

unread,
Oct 9, 2022, 5:05:04 AM10/9/22
to PicoChess
Hi Gerhard,

That's great. The Chessnut Air looks like an attractive option all of a sudden. Or maybe I should get over my aversion to all those cables with the Millennium boards. Hmm.

I assume with a bit of tinkering one could get these boards to work with a simple DGTPi as well?

Danny

Op zondag 9 oktober 2022 om 10:45:03 UTC+2 schreef gkalab:

gkalab

unread,
Oct 9, 2022, 6:28:14 AM10/9/22
to PicoChess
I don't have a DGTPI, so I cannot test it, but I assume that it should work there as well.

Gerhard 

gkalab

unread,
Oct 9, 2022, 1:34:44 PM10/9/22
to PicoChess
Here are the details on the local opening book statistics:

The source code and a Raspberry Pi binary for the server are available here: https://github.com/gkalab/obooksrv
I've created a systemd service file which starts the HTTP server:

/etc/systemd/system/obooksrv.service:

[Unit]
Description=Opening book server
After=multi-user.target

[Service]
Type=simple
ExecStart=/opt/picochess/obooksrv/obooksrv
ExecStop=/usr/bin/pkill -f obooksrv
WorkingDirectory=/opt/picochess/obooksrv

[Install]
WantedBy=graphical.target

----------------------
The server listens on http://0.0.0.0:7777 and it expects a file with the name "opening.data". This is currently hard-coded.

The format of the opening.data file is different from the one that was used previously.That's why changes are needed in the files app.js and clock.html. You can find all the changes in the following commit: https://github.com/ghislainbourgeois/picochess/commit/03c37e5772a981e911c9fe67933d171d1d69cb18, available in this branch: https://github.com/gkalab/picochess/tree/feature/bookserver
The only change needed in clock.html is the changed layout of the table header row (3 columns instead of 7).

The data format is basically a modified polyglot format. To create your own opening data statistics from a PGN file you will need the modified code from this repo: https://github.com/gkalab/obookmkr. The command line is the same as for creating polyglot books.

Dirk

unread,
Oct 9, 2022, 1:54:12 PM10/9/22
to PicoChess
Thank you Gerhard so much for your cool work and addons. I will definetly use your local opening book data server for my PicoChessWeb system. At least we now have opening information again. The statistical game data information which was provided by the orignal web server as well  is not so important for me.

Cool that we now have two additional chess boards with LEDs for PicoChess.
Really great stuff.
Dirk 

gkalab

unread,
Oct 9, 2022, 2:22:38 PM10/9/22
to PicoChess
Thank you Dirk for the nice words.
Since I could not test with the original data I don't really know how the original server worked. For example I've disabled adding the selected move to the game in app.js because it did not work for me - maybe the move format was different or maybe it's just my lack of Javascript know-how?

Regarding the game data information of the original server: I'm not sure how that worked either.  Were all games displayed that matched the current position?
Because that could be interesting. I had the idea of simply using a large scid database as a data source and selecting the first 5 to 10 games sorted by combined ELO, that contain the current position.  The selection of the games from the database with a FEN could be implemented in a script using scidt (https://scidvspc.sourceforge.net/doc/progref.html).

Gerhard

Randy Reade

unread,
Oct 9, 2022, 2:29:52 PM10/9/22
to pico...@googlegroups.com
Yes, thanks Gerhard. The webserver code has been updated but unfortunately not yet adapted to PicoChess. Check out Dr. Shivaji's ('Shiv') site for info.


Randy

gkalab

unread,
Oct 9, 2022, 4:34:43 PM10/9/22
to PicoChess
Thanks Randy. After changing some scripts I managed to run the chessui in a Docker container on my Linux server. So I can confirm that the game selection is based on the current position. Also, as suspected, the move format is different from the one I used (Polyglot format). So this is probably the reason that adding the selected move from the opening explorer did not work.

However, I'm not sure if this is a solution to run it locally on a Raspberry Pi. Performance needs checking and the Docker image is quite large.

Gerhard

Randy Reade

unread,
Oct 9, 2022, 5:02:08 PM10/9/22
to pico...@googlegroups.com
Maybe Shiv could share his server code that the current PicoChess sends the queries to. Unfortunately, modifying/adapting the chessui code is beyond my noob skills.

Randy

Dirk

unread,
Oct 11, 2022, 6:43:08 AM10/11/22
to PicoChess
Hi Gerhard,

Because you are using the PocochessWeb solution as well you might have the same problem like me with the stockfish analysis engine of the web server. 
If I start the analysis engine and play a few moves the analysis process cant be stopped again. Even if i press the stop button stockfish continues to calculate (but sometimes even for a wrong position and not for the current one.

Do you also habe these problems with your setup?
Thanks
Dirk

gkalab

unread,
Oct 11, 2022, 2:47:54 PM10/11/22
to PicoChess
Hi Dirk,

I have not used the engine during play yet, only for short times for single positions. But I've tested it now and you are right: I have the same issue: as soon as there are moves after starting analysis I get the same behavior.

Gerhard

Dirk

unread,
Oct 11, 2022, 2:59:50 PM10/11/22
to PicoChess
Ah I see - thanks for checking, Gerhard.
Unfortunately i was not able to find the cause  in the javascript source....(but I have nonexprriences with this language).
Dirk

gkalab

unread,
Oct 11, 2022, 3:40:08 PM10/11/22
to PicoChess
Unfortunately I've got no experience with Javascript either. I'm just reading up a bit on the portable native client technology (PNaCl) used for Stockfish and it's already deprecated since 2018 :-)

gkalab

unread,
Oct 11, 2022, 4:36:25 PM10/11/22
to PicoChess
Hi Dirk,

I believe I have found the issue with the analysis. The analysis is started in updateStatus() and when using the physical board to enter moves, there is a redundant call to updateStatus:

diff --git a/web/picoweb/static/js/app.js b/web/picoweb/static/js/app.js
index 0f9995c..2126d29 100644
--- a/web/picoweb/static/js/app.js
+++ b/web/picoweb/static/js/app.js
@@ -1794,7 +1794,6 @@ $(function() {
             switch (data.event) {
                 case 'Fen':
                     updateDGTPosition(data);
-                    updateStatus();
                     if(data.play === 'reload') {
                         removeHighlights();
                     }


Gerhard

Dirk

unread,
Oct 11, 2022, 5:44:44 PM10/11/22
to PicoChess
Wow- that sounds fantastic. Will test this when i am back from my trip.

Thank you so much for helping!
Dirk

Dirk

unread,
Oct 20, 2022, 2:48:28 PM10/20/22
to PicoChess

Hi Gerhard,

unfortunately the code change (deleting the updateStatus command) is not working (for me): Stockfish continues calculating although I pressed Stop after some moves. Looks like a nontrivial problem - I was not able to find any clue after trying some code changes for some time (but I have no experiences with multiple taks via javascript etc.)
What a pity. Can you please double check on your system?

I will now install the book server and hopefully the game server as well and will check it...
Thanks again 
DIrk

gkalab

unread,
Oct 20, 2022, 3:08:04 PM10/20/22
to PicoChess
Hi Dirk,

I just checked: it works for me. Did you clear the browser cache after doing the change?

Gerhard

Dirk

unread,
Oct 20, 2022, 3:15:38 PM10/20/22
to PicoChess
Yes I did clear all browser caches but still no luck.

I will now shutdown and restart the system and check again.

Now it works!!!!! 

Strange I thought clearing the caches should be sufficient but anyway: it now works and I can finally use this functionality without overheating (that was the case when I couldn’t stop the anaylsis task).

Wonderful - thanks you so much Gerhard!

Dirk

Dirk

unread,
Oct 20, 2022, 3:30:58 PM10/20/22
to PicoChess
Hi Gerhard,

I now test the (local) opening book server but I got an error when trying to start the service:

./obooksrv: /lib/arm-linux-gnueabihf/libstdc++.so.6: version `GLIBCXX_3.4.26' not found (required by ./obooksrv)

Hmmmm... any idea how I could install the mission file(s)?

Thanks

Dirk






gkalab

unread,
Oct 20, 2022, 3:43:29 PM10/20/22
to PicoChess
Hi Dirk,

you can try a
> apt-get install libstdc++6
If that does not help then you have probably a different standard c++ library and you need to compile the binary for your system. The source is here: https://github.com/gkalab/obooksrv
Then build it:
> apt-get install cmake build-essential
> mkdir build
> cd build
> cmake build ..
> make

Gerhard

Dirk

unread,
Oct 20, 2022, 4:10:58 PM10/20/22
to PicoChess
Yes - compiling my own obooksrv worked!
Thanks, Gerhard

Dirk

unread,
Oct 27, 2022, 6:29:20 AM10/27/22
to PicoChess
Hi Gerhard,

running the new book/games database server works great for PicoChessWeb ( in chromium browser)

But opening the web server on an external device/browser (iphone/iPad or notebook) has a problem:Webserver Picochess 3 2022-10-27 12-18-35.jpg

The "loading" status is shown forever and nothing happens although on the PicochessWeb server display the opening and game data information .

Same is true for the game data information: Loading status forever...

Do you have an idea why this information is only shown correctly locally in chromium but not for other browser devices?

Thanks
Dirk

gkalab

unread,
Oct 27, 2022, 6:42:30 AM10/27/22
to PicoChess
Hi Dirk,

yes, the services are running on the Raspberry Pi and the app.js Javascript has the following definitions:
const OBOCK_SERVER_PREFIX = "http://localhost:7777";
const GAMES_SERVER_PREFIX = "http://localhost:7778";

Since the Javascript is running in the browser localhost is always the device the browser is running on. What you can do is define a static IP-address for the Raspberry Pi and use this IP instead of localhost in the server addresses above.

Gerhard

Dirk

unread,
Oct 27, 2022, 7:02:50 AM10/27/22
to PicoChess
Thanks for the quick answer, Gerhard.

Ah _ that makes sense.

After assigning a static IP address to all my running Raspberry (MolliPi, PicoChessWeb and standalone for the Revelation2) in my FritzBox and changing in the app.js code teh server assignments I can now see the book and game information on all my devices.

FRITZ!Box 7490 2022-10-27 12-50-35.jpg


Here running in my desktop browser:
Webserver Picochess 3 IP: 89.245.161.204 2022-10-27 12-55-11.jpg

Thank you so much for your help again, Gerhard!

Dirk

Shivkumar Shivaji

unread,
Oct 27, 2022, 10:23:42 AM10/27/22
to pico...@googlegroups.com
Does the address http://raspberrypi.local work in your local network?


Dirk

unread,
Oct 27, 2022, 10:33:50 AM10/27/22
to PicoChess
nope - but http://picochess.local.    ;-)

Shivkumar Shivaji

unread,
Oct 27, 2022, 10:51:18 AM10/27/22
to pico...@googlegroups.com
Thats great. You can use that hostname for the web UI then?

Dirk

unread,
Oct 27, 2022, 10:53:59 AM10/27/22
to PicoChess
Yes Shiv, I can use that although I am not sure where this setting assignment (picochess.local) comes from....
Dirk

Shivkumar Shivaji

unread,
Oct 27, 2022, 1:20:35 PM10/27/22
to pico...@googlegroups.com
This is an mDNS setting. The picochess.local is set in the image as an mDNS hostname. It should be fairly reliable on your local network.

Shiv

gkalab

unread,
Oct 27, 2022, 2:46:11 PM10/27/22
to PicoChess
Thank you Shiv, I was not aware of mDNS - I just learned something very useful :-)

@Dirk: Aside from updating the server addresses I've adjusted the opening book table to show the short SAN notation, chess figurines and I made some adjustments to the css, html and the app.js. That's all in the feature/bookserver branch.

Gerhard

Dirk

unread,
Oct 27, 2022, 2:53:14 PM10/27/22
to PicoChess
Hi Gerhard, I have already added your latest changes just today - looks really nice and much better on a 7 inch display - thanks!

Unfortunately something strange goes on with the clocks in my PicoChessWeb version: Suddenly the richt clock is running for the white player instead of the left clock.

I am not sure if this is because of my changes to the web server or because of something else...

@Gerhard: Which clock on which side is runnging in your WebServer when you play white and it is your turn?

Thanks
DIrk

gkalab

unread,
Oct 27, 2022, 3:24:56 PM10/27/22
to PicoChess
Hi Dirk,

When I'm playing White and it is my turn, the left clock is running, if it's the computers turn, the right clock is running.

Gerhard

Dirk

unread,
Oct 27, 2022, 3:28:08 PM10/27/22
to PicoChess
That's how it should be and how it used to be on my PicochessWeb system as well. I must have  broken it somehow...
Thanks for checking, Gerhard.
Reply all
Reply to author
Forward
Message has been deleted
0 new messages