RaspuinoDart

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 other Raspberry Pi dart projects.

Features

Requirements

Hardware

  • electronic dart board (+ tools to open it)
  • Arduino MEGA (+ USB connection cable)
  • Raspberry Pi (+ power supply)
  • electric wires
  • soldering iron (+ tools)

Software

Setup / Installation

A few words on the setup and installation of both hardware and software.

Hardware

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.

2nd-foil pin 0 1 2 3 4 5 6 7 8 9 10 11 12 13
1st-foil pin Arduino pinS 22 24 26 28 30 32 34 36 38 40 42 44 GND
0 23 i13 i06 i10 i15 DBE i12 BE T02 T17 T03 T19 i16
1 25 i04 T06 T10 T15 i05 i02 i17 i03 i19 i27
2 27 i13 i18 o10 o15 D15 T05 D02 o02 o17 o03 i08 T07
3 29 D04 D18 D01 D20 D05 D12 D07 D09 D14 D11 D08 D16
4 31 o04 o18 o01 o20 D13 o12 D19 o09 o14 o11 o08 o16
5 33 o13 T18 T01 T20 D06 o05 D03 T09 T14 T11 T08 o07
6 35 T04 o06 i01 i20 D10 T12 D17 i09 i14 i11 o19 T16

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.

20 01 18 04 13 06 10 15 02 17 03 19 07 16 08 11 14 09 12 05 bulls eye
double 51 50 49 48 68 84 100 36 38 102 86 70 54 59 58 57 56 55 53 52 4
outer 67 66 65 64 80 97 34 35 39 40 41 106 91 75 74 73 72 71 69 85
triple 83 82 81 96 32 17 18 19 7 8 9 10 43 107 90 89 88 87 101 37
inner 99 98 33 16 0 1 2 3 23 24 25 26 27 11 42 105 104 103 5 21 6

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).

Software

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.

Manual

Server

Simply start the program by issuing …

python RaspuinoDart.py

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 …

http://192.168.1.1:8000

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

Web interface

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 …

RaspuinoDartMini

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 …

python RaspuinoDartMini.py

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 &

Changelog