Arduino Powered Foosball Table

wpid-foosball005-2013-04-15-23-11.jpg  + wpid-foosball008-2013-04-15-23-11.jpg  = Screen Shot 2013-04-15 at 11.57.54 PM

Why Attach an Arduino to a Foosball Table?

– Because the foosball table is clear on the opposite side of the building.

– Because we can!

What are those parts?

– The gold disk is a piezo electric transducer, commonly known as an electric guitar pickup. It converts vibrations into electricity.

– The red circuit board is an Arduino with Ethernet. It uses the standard Arduino library to handle dhcp requests.

– The circuit board is soldered after the knock sensor tutorial on

– They grey cables are Power Over Ethernet Injectors (POE). They are not required if your foosball table is in reach of a power outlet.

Where can I buy this stuff?

Arduino –

POE Cable –

Piezo Transducer –

1 Mega Ohm Resistor – Radio Shack

Circuit board –

Headers –

Wire – Your local garbage can

How do I code it?

See the code on . You will need an account on to store your sensor readings. Replace the “Feed ID” with your feed Id, and the “Data-stream” with your data stream name.

You will need to generate a new Private API Key and replace the API key in the code with your own API key. documents how to get code from an arduino to their servers here: and here:

The webpage uses jquery and the cosm javascript library. You can find examples of how to use it in the “Sandbox” directory in github

The Cosm javascript library is documented here: Cosm developers are very active on

Once you have the webpage how you want it. You will need to create an ubuntu virtual machine and install apache to host the website. It does not need to be on the same network as your sensor.

I highly recommend setting up your ubuntu web server using vagrant.

How did you make the webpage so pretty?

The majority of the webpage was coded by a friend who does web development professionally.

The github and “i” icons are actually fonts, not images.

The green button is made entirely with css3 and gradients.

The graph is made with cosm’s graph builder

Only the flat piezo elements work, speakers pulled from computer cases absolutely do not work.

What If I want to make my own awesome foosball table, but I have questions?

Leave a comment below

Ask your question on stack overflow and tag “cosm”

Go to the Arduino Forums

Any problems you discovered on the way?

I was going to use a raspberry Pi, but they don’t have analog sensors. Lady Ada has a great article of how to work around this:

Arduino Ethernet has 5 analog pins, but pins 4 and 5 are used by the ethernet shield. Pins 0 and 1 are also shared and shouldn’t be used.

What if I want to see pictures and a video of the table?

Here you are!







available unavailable



Ubuntu 12.04 Networking on fresh install

Whenever I setup a new ubuntu install, networking never seems to work out of the box. Here are the steps to get it working

Press Alt + F2 and type in ‘Terminal’

nano /etc/network/interfaces

Edit the line that says

iface eth0 inet manual

replace the word manual with dhcp. It should look like this

iface eth0 inet dhcp

Save the file and exit nano

Enter the following commands one at a time

sudo ifdown eth0

sudo ifup eth0

sudo service networking stop

sudo service networking start

You can then test your connection is working by entering

ping -c3

If you got a reply then internet is working. Go through all the steps again and double check they were entered correctly. If all else fails, restart the computer.

So people new to linux might wonder what all those commands were.

Basically you edited a file that sets the ethernet port to get an ip address from a dhcp server instead of assigning itself one. Then you turned off the ethernet port and turned it back on. Finally you restarted the program that manages the connection to the internet.

Configure Growl Notifications on PfSense


PfSense firewall has a little known feature that allows it to send alerts to a Mac running Growl. The advantage of this is instant alerts on your personal desktop to issues that need to be resolved.


To setup Growl Notifications go to :

System > Advanced > Notifications


You will need to enter the ip address of the computer with growl running. In my tests using the Alias of my personal mac resulted in failure of the growl message to arrive. You must type in the actual ip address. I’d recommend creating a static entry in the firewall to prevent having to change this setting if the dhcp server ever happens to hand out a different address.

Create a unique password in the password field. You will also need to enter the same password on your mac under growl preferences, to prevent unauthorized users from snooping in on growl notifications.

On the Mac side you will need to open system preferences and enable growl to listen on the network.

Check “Listen for incoming notifications”

Check “Allow remote application registration”

Enter the same password you setup in pfsense growl configuration. I highly recommend that this not be a password used anywhere else on your network. Since you only have to enter it once, make it as secure as you can.


For Growl to work you must have ports 23052 and 9887 open. Lion’s built in firewall does not let you specify individual ports. It must be turned off.


To test that the configuration worked, open the command line of pfsense or simply go to Diagnostics > Command


Type in the command in the php test field (Notice the screen shot mistakenly shows the “shell” field)

file_notice(“test”,”Test notification”);


If everything is set up correctly, you should get a growl alert on your mac.


If you didn’t get this message, make sure that you have the correct ip address of your Mac entered in the configuration of pfsense’s growl page. Also make sure that the dhcp is not reassigning you a new address. Verify that the firewall is not enabled on your mac,

These instructions were created using pfsense 2.0 and growl 2.0.

Simulate Network Users

We will be covering how to test internal network bandwidth.

Researching this topic, we discovered that there are numerous programs written to test the bandwidth of a network. Trying to use any of them is like trying to give yourself a haircut, it sounds great in theory, but people make fun of you for trying.

For this we will be using a Debian based operating system. Specifically Ubuntu 10.04 LTS. You could use a RedHat based system such as Fedora, or even Mac Os X (in theory), but those will not be covered in this tutorial.

If you are using one of those alternate systems, consult online forms for support. While substituting apt-get commands with yum or mac ports

Step 1: Update apt-get repository


        sudo apt-get update



Step 2: Install iperf from the app repository


        sudo apt-get install iperf



It should only take a few minutes depending on your internet speed.

At this point, iperf should now be installed, assuming you did not receive any errors.

From here you can run iperf from the command line by typing in




Add on any arguments that you want.

We don’t really want to take the time to learn what all the arguments are since we can use a nice pretty gui. There are times when it is great to be elite and do everything from the keyboard. If that is the case, then you are done, otherwise we will install the fantastic gui tool to make a lot of these options much simpler.

For this part we will need to check out a version of the latest code from google code. To do that we will need to first have svn (subversion) installed. What subversion is; for those new to coding, is a way to keep track of versions of code. Frequently it is called ‘versioning’.

If you are curious research




Step 3: Install svn


        sudo apt-get install subversion



Step 4: Install Java runtime and Java development

This will get both the runtime (jdk) and development runtime (ire). If you don’t know what that means, don’t worry about it. Just run the following command.


        sudo add-apt-repository ppa:sun-java-community-team/sun-java6        

        sudo apt-get update

        sudo apt-get install sun-java6-jdk sun-java6-jre



This is the longest part of the entire process. Java is a big download.

Select OK on any prompt’s that appear


Step 5: Checkout iperf gui

Change into a suitable directory first. I chose to put it in my Downloads folder


        cd ~/Downloads

        svn co



You could also navigate to the website with a browser and download it manually, but doing a svn checkout is much quicker and easier.

Step 6: Change permissions

Change into the newly created trunk directory


        cd trunk


Opening the README.txt file will tell us one last step that we need to take before we can compile and install the java gui.

Open the README.txt file by either opening it from the File Browser


If you don’t want to use the gui, use the cat command to show the text right from the terminal. Otherwise skip to the next step.


        cat README.txt



Step 7: Set permisions

Change into the directory where is located. Mine is in Downloads/trunk/release/iperf-generic


        cd ~/Downloads

        cd trunk

        cd release

        cd jperf-generic


(These commands are separated on purpose for those new to linux)

Doing a list of all items in directory should reveal a

bin, jperf.bat, and lib

files and folders





Change the permission as indicated in the README.txt


        sudo chmod u+x



Step 8: Install ANT

We must now install ant

Change into the utilities directory. I did it by typing in these commands.


        cd ~/Downloads

        cd trunk

        cd utilies


Now install ant


        sudo apt-get install ant


Run ant


        sudo ant release



If you get an error; build.xml does not exist, the reason is that you are not in the correct directory when you are running the ant command or you did not use subversion to download the file.

In either case, don’t worry about the error too much, as it appears that it can be skipped on certain machines with no ill effects.



Step 9: Run the configuration

Now we will run a script (thats what the .js is for) to prepare the system for installation. The ant procedure in the previous step created a new folder called jperf-2.0.1 inside the release folder

Change into the …trunk/release/iperf-2.0.2 directory and change the execute permission of the file

You will know that you changed the permission if the file is highlighted in green after the change.




        cd ~/Downloads

        cd trunk

        cd release

        cd jperf-2.0.2


        sudo chmod +x




Execute the program




Step 10: Compile and run the jperf.jar file

Whew, it may seem like this is a lot of work, but the results are well worth it. Now we are going to compile a java program then execute it.

Assuming you are still in the jperf-2.0.2 folder run this command


        javac jperf-2.0.2


Reset Cisco 1200 AP

1. Assign computer static ip in same subnet as 10.0.0.x with /8 subnet mask (


2. Connect Crossover Cable to Ethernet Port on AP


3. Connect Power to AP – Allow 30 seconds to boot up You will have either 1 or 3 green lights


4 You are now going to continuously hold the ‘Mode’ button down for 30 seconds while performing these other tasks:

        - 10 seconds with power

        - 10 seconds without power

        - 10 seconds with power

        - As you connect and disconnect the power with one hand, Make sure to always keep the ‘Mode’ button pressed down with your other hand

5. Wait until the lights change or about 10 to 15 seconds, then let go of ‘Mod

6. Navigate to


Username = Cisco

Password = Cisco


If these steps didn’t work

  1. Power cycle the device, then give it up to 1 minute to start up and try webpage again
  2. Verify you are using a cross-over cable and that the cable is good
  3. Make sure all other network interfaces are turned off on your laptop / desktop, especially wireless. Ensure your computer is not connected to the internet.
  4. Restart your browser if you have changed the state of any network interface cards on your computer. Some browsers tie all traffic to active interface on startup.
  5. Perform reset sequence again waiting 20 seconds between each step.

Standard vs. Extended Access Lists (ACL)

There are 2 kinds of ACL’s

Standard & Extended

Standard lists are implemented by the destination

Extended lists are implemented by the source

To see your current access lists type:

Router(config)# show access list




First you must create an access list by giving it a name. I am calling this access list 101. Remember you can have 1 access list per port, per protocol, per direction.

ip access-group 101 in
ip access-group 102 out
ip access 101 permit protocol source ip wildcardmask destination ip wildcardmask *port

*= optional ; protocol options (ip, tcp,udp, icmp)

(Here are some more examples)

ip access 101 deny tcp
// wildcards are opposite subnet masks
        (this example would stop any computer that starts with 192.168.0.x from sending an ip packet to any device with 192.168.2.x)

ip access 101 deny icmp
        (this example would stop any computer that starts with 10.1.x.x from sending an ip packet to any device with 172.16.5.x)
ip access 101 deny udp
        (this example would stop any computer that starts with 10.1.x.x from sending an ip packet to any device with 172.16.5.x)

ip access 101 deny ip
        (this example would stop any computer that starts with 10.1.x.x from sending an ip packet to any device with 172.16.5.x)


Terabytes of network storage

There are a dozen different ways to share the terabytes of data you have acquired over the years. Some of the more popular include NAS’es (NASi? NASen? NASouses?), Drobos or just shoving dozen drives into your main desktop. I have long been attracted to drobo for their simplicity and elegance, but find that they are just too much money for a poor student like myself. There are other alternatives like Windows Home Server, UnRaid, OpenSolaris, Terastation, Nexenta, FreeNas, Openfiler , Ubuntu but I frequently start pulling out my hair every time I sit down to try and build one because there are too many options and each have their own pitfalls. One particular homebuilt nas that I particularly love is the black dwarf. I wrote a blurb about it here. The interesting part is that he is using plain old windows 7 as the host operating system. I would like to go a little more elaborate than that. I am leaning towards FreeNas or OpenFiler, but just can’t decide how to take the plunge.

        I came across a blog post at that takes you step by step through the process of building a FreeNas, most importantly using the ZFS file system. In case you didn’t know, ZFS is an open source alternative to FAT32, NTFS, and similar formats you might be used to.

When I get back to rexburg my plan is to start building a free nas using parts that I already have laying around. The goal is to spend less than $75 in additional parts, to create a SFTP, AFP, Samba network shares. Most importantly the box must be able to be backed up to an online service like CrashPlan, must transparently take several drives and make them appear as a single Drive, and it must be upgradeable with new drives in the future.

Please post your comments on what has and hasn’t worked for you.




Windows Home Server