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 arduino.cc http://www.arduino.cc/en/Tutorial/KnockSensor

– 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 – http://arduino.cc/en/Main/ArduinoBoardEthernet

POE Cable – https://www.sparkfun.com/products/10759

Piezo Transducer – http://amzn.to/XDxBiT

1 Mega Ohm Resistor – Radio Shack

Circuit board – http://amzn.to/XDxHqM

Headers – https://www.sparkfun.com/products/116

Wire – Your local garbage can

How do I code it?

See the code on github.com/spudstud/Foosball . You will need an account on cosm.com 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.

Cosm.com documents how to get code from an arduino to their servers here: https://cosm.com/support/examples and here: http://arduino.cc/en/Tutorial/PachubeClient

The webpage uses jquery and the cosm javascript library. You can find examples of how to use it in the “Sandbox” directory in github https://github.com/spudstud/Foosball/tree/master/sandbox

The Cosm javascript library is documented here: http://cosm.github.io/cosm-js/ Cosm developers are very active on stackoverflow.com

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.  http://docs.vagrantup.com/v2/getting-started/index.html

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. http://bit.ly/1190Sjj

The green button is made entirely with css3 and gradients.

The graph is made with cosm’s graph builder http://bit.ly/1181kRM

Only the flat piezo elements work, speakers pulled from computer cases absolutely do not work. http://bit.ly/XOkrSu

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: http://bit.ly/VHTEmS

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!

wpid-foosball009-2013-04-15-23-11.jpg

wpid-foosball002-2013-04-15-23-11.jpg

wpid-foosball003-2013-04-15-23-11.jpg

wpid-foosball004-2013-04-15-23-11.jpg

wpid-foosball006-2013-04-15-23-11.jpg

wpid-foosball007-2013-04-15-23-11.jpg

available unavailable

Youtube

http://youtu.be/hi32JtDzm6I

 

Advertisements

configure: error: TORQUE needs pthreads in order to build

Scenario:

While installing Torque, you run ./configure and get the following error

configure: error: TORQUE needs pthreads in order to build

Solution:

Searching google seems to indicate that you need the windows library pthreads, or that there is a problem with the ./configure file, however both of these are mistaken.

The real solution is to install a g++ compiler

wpid-Red-Hat-2012-01-10-14-24.jpg

yum install gcc-g++

wpid-Ubuntu-2012-01-10-14-24.png

apt-get install g++

Cause:

The reason why is that Torque 4.x has moved from C to C++ and needs the C++ compiler.

checking whether to disable strict gcc warnings… no
checking for stat64… no
checking for stat64… no
checking for open64… no
checking for lseek64… no
checking for struct stat64.st_mode… no
checking for struct stat64.st_mode… no
checking if largefile compiles (looking at you, OSX)… checking for pthread_create in -lpthread… no
configure: error: TORQUE needs pthreads in order to build
make: *** No rule to make target `clean’.  Stop.

 

Update:

The default behavior of torque has been changed to avoid this problem in the future.

Chef Error

Scenario:

You are setting up a chef server, but when you run a knife command like “knife client list”, you get the following error:

ERROR: OpenSSL::PKey::RSAError: private key needed.

Here are the things to check:

Do your validation.pem and client.pem have valid data?

They should include PRIVATE keys (not public keys)

They should include the words —–END RSA PRIVATE KEY—–

Check that you followed this step of the chef instructions

sudo cp /etc/chef/validation.pem /etc/chef/webui.pem ~/.chef

Find current version of linux

Here is a trick to see what revision of Ubuntu you are running

echo `lsb_release -cs`

It will return something like “ precise” if you are running the precise penguin.

Is Aperture 3.1.2 corrupted and won’t start?

You are trying to start Aperture, but every time you click on it you get an error like this one. Library not loaded: /Library/Frameworks/PluginManager.framework/Versions/B/PluginManagerwpid-problemreportforaperture-2012-09-29-19-58.png

No need to reinstall aperture, simply replace the PluginManager file located in the /Library/Frameworks/PluginManager.framework/Versions/B folder. On my system, the B folder was missing so I had to recreate it. You can get a clean working copy of the file from mikeherdes here http://qvenon.com/files/PluginManager.zip. If the link is broken, find a friend with a working install and copy theirs.

wpid-versions-2012-09-29-19-58.png

Did that work for you? Leave a comment. The thanks for figuring this out goes to these guys. http://forums.macrumors.com/archive/index.php/t-1088985.html

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 8.8.8.8

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.

/lib/ld-linux.so.2: bad ELF interpreter: No such file or directory

Getting this error can be very frustrating because searching google does not give any clear answers to the problem. The problem  is really really simple to fix. Ready?

Cause: You are trying to run a 32 bit program on a 64 bit O.S.

 

Solution:

Download a 64 bit copy of the software, and your problem will be solved.

 

 

 

If you are determined to install a 32 bit program on a 64 bit os, there are some steps you can take below

 

 

 

#Only Do these steps if you cant find a 64 bit download of the program you want to install.

Alternate Solution:

You will need to download some 32bit libraries for your software to run

Fedora

expat.i386

fontconfig.i386

freetype.i386

glibc.i686

libX11.i386

libXau.i386

libXcursor.i386

libXdmcp.i386

libXext.i386

libXfixes.i386

libXft.i386

libXi.i386

libXrandr.i386

libXrender.i386

libgcc.i386

libjpeg.i386

libpng.i386

libstdc++.i386

libxcb.i386 zlib.i386


yum install expat.i386 fontconfig.i386 freetype.i386 glibc.i686 libX11.i386 libXau.i386 libXcursor.i386 libXdmcp.i386 libXext.i386 libXfixes.i386 libXft.i386 libXi.i386 libXrandr.i386 libXrender.i386 libgcc.i386 libjpeg.i386 libpng.i386 libstdc++.i386 libxcb.i386 zlib.i386

 

Ubuntu

lib32asound2

lib32gcc1

lib32ncurses5

lib32stdc++6

lib32z1

libc6-i386

ia32-libs


apt-get install lib32asound2 lib32gcc1 lib32ncurses5 lib32stdc++6 lib32z1 libc6-i386 ia32-libs

http://www.cadsoftusa.com/training/faq/#1