Project showcase
DIY Electronic Foosball Table

DIY Electronic Foosball Table © MIT

Electronic scoreboard for your foosball table that shows the live score on your phone.

  • 20 views
  • 0 comments
  • 0 respects

Components and supplies

Ard nano
Arduino Nano R3
×1
45w7721 40
LED, Blue
×2
4767222
LDR, 5 Mohm
×2
Adafruit industries ada1536 image
Buzzer
×1
Mfr 25frf52 10k sml
Resistor 10k ohm
×2
Mfr 25frf52 100r sml
Resistor 100 ohm
×1
475267 240424 01 front zoom kankcmvqdh
Raspberry Pi Zero Wireless
In my case I used an Orange Pi Zero but the Raspberry Pi Zero W should work as well
×1

Necessary tools and machines

3drag
3D Printer (generic)
09507 01
Soldering iron (generic)

About this project

I’ve been stuck at home for a month now with a lot of free time and I came up with this fun little project. It’s an electronic football table that uses some cheap electronic components to detect when someone scores a goal and shows it on a scoreboard!

Prototyping

The core part is that we have to detect when the ball rolls into the goal. Luckily on my table the ball always ends up at the same place as you can see. First I thought about implementing some kind of pressure sensor on that spot but after doing some research on similar projects I saw that most of them were using photo-resistors.

I happened to have a bunch of them lying around as well as some LEDs so I started testing! At first I wanted to use some IR LEDs that I had but it turned out the photo-resistor was not sensitive to Infrared light so then I did some testing with different coloured LEDs. I went with blue LEDs because they seemed to work best, causing a bigger difference in voltage than the others colors.

So what you will need for this project is 2 LDRs, 2 10k resistors, 2 100ohm resistors, 2 LEDs and an Arduino Nano or similar Arduino board. We need two of each because there are 2 goals and of course we’ll also need a football table.

Code

I used Tinkercad Circuits to simulate the circuit and write the code for the arduino. The code is pretty simple. It reads the analog pins continuously in a loop. The more light the higher the value will be. What we want to do is detect when the light decreases so we can check what the previous value was and compare it to the current one. If we see a significant decrease we can count that as a goal. Additionally I added a cool down period so it doesn’t count more than one goal and it gives you time to pick up the ball and start playing again.

Assembly

With the electronics and the code sorted out it was time to move everything into a more compact format. I soldered the circuit into one of these prototype boards, exposing 4 pins for each goal for easy cabling. This soldering process was probably the hardest part as I am not really good at soldering. The end result looked a bit messy but surprisingly it worked!

Then I cut an old USB cable in half to connect our new board to the LEDs and LDRs on each side of the table. USB cables are perfect for this because they have 4 cables inside. I then soldered female connectors to each end of the 4 cables and everything was ready to be connected!

To hold the LEDs and LDRs in place I 3D printed these supports that clip on to the goal. We then glued the LEDs and LDRs on to the supports.

Scoreboard web app

But wait aren’t we missing something? Where’s the scoreboard? Well initially I thought I would use some 16x2 LCDs that I had lying around but they require a lot of cabling so it would complicate things quite a lot. Instead I thought that we could put a phone mount on each side of the table and have player leave their phones there to display the scores.

To send the live score data I thought the best way was to do it through WiFi. So we’d need to serve a webpage that the smartphone will connect to and that will display the live score. To do this I used an Orange Pi Zero SBC that I’ve had for some time and that costs around 10€. This is similar to a Raspberry Pi. It runs linux and it has 256mb of ram which is enough for this use case.

The setup works by connecting the Arduino to the OrangePi via usb and running a python web server on the Orange Pi. The Arduino transmits it’s data to the Pi through Serial. It’s simply transmitting a “1” or a “2” depending in which side detects a goal. Then the server keeps track of the score and sends live updates to a client web page via web-sockets.

Any device connected to the same wifi network can then access this website and see the live score. I also included a reset score and shutdown buttons on the client for easy access.

Conclusions

As you can see I had a lot of fun with this project! We’ve been playing a lot with it with my dad and it works perfectly! There are still some improvements to be made. We could improve the webapp to save statistics and to be able to host tournaments with friends!

All the code for it is in the description so feel free to modify it for your needs and build your own table! See you next time!

Checkout the video here for more info: https://www.youtube.com/watch?v=unXU5m7EqaU

Source code is here: https://github.com/s6joui/electronic-table-footbal

Resources

https://en.wikipedia.org/wiki/Photoresistor

https://www.arduino.cc/reference/en/language/functions/analog-io/analogread/

https://electronics.stackexchange.com/questions/211894/what-colors-or-wavelengths-are-photoresistors-sensitive-to

https://create.arduino.cc/projecthub/Ayeon0122/reading-a-photoresistor-1e705e

Code

Github
Code for the arduino and the webapp

Schematics

Schematics
Schematics k6nze4jgyi

Comments

Similar projects you might like

The Zeus Electronic Weather Station (ZeWS)

Project in progress by moisi

  • 5,269 views
  • 0 comments
  • 16 respects

Interactive LED Table for 50€

Project showcase by Antoine Rochebois

  • 44,167 views
  • 12 comments
  • 135 respects

Electronic Wind DIY Pinwheel

Project tutorial by Francesco Guerri

  • 4,391 views
  • 0 comments
  • 9 respects

Smart Coffee Table with Nano and HX711

Project tutorial by TheTNR

  • 5,204 views
  • 2 comments
  • 13 respects

DIY Ultraviolet Sterilization Device (UVClean)

Project showcase by Henry Mayne

  • 2,567 views
  • 1 comment
  • 12 respects

A DIY Smart Insole to Check Your Pressure Distribution

Project tutorial by Juliette van der Pas

  • 23,541 views
  • 15 comments
  • 54 respects
Add projectSign up / Login