Using without a DGT board.

610 views
Skip to first unread message

Brian Loxton

unread,
Feb 17, 2016, 10:43:27 AM2/17/16
to PicoChess
I am in the process of making my own chessboard with arduino and raspberry pi, and came across this project.

I know this is primarily a DGT board based project and relies on FEN information for a lot of the functionality, but looking through the code I see there are classes for keyboard input and terminal display output.
Additionally the majority of functions can be accessed by firing events

How difficult would it be to modify these classes for input and output over serial port from an arduino.  A lot of the work has already been done here  and I think it should be easier to modify this than starting from scratch.

I am in the process of learning Python, and there is a lot in the code I don't yet understand, but I have taken a fork of this on github, and I will see how I get on.

Any feedback appreciated.

Jürgen Precour

unread,
Feb 18, 2016, 4:18:48 AM2/18/16
to PicoChess
Hi Brian,

y might take a look at the dgt<something>.py files esp dgtinterface.py
This defines an interface y can develop against (y need to implement this functions, and y prob. almost done).

The dgtvr.py (dgtvirtual.py) file, i use when i dont have a dgt board&clock in place. It simulates the dgt hardware, so thats a good starting point too.

Jürgen

Shivkumar Shivaji

unread,
Feb 18, 2016, 10:22:20 AM2/18/16
to pico...@googlegroups.com

There are also a few other endpoints using the virtual keyboard input such as the web server (if you run with -w). The web server supports live broadcast of moves.

I also support an arduino display in a different project using similar code - https://github.com/sshivaji/kivy-chess

For the arduino, I supported all its buttons. I rarely use an arduino these days, but it might be useful for reference if you plan to go this route.

Best regards, Shiv

--
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.
For more options, visit https://groups.google.com/d/optout.

Brian Loxton

unread,
Feb 19, 2016, 8:00:36 AM2/19/16
to PicoChess
Thanks for the feedback.

I am looking at dgt* files, but I am new to Python so it will take me a while to understand them.
I also looked at the Kivy chess on github, and although it is interesting, I don't see anything relating to arduino, Am I missing something?

Thanks

Shivkumar Shivaji

unread,
Mar 2, 2016, 5:36:22 PM3/2/16
to pico...@googlegroups.com
Sorry, forgot about this message.

Just search for the word "arduino" in https://github.com/sshivaji/kivy-chess/blob/master/main.py.

Arduino 20-char displays are supported.

Shiv

Fred Just

unread,
Mar 26, 2016, 1:58:12 PM3/26/16
to PicoChess
Le mercredi 17 février 2016 16:43:27 UTC+1, BR L a écrit :
I am in the process of making my own chessboard with arduino and raspberry pi, and came across this project.



Hello

You can look my ChessboARDuino ,
It's a Chessboard with an Arduino card and 64 reed switch
It's work very fine now, and you can drag pieces !
I will make an another vidéo to explain how it's work
My last vidéo using a chessboarduino

all the project on my site (in french)

DJ Dekker

unread,
Mar 26, 2016, 3:43:15 PM3/26/16
to PicoChess
Quel truc de ouf! Chapeau bas!! :D

Op zaterdag 26 maart 2016 18:58:12 UTC+1 schreef Fred Just:

Fred Just

unread,
Mar 26, 2016, 3:59:11 PM3/26/16
to PicoChess
Le samedi 26 mars 2016 20:43:15 UTC+1, DJ Dekker a écrit :
Quel truc de ouf! Chapeau bas!! :D
Merci, cool d'avoir une réponse en français ! 
(on a donc le droit de parler français sur ce groupe ?)



Michael Lang

unread,
Mar 27, 2016, 4:50:30 AM3/27/16
to PicoChess
Hi Fred,
....but English is much better, as my French is not that good.....
Where can I find the software and the circuit design on your site?
Regards, Michael

Michael Lang

unread,
Mar 27, 2016, 4:51:50 AM3/27/16
to pico...@googlegroups.com
Is it similar to Bergers "Solus Chess"?

Fred Just

unread,
Mar 27, 2016, 5:46:28 AM3/27/16
to PicoChess
Hi Fred,
....but English is much better, as my French is not that good.....
Where can I find the software and the circuit design on your site?
Regards, Michael 

I will add soon on my github

Actual software work with an arduino mega LCD screen and SD card
you can see here

But I wand to change for an arduino nano only

> Is it similar to Bergers "Solus Chess"?

not really, it's the same circuit desing with 64 switch and 64 diode but 
 I use vertical reed swith and software is completely différent 

arduino only send all change to usb port and PC decrypt the position




Fred Just

unread,
Mar 27, 2016, 6:10:12 AM3/27/16
to PicoChess
you can find another photo on my google+ profile

I don't understand how to transform an album to public without share it again 

Michael Lang

unread,
Mar 27, 2016, 6:12:18 AM3/27/16
to pico...@googlegroups.com
Thanks, Fred, very interesting - I prefer to use horizontal reed switches and assemble them directly into the chess board - that reduces the height....
I'm looking forward to get the info from your github soon; will you also add the wiring? Did you code or helped coding Python Chess? Regards, Michael

Fred Just

unread,
Mar 27, 2016, 6:23:05 AM3/27/16
to pico...@googlegroups.com
Thanks, Fred, very interesting - I prefer to use horizontal reed switches and assemble them directly into the chess board - that reduces the height....
I'm looking forward to get the info from your github soon; will you also add the wiring? Did you code or helped coding Python Chess? Regards, Michael


horizontal reed is more simple but not a good solution

because activation zone is not center on the center of the square  

see  horizontal reed switches

and verticaly

it will work only with one player against engine (for picochess ;-)

but you can't follow a real game between two player 

Michael Lang

unread,
Mar 27, 2016, 7:28:25 AM3/27/16
to PicoChess
Hi Fred, a couple of years ago I made some "basic research" on the orientation of the reeds too(see page 8): http://www.miclangschach.de/files/Assembly_Instruction__Mysticum_V3.1e.pdf
I think generally you're right, vertical reed orientation is better than horizontal, but in case there is 5mm or less between board surface and reed and you assemble the reed outside the center of the sqare, the behaviour is acceptable. Regards, Michael

BrianLoxton

unread,
Mar 27, 2016, 7:54:32 AM3/27/16
to pico...@googlegroups.com
This is interesting, I never considered vertical reed switches.
I built mine directly into the chess board using horizontal reed switches . (and a signal diode for each of the 64 switches.
They are scanned using a CD4017 counter and CD 4021 shift register. 5 pushbuttons are also scanned for setting up picochess.
I have a LED on each corner of every square for 81 leds controlled by 2 * Max 7219 led drivers. This is controlled by a Arduino Nano.
 I have modified Picochess by adding another file similar to keyboardInput.py but for arduino.
The arduino senses switches opening and closing and sends the information to picochess, and picochess sends led on/off signals to the arduino.

I have it set currently so that when a piece is lifted, picochess sends led-on for all legal move squares. This doesn't work well with led's in each corner, because if 2 alternate squares are lit, the middle one also appears to be selected, so in hindsight, I think 1 led per square is better.

cost -  I can't afford a DGT board, but this is a cheap substitute. besides, I like to tinker.
100 Reed switches £5
100 diodes £1
2 max7219 £2
Arduino nano £2
5 pushbutton switches £2

I have had the board for ages collecting dust, but I think you can get one for about £30

--
You received this message because you are subscribed to a topic in the Google Groups "PicoChess" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/picochess/5FEifqtSB8g/unsubscribe.
To unsubscribe from this group and all its topics, send an email to picochess+...@googlegroups.com.

Michael Lang

unread,
Mar 27, 2016, 8:50:43 AM3/27/16
to pico...@googlegroups.com
Hi Brian, that's really interesting, because it was exactly my plan to modify Picochess for a reed switch board... :-) ! Would you send me the circuit diagram and your software to test it (miclang(at)arcor.de)?Thanks and regards, Michael
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.

BrianLoxton

unread,
Mar 28, 2016, 6:28:52 AM3/28/16
to pico...@googlegroups.com
Hi Michael.
I don't have a circuit diagram,but it's very easy to wire up directly from the ic pinouts
for the switch matrix, 
columns go to the CD4017 q1 to Q8 (note Q0 not used - makes it easier to program, ) Q9.can be used for further 8 control switches if desired.
Clock and reset go to Arduino pins. D5 and D6, (clockenable to ground.)
the rows go to CD4021 P1 to P8, 10k resistor pulls down each of these pins to ground.
Ser out, Load and Clock to Arduino pins D2, D3 and D4.
then its just a signal diode and reed relay in series between each column/row junction (diode + to column)
You will also need a 10-100nf cap across each of the chips voltage rails.

The LED's are even easier , just use this 
discard the display led's and wire the board to your own. led's .But be aware the output pins on the module are not logically organized, I used a meter and max7219 pinout to map the module output pin row/columns
I used 2 of these modules because I have 81 diode (4 per square) but I now recommend 1 per square so just 1 module.

I am not ready to share the software yet, it is still very experimental, but by the time you have the hardware done I should have something usable.
Let me know if you need more information

Michael Lang

unread,
Mar 28, 2016, 12:19:07 PM3/28/16
to pico...@googlegroups.com
Hi Brian,
thanks for the info - you are right, it's not so difficult....
Only to verify for the switch matrix: Columns are "a" to "h" of the chess board and are connected to the CD4017, so column "a" goes to Q1, column "b" goes to Q2 and so on? Rows are "1" to "8" of the chess board and are connected to the CD4021, row "1" goes to P1, row "2" goes to P2 and so on?  For the LED matrix: I already use such LED matrix modules for scrolling messages...
Ok, the chess board with reed and switch matrix is already prepared from another project; I will send you a pinout to crosscheck, if it is useable - I will order the ICs, do the wiring and will come back to you!
Thanks and regards, Michael ;-)

BrianLoxton

unread,
Mar 28, 2016, 2:57:35 PM3/28/16
to pico...@googlegroups.com
Actually I have it the other way around. the 4017 controls rows so row 1 to Q1
4021 is for columns, column A goes to p8 ( because you shift out from the MSB first )but anyway will  work, you just modify the code accordingly.
some psuedocode.
reset 4017
for (int row = 0; row < 8; row++)
{
    clock 4017 //next row
  latch 4021  //latch state of switches into shift register
    for (int column = 0; column < 8; column++)
    {
      data = digitalRead(Shift register out);
      if (data != matrix[Row][column]) //8*8 matrix to hold current state of switches
      {
       (row*8+column) is number of key changed from 0 to 63 
  I send this and let picochess handle conversion to uci.
      }
      shiftout 4021
}
}

Michael Lang

unread,
Mar 29, 2016, 8:08:18 AM3/29/16
to PicoChess
Ok, Brian, thanks so far! After wiring the hardware I'll inform you! Regards, Michael

BR L

unread,
Apr 2, 2016, 8:14:43 AM4/2/16
to PicoChess
I have uploaded my modified picochess code to Github, along with the Arduino files.

This is very much a work in progress, and  I do not have the programming skills of the authors of picochess so it is probably not well done, but it does work!

The uploaded code runs on a PC, but it does work on a raspberry pi, (change the serial port from com6 to dev/ttyUSB0 in picochess.py.)
I have also added a representation of the board using pygame, which will run on a LCD touch screen like this


Additionally, this runs a coach mode, when you lift a piece, all legal moves for that piece are lit up on the chessboard.
I am planning other coach functions such as attacked squares, pins etc, .that are implemented in the chess library.

Thanks to the authors of picochess, I have learn a lot of python from this project,

Fred Just

unread,
Apr 2, 2016, 8:33:37 AM4/2/16
to pico...@googlegroups.com
Thanks, My ChessboARDuino works on a Nano card now
code source here

Arduino only send chessboard change to USB port

I explain here




--
You received this message because you are subscribed to a topic in the Google Groups "PicoChess" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/picochess/5FEifqtSB8g/unsubscribe.
To unsubscribe from this group and all its topics, send an email to picochess+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
FredJust
@gmail.com

Shivkumar Shivaji

unread,
Apr 2, 2016, 10:45:41 AM4/2/16
to pico...@googlegroups.com

Awesome!

Maybe you could add in more documentation to the repo so that others can try out the code?

Regarfs, Shiv

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.

Fred Just

unread,
Apr 2, 2016, 11:28:45 AM4/2/16
to pico...@googlegroups.com
Hello

To track the movement of chess pieces, I use a program in VB 2010

but it's awful, I wrote it quickly to test the algorithm
I must completely rewritten to make it understandable by another person


2016-04-02 16:45 GMT+02:00 Shivkumar Shivaji <sshi...@gmail.com>:

Awesome!

Maybe you could add in more documentation to the repo so that others can try out the code?

Regarfs, Shiv

Thanks, My ChessboARDuino works on a Nano card now
code source here

Arduino only send chessboard change to USB port

I explain here
 
--
FredJust
@gmail.com

Michael Lang

unread,
Apr 3, 2016, 4:42:58 AM4/3/16
to pico...@googlegroups.com
Thanks Brian, just in time - I got the ICs and I can start the wiring now. ;-)   Regards, Michael

BR L

unread,
Apr 3, 2016, 5:49:05 AM4/3/16
to PicoChess
I like the idea of the vertical reed switches, they do seem more responsive than laying them horizontally, 
I have a lot of spares so I might build another board using mdf board and vertical switches to compare.
I am also considering replacing the leds with 3 color led, ( to produce 8 different colors) This would facilitate more coaching functions.

The movement of pieces is ls already tracked by picochess using the python  chess library.

Fred Just

unread,
Apr 3, 2016, 7:16:33 AM4/3/16
to PicoChess
The movement of pieces is ls already tracked by picochess using the python  chess library.



I use a different method to follow the chess pieces even in case of problems
like this fall :

because I want to record a game between to player 

Fred Just

unread,
Apr 6, 2016, 8:23:05 AM4/6/16
to PicoChess
Le dimanche 3 avril 2016 11:49:05 UTC+2, BR L a écrit :
I like the idea of the vertical reed switches, they do seem more responsive than laying them horizontally, 
I have a lot of spares so I might build another board using mdf board and vertical switches to compare.

Hello

I made a 3D model of my ChessboARDuino to explain my method 
I use mdf and uninsulated wire
like this it's preaty simple

Photos :

3D model (sketchup format) on github

tell me If you use an another solution 

thanks


BR L

unread,
Apr 6, 2016, 5:57:35 PM4/6/16
to PicoChess
Hi,
I have prepared a MDF board, like in your models, except I added extra holes and tracks for the led's.

Did you have any problems bending the reed switch wires. They need to be bent very close to the glass to fit in the 18mm board. 
The first end is ok using thin pliers, but the other end is difficult because because it has to be done with the switch in the board.

Fred Just

unread,
Apr 6, 2016, 6:09:12 PM4/6/16
to pico...@googlegroups.com
yes you're right, it's very difficult to bend without breaking contact
the first that use was good 
but i try with very cheap contact and I broke a lot of them

I looking for a good method
- don't bend and solder directly on the wire (but only 3mm)
- use solder iron to bend with heat
- ...

--
You received this message because you are subscribed to a topic in the Google Groups "PicoChess" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/picochess/5FEifqtSB8g/unsubscribe.
To unsubscribe from this group and all its topics, send an email to picochess+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
FredJust
@gmail.com
Reply all
Reply to author
Forward
0 new messages