Installation Instructions: Part 1: Hardware
Clone this wiki locally
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:
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.
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:
Its best to put the custom circuit on a prototype shield, like this one:
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).
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.
Finally, solder all components together, using these circuit and wiring diagrams for the entire foosball table: And voila, you are ready.
These are the materials of the above instructions (with example distributors Sparkfun, Amazon and Conrad Germany):
- Arduino Uno (http://www.sparkfun.com/products/9950)
- 2x Busch light barrier 5961 or similar (http://www.amazon.de/Busch-5961-Zeitschalter-mit-IR-Lichtschranke/dp/B0002OH8SQ/ref=pd_sxp_f_pt)
- Proto shield (http://de.farnell.com/arduino/a000024/board-arduino-proto-shield/dp/1848695)
- Stackable headers kit for the Proto shield (http://www.sparkfun.com/products/10007)
- NOR gate 4001 (http://www.conrad.de/ce/de/product/172529/C-MOS-IC-4001-DIP/SHOP_AREA_17311)
- Socket for the NOR gate (http://www.conrad.de/ce/de/product/189510/IC-FASSUNG-14POLIG)
- 2x 10k resistor (http://www.conrad.de/ce/de/product/403377/WIDERSTAND-KOHLE-025-W-5-10K-BF-0207/0241120)
- 2x 100k resistor (http://www.conrad.de/ce/de/product/403490/WIDERSTAND-KOHLE-025-W-51-100K-BF-0207/0241120)
- 3x 470 resistor (http://www.conrad.de/ce/de/product/403210/WIDERSTAND-KOHLE-025-W-5-470R-BF-0207/0241120)
- Red LED (http://www.conrad.de/ce/de/product/184282/LED-3MM-ROT-TLUR4401/0212029)
- Yellow LED (http://www.conrad.de/ce/de/product/184336/LED-3MM-GELB-TLHY4405/0212029&ref=list)
- Green LED (http://www.conrad.de/ce/de/product/184398/LED-3MM-GRUeN-TLHG4400/0212029)
- 5V switching regulator (http://www.conrad.de/ce/de/product/167805/SCHALTREGLER-W78-5V0-5-V)
- 12V DC power supply, regulated, min. 300mA (http://www.conrad.de/ce/de/product/510819/Dehner-SYS1196-Netzt-fests-12V6W/2110120)
- Jack, male, 3 pins (http://www.conrad.de/ce/de/product/733824/STIFTLEISTE-1X3-POLIG-GEWINKELT-RM-254)
- Jack, male, 5 pins (http://www.conrad.de/ce/de/product/733861/STIFTLEISTE-1X5-POLIG-GEWINKELT-RM-254)
- Jacks, female, 3 and 5 pins (break this one in two: http://www.conrad.de/ce/de/product/733755/PRAeZISIONS-BUCHSENLEISTE-1X20-POL-RM254)
- Diverse mounting and wiring materials
When using WiFi:
- Sparkfun WiFly shield WRL-09954 (http://www.sparkfun.com/products/9954)
- Another stackable headers kit for the WiFly shield (http://www.sparkfun.com/products/10007)
When using Ethernet:
- Arduino Ethernet shield (http://www.sparkfun.com/products/9026)
Please note that the list may be incomplete and/or contain errors.