This page documents my RaspuinoDart project: an Arduino-Raspberry Pi-driven dart-board engine based on Python, Circuits, SQLite, jQuery, any recent web browser (preferentially Chromium or Chrome) and some inspiration from Daniel Fett’s pidart project.
- Setup / Installation
- electronic dart board (+ tools to open it)
- Arduino MEGA (+ USB connection cable)
- Raspberry Pi (+ power supply)
- electric wires
- soldering iron (+ tools)
Setup / Installation
A few words on the setup and installation of both hardware and software.
The readout of electronic dart boards is usually done using two thin foils with conductive strips that are brought in contact by the impact of the darts in the various areas of the board.
Usually the different sections are encoded via a matrix of e.g. 7 x 14 connectors and are read out by consecutively sending a signal into each of the e.g. 7 rows and checking for it, again consecutively, on the e.g. 14 columns. The following table shows an exemplary connection pattern, also highlighting the pin I have chosen on the Arduino MEGO board.
|1st-foil pin||Arduino pinS||22||24||26||28||30||32||34||36||38||40||42||44||–||GND|
The Arduino code provided in RaspuinoDartMEGA.ino essentially implements the above mentioned algorithm and sends a byte-size signal defined by (pin1 << 4) + pin2 to the serial port (USB). This results, in my dedicated case, in the pattern, shown in the next table, to match numbers to areas on the board. These numbers are send via the USB port and interpreted on the Raspberry Pi in the BoardConnect class in the RaspuinoDart.py file.
Given you might have different pin patterns on your electronic dart board and/or choose to connect the pins differently you will have to adjust the above table and the code (both for the Arduino and the Raspberry Pi part).
The software is based on Python and an asynchronous application framework called Circuits. After the installation of the Arduino IDE and these two packages (though Python is usually already installed) on your Raspberry Pi, you can get the RaspuinoDart code from https://github.com/SaMeHub/RaspuinoDart.
Use the Arduino IDE to upload the RaspuinoDartMEGA.ino code to your Arduino MEGA.
Once powered the Arduino will now scan through the matrix and send byte-size code through the USB connection, ready to be picked up by your Raspberry Pi.
Get the latest version of jQuery and adapt the index.html file to reflect your downloaded version.
Simply start the program by issuing …
Using the default settings (and assuming your Raspberry Pi or computer at IP address 192.168.1.1) you can now open your web browser (preferentially Chromium or Chrome) and go to …
From now on the shell you’re running in is essentially only used for debug/cross-check output.
You might wanna consider automatically starting up the server during/after boot-up of your Raspberry Pi. You can do so by issuing …
SOME COMMAND, YET TO BE DEFINED
The client web interface communicates via websockets with the server running on your Raspberry Pi and is kept in sync on all connected clients, all having the same level of access/rights (for now).
I hope the web interface itself is somewhat self-explanatory …
While I am not really working on the actual RaspuinoDart implementation these days, I set up a minimal version of the server that simply reads out the dartboard via the Arduino, opens a websocket server and sends the dart details to any connected clients.
The website dartboard.mehlhase.info is set up (client side) to allow to connect to the Raspberry Pi running RaspuinoDartMini.py and use that instead of the by hand clicking input.
You can start the server by issuing …
or just put the server into your your /etc/rc.local file for automatic start-up with the following line
python /path/to/RaspuinoDart/RaspuinoDartMini.py &
- started working on orthogonal/alternative approach at dartboard.mehlhase.info
- first match played on the real dartboard (not yet with SQLite backend)