3 Simple Ways to
Share What You Make

With Instructables you can share what you make with the world — and tap into an ever-growing community of creative experts.

PhotosPhotos

Share one or more photos of a project, recipe, or whatever you've made, quickly and easily.

Step by StepStep-By-Step

Share your step-by-step photos with text instructions of what you made so others can do it too!

VideoVideo

Share your how-to video. You'll need your embed code from a video site such as YouTube.

Autonomous Foosball Table

Step 3Software

Software
The last step is to install all of the software used on the machine. This consists of a few individual pieces of code:

> The code run on the image processing PC
> The code run on the PIC-18F microcontroller
> The code run on each of the PIC-12F microcontrollers

There are two prerequisites to install on the image processing PC. The image processing is done through the Java Media Framework (JMF), which is available through Sun here. Also available through Sun, the Java Communications API is used to communicate to the motor control board, across the serial port on the computer. The beauty of using Java is that it *should* run on any operating system, though we used Ubuntu, a linux distribution. Contrary to popular opinion, the processing speed in Java isn't too bad, especially in basic looping (which vision analysis uses quite a bit).

As seen in the screenshot, both the ball and the opponent players are tracked on each frame update. In addition, the outline of the table is located visually, which is why blue painters tape was used to create a visual outline. Goals are registered when the computer cannot locate the ball for 10 consecutive frames, typically indicating the ball fell into the goal, off the playing surface. When this happens, the software initiates a sound-byte to either cheer itself or boo the opponent, depending on the direction of the goal. A better system, though we did not have the time to implement it, would be to use a simple infrared emitter/sensor pair to detect the ball falling into the goal.

All of the software used in this project is available in a single zip file, here. To compile the Java code, use the javac command. The PIC-18F and PIC-12F code is distributed with Microchip's MPLAB software.
« Previous StepDownload PDFView All StepsNext Step »
1 comment
Mar 22, 2009. 10:29 PMdnicky2288 says:
Let me be the first to say that your project is so cool! I am quite a good programmer myself, but this is kind of advanced which is very interesting to me. I have a web cam, had c++ Programming before, and have a Foosball table. I am complete! I can make my own one now! Thanks for the help. I'm sure "Eric Wilhelm" will love to hear about this. I will spread the word for you. Again this is really awesome!

Pro

Get More Out of Instructables

Already have an Account?

close

All Steps Viewing
View all steps of an Instructable on the same page when you're a Pro Member.

Upgrade to Pro today!
3
Followers
1
Author:eski