Smart Hockey Table
I have always been a big fan of games no matter in wich form they came.
So when it was time to build my very own project i knew i had to go in that direction.
The idea of a Hockey Table didnt come immediately in mind, but after digging deeper in my memories , i knew i had to build something like this. It is not a common thing to find everywhere but it sure is fun to play with friends and family when you come across one.
So i decided to make one , so i can have it at home and if needed being able to easily transport it to somewhere else . The main goal is to have a Hockey Table that automatically keeps track of the score so you can continue playing without worrying if the score is still correct.
Supplies
Here is a list of most of the components that are needed. In the BOM you can find some links that might help you find the correct components
- Raspberry Pi
- IR Break Beam sensor
- RFID Scanner
- OLED screen
- Button
- Buzzer
- Photodiodes
- Lasers
- breadboard power supply
Downloads
A Closer Look at the Circuit
One of the earliest steps of creating a project is making the circuit.
As you can see i used an extra breadboard power supply that supplies 5V. All of the other components who need 3.3V are connected to the RPI.
Now let's take closer look the the components:
- IR Break Beam sensor:
-
These components are the adafruit IR Break Beam sensors and only the emitter has 2 wires, wich means the receiver has 3. this means you can only connect 2 wires from the emitter when making your plan
-
They are connected to the 5V
-
The third wire is connected to the GPIO17 pin
-
- RFID scanner:
- The VCC pin is connected to the 3.3V
- The RST pin is connected to the GPIO25 pin
- The MISO and MOSI are connected to the MISO and MOSI pins respectively
- The SCK pin is connected to the SCLK pin
- The NSS pin is connected to CE0 pin
- The OLED screen:
- The VCC pin is connected to the 3.3V
- The SDA and SCL pins are connected to the SDA and SCL pins respectively
- The Buzzer
- The buzzer is connected to the GPIO4 pin
- The Button
- The button is connected to the GPIO18 pin
- Photodiodes
- One of the diodes is connected to the GPIO20 pin whilst the other is connected to the GPIO21 pin
- Lasers
- The Lasers are connected to the 5V
The Prototype
Before attaching anything to the real Hockey Table i decided to make a working prototype first.
I attached all the components that were able to fit on the breadboard on board itself. The sensors that i used to detect movement would turn out to be quite tricky to attach to the board, so i decided to make a small corridor out of foam , tape and a stick. This way i can have the IR break beam sensor , the photodiodes and their lasers all face eachother and see if something was between them.
This was a handy way to make sure every component worked in that phase of the project.
Combining the Circuit and the Table
Now comes the part where we need to convert the prototype into the real thing.
As you can see on the pictures , the breadboard is still a big part of it, but we moved the components away from it.
We are still fully linked due the long wires and a extra smaller breadboard.
The components:
- The Photodiodes and their respective lasers are placed inside the goals by drilling holes and glueing them onto the table.
- The IR break beam sensors are wired to the side of the table opposite of eachother, in wich you can see a better view of in the second picture. They are placed that way so that they can see if anything crossed the middle part of the table.
- The RFID is screwed at the side of the table since it needs to be easily accessible, while not being a nuissance for the game.
- The OLED display is also screwed onto the table, but in a more upwards manner so that the screen is readable while playing.
- The buzzer's main function is to make noise so I decided to put it under the table and out of view where it still can be heard but not seen. This is purely an aesthetic choice and can be placed wherever you want.
Info About the Database
As you can see the database is clearly divided into 2 parts.
- Historiek:
This includes the overall timelime of all the triggers that occur hence the two foreign keys:
- DeviceId : This gives the id of one of the devices wich include : the button, the IR break beam , photodiode 1 and photodiode 2.
- ActieId: this gives the id of one of the actions wich include: the RFID ,OLED screen and the buzzer.
It also gives at which time the trigger happened, what the value of the trigger is and some commentary.
- Match
This includes the overall statistics of a match. It also has two foreign keys:
- SpelerId1 and SpelerId2: these foreign keys help to identify wich players are playing the game by giving their ID's with these keys.
It also tracks the amount of goals made per player, the winner of the game and how long the game lasted.
Each goal is also tracked individually.
It also has two foreing keys:
- SpelerID: This shows wich player made the goal.
- MatchId: This indicates in wich game this specific goal was made.
It also tracks when the goal was made , at wich speed and how much time there was between this goal and the previous one.
Info About the Code
Now let's talk about about the code of each component for a bit:
- Photodiodes : In a very simple way explained, i thought of these diodes as if they were buttons. What i mean by that is, I looked on their GPIO.input and if there was any change, then the next few lines of code are triggered to update the database that a goal has been made.
- The IR break beam sensor: Works the same as the diode, but of course your update to the database is different.
- The buzzer: You can change the sound of the buzzer using the PWM() and ChangeDutyCycle() and the time between each sound with a time.sleep()
- The RFID scanner: For the RFID scanner I used a library. I used this link to help myself: https://pimylifeup.com/raspberry-pi-rfid-rc522/
- The OLED display: For the display i also used a library. I used this link to help myself: https://raspberrytips.nl/oled-display-128x32-i2c/
Enjoy!
I hope this was understandable and perhaps made you inspired to make your very own.
Thank you for your attention and enjoy your future project building adventures.