Installation Instructions: Part 1: Hardware

Thomas Jacob edited this page Jan 21, 2015 · 13 revisions

Part one: Hardware

In this part, we explain the first part, how to turn an analog foosball table into a digital one, sending HTTP POSTs on every goal.

Install light barriers

First, you need a foosball table. Sorry, that’s not included in the download. The key challenge is to modify the goals to track whenever a ball passes the goal line. In the SinnerSchrader prototype, we have a guiding rail that carries the ball to the ejector. In that rail, we installed model railway light barriers and some guides. Please note that we did not install the barriers in the passage of the actual goal, but in the rail while running back to the ejactor. This leads to a more precise recognition of the goal event, but causes a small delay of course.

The light barriers we used are model no 5961 from Busch (http://www.amazon.de/Busch-5961-Zeitschalter-mit-IR-Lichtschranke/dp/B0002OH8SQ/ref=pd_sxp_f_pt). They include a control circuit with a time-delay switch, compensating jumping balls in the guiding rail. We setup a 2-seconds delay.

This is how the modified guiding rails look like:

Rails

Usually, the Busch light barriers require model railway power (AC 16V). We removed the rectifier bridge and applied 12V DC directly, soldering cables to the direct-current side of the rectifier. This way, the light barrier worked very well without AC power. As 12V DC are also OK for the Arduino board of the next section, we only need one 300mA power supply for both.

Rectifier

Create a custom Arduino shield for the goals

Arduino is an open-source microcontroller platform, including board layouts, an IDE, and libraries to get started. We chose the “Arduino Uno” (http://arduino.cc/en/Main/ArduinoBoardUno), as well as the third-party WiFi Shield “Sparkfun WiFly”, model no WRL-09954. If you do not like WiFi, you can also use an Ethernet shield, the software is compatible to both. Please note that the WiFi module does not support Enterprise Authentication (EA) WiFi. On the other hand, the Ethernet module does not support DHCP, so if you choose cable LAN, you must assign an IP address for the table.

Among others, you can purchase the Arduino, the WiFly, and the Ethernet shield from Sparkfun (http://www.sparkfun.com/products/9950, http://www.sparkfun.com/products/9954, and http://www.sparkfun.com/products/9026). When choosing WiFi, remember to order the headers kit if they aren’t included (http://www.sparkfun.com/products/10007). When choosing Ethernet, take care to buy the original version of the Arduino Ethernet shield (when the jack faces left, it must be located at the top). There is a cheap Ethernet shield available which is not compatible with the Foosball software.

Technically spoken, the Arduino is a single-threaded, blocking-I/O architecture. This means that while sending a goal event to the server, we might miss one goal in the middle. So what we did to compensate is to add 2 bits of memory (yes, 2 bits!) to the Arduino, one bit for each goal, as a goal buffer. The Arduino program reads the bits and clears them when read. The easiest way to implement 2 bits is the 4-NOR-gate IC 4001. However, depending on the high/low logic of your light barrier, you may require a NAND or yet another gate. The Busch 5961 is high for 2 seconds on goal events, and the Arduino program also requires a high signal for goal events, and sends a high signal as well to clear the bits. So the NOR is fine here. We build the following buffering circuit:

NOR circuit

Its best to put the custom circuit on a prototype shield, like this one:

Prototype shield

You can get it from Farnell (http://de.farnell.com/arduino/a000024/board-arduino-proto-shield/dp/1848695). Again, you may need a headers kit (http://www.sparkfun.com/products/10007).

Here is a layout diagram and some photos of the custom board and all parts mounted on each other (WiFi and Ethernet versions).

Goal buffer: Diagram

Goal buffer: Photo

Goal buffer: Photo

All shields: WiFi

All shields: Ethernet

Note that you sometimes need a little tape to isolate contacts from jacks of shields below. Best is to put tape on both shields.

Program the Arduino

After installing the Arduino IDE (note: version 0022 from the archive is required!) and the device driver and pluggin the board to a USB port, you can open Arduino programs and upload them to the board. The Digital Foosball Table consists of a program and a modified WiFly shield library. Do not use the original Sparkfun library, as it contains errors and a missing feature. Copy the WiFly folder of the download into your IDE installation’s “libraries” folder, and open the Digital_Foosball_Table.pde file.

When using WiFi, change the INTERNET_xxx define to "#define INTERNET_WIFLY", enter your Wifi SSID and password, and uncomment the WiFly.h include. When using Ethernet, change the INTERNET_xxx define to "#define INTERNET_ETHERNET", enter an IP and MAC address (you can use the MAC address in the code if you only have one Arduino in your network), and uncomment the Ethernet includes. The Ethernet shield does not support DHCP, so you require to reserve one IP.

Next, enter the goals server’s host name and IP. You need both, as we do not lookup names in DNS servers.

When everything’s configured, press upload and you are ready to go.

Mount and connect components

Now you need some way to tie everything together. We used a wooden board, mounted all components with cable straps, and screwed the whole board to the frame of the foosball table. This is an early prototype of the board, using batteries as power supply (which also works for 2 days of continuous operation), and no 2-bit buffer yet.

Wooden board

Finally, solder all components together, using these circuit and wiring diagrams for the entire foosball table: And voila, you are ready.

Diagram

Diagram

Material list

These are the materials of the above instructions (with example distributors Sparkfun, Amazon and Conrad Germany):

Common components:

When using WiFi:

When using Ethernet:

Please note that the list may be incomplete and/or contain errors.