At our research group at the university, we play a round of darts every day during the lunch break. We used to use an cheap electronic dart board and entered the results manually into our "Dartabase" ("Dartenbank" in german). Obviously, this manual process is not very satisfying for a geek, so I created a Raspberry Pi driven electronic dart board (called, of course, "pidart").
I started out from a standard soft electronic dart board and disassembled it. Then, I connected the sensors in the board and the buttons to an Arduino Mega microcontroller. The Arduino sends the dart hits and button presses on the board to the Raspberry Pi, where the pidart software runs. The Pi shows the current score and other data on a screen connected via HDMI and provides a web interface to control the software. I will provide a bit more technical background below.
The main feature of pidart is, of course, to keep track of the scores of each player and to enter the final results into our Dartabase. Apart from that, over the time, I added more features:
- Skipping players: Sometimes, one of us takes a short break during the game or cannot attend the game from the very beginning. In this case, we can tell pidart to skip the player until he returns. The player can catch up the missed rounds later and even still win the game when the other players have checked out already (if he checks out in less rounds than them).
- The same feature also allows for sequential games, where each player plays a full game straight and the players play after each other.
- Text-to-speech: pidart uses a synthesized voice to give spoken comments for each throw of a dart.
- Background music: pidart plays different background music depending on the game situation. You might know that music from somewhere...
- Live ranking: Our Dartabase creates a ranking of the players based on the ELO system. The pidart software predicts the game's outcome during the game and shows the new Dartabase ranking.
- Web interface: Not only is a web browser the main GUI for pidart, it also allows for multiple clients to watch the current game in real time. Players can follow the game from anywhere (for example, on a smart phone).
- Post-fact editing of results: If the board registered something wrong or someone accidentally touched the board, the last frame can be edited manually.
- Adding and removing players dynamically: Players can leave the game (if they are allowed so by the other players ;-) ) and even join the game at any time without any disadvantage.
In the video, you can see the components of pidart (the Arduino and the Dartboard, and the Pi sitting under a table), and some scenes from a typical gameplay. Not shown are the "advanced" features, like skipping players.
You can play with the pidart board at Pi and More 5
in Trier, Germany, where I will present the whole project.
I hope to release the source code until the above event (so until June 28).
Some Technical Background
The hardware interface to the dart board is not very complicated. First of all, electronic dart boards usually contain a two layer plastic sheet that has conductive lines printed on it. When a segment of the dart board is pressed (e.g., because a dart hit it), one line of the upper layer is connected momentarily to one line on the lower layer. The lines (for example, 4 for the upper layer and 7 for the lower layer) form a matrix, like a classic key matrix
The lines are connected to the GPIO pins of the Arduino Mega, which cycles through the lines as illustrated here
. When it detects that a segment was pressed, it encodes the segment into one byte and sends this byte to the Raspberry Pi, which receives it over a virtual serial connection.
The software is written in python using the circuits framework
. This framework allows for loosely-coupled components that can be added and removed during run time. For example, there are components responsible for the sounds and background music. The sound theme can be switched by removing one component and adding another.
The web interface is based on the excellent AngularJS
framework. It is updated dynamically and with very little overhead using websockets.