Wednesday 3 September 2014

A cheap broadcast system

One of the issues in running a multiboard DGT tournament broadcast is arranging all the cables. Despite having used DGT boards for over a decade, making sure the cabling is right is a task that I never seem to get right. The main issue is how to secure the various power and data leads in such a way that they do not get in the way of the players. However a poor choice of gaf tape, and the difficult environment that events are often held in, means that half the time I am re-sticking cables or moving boards around the make sure they keep working.
The availability of cheap but powerful computers has at least provided the opportunity to build a cable free system. Something like a Raspberry Pi costs between $30 and $40, and a Wi-Pi wirless network dingle costs another $10. And having purchased these last year I spent  last Sunday putting a system together.
As the Raspberry Pi only has two USB ports I added a USB hub to the mix. I also needed a Serial to USB cable, as I only have a serial DGT board. But once they were all plugged together the Raspberry Pi had no difficulty in connecting to the DGT board. The next trick was to right some Python code to transmit the data from the board to the central server. For the first iteration of the system a simple TCP/IP connection between client and server was all that was needed. The client script simply did a non-blocking read from the board and then sent the information to the server. It then listened for any response that came back and passed this back to the DGT board. At the server end, another script did essentially the same thing, listening for network data, and passing it on to the Live Chess system that was running on the server. Any responses from the server were then passed back to the client.
Apart from Python, there were a couple of other pieces of software I needed. As the plan is to use the DGT Livechess system, I needed that, as well as a way of setting up some virtual com ports. This is because Livechess expects data via serial ports. I used an open source program called com0com (under windows) to do this. Although it took a bit of setting up, it eventually did the job required.
After plugging everything together, and running both the client and server scripts it all worked like a charm. The DGT Livechess system recognised the board and handled all the data being sent across my wireless network. As a 'proof of concept' exercise it was a success.
Of course this simple system isn't what I (and other people are looking for). A more robust system is next weekends task for me. I am planning to extend the scripts to support multiple DGT boards per Raspberry Pi, thereby reducing the cost per board of the system even further. I am also rewriting both the client and server code so that each client will send out broadcast packets across the subnet, enabling the server to locate and connect to any client, without either having to know fixed IP addresses. The main reason for this is that such a system should work without human intervention, apart from plugging in some cables. And obviously the server will support multiple clients, as the aim is to handle a large number of boards.
When I do get this part of the project working I will hopefully be able to make the scripts and specifications available to all. As for testing it in a real time tournament, the aim is for 2014 Vikings Weekender, in early November.

3 comments:

Anonymous said...

If you're looking for gaffer tape, try Nashua 357. Best on the market. :)
AO

siow, weng nian said...

Dear Shaun,

Glad to see you are on the Raspberry Pi bandwagon. I have also been dabbling with it in my amateurish manner (trying to teach myself python) without your IT experience and expertise. Would be very interested in how you put it together. Do you have it written up in a manner for really amateurs beginners? If so, you should post it to RaspPi website. I am sure over in England lots of amateur chessplayer/IT hobbyist would be interested. I am very interested. If you are perfecting the system for SIO, then I would definitely make the trek out to Parramatta to have a look. Not sure I can make it down to Canberra for the Vikings weekender.

But thought I should also point out that RaspPi has a Model B+ out with 4 USB ports. Also they have just released a browser for Raspbian, not sure whether you are using that. Good Luck.

Unknown said...

Great work Shaun. If you can get it working on numerous boards it will be of great benefit at the Australian Tournaments you organise.