Football Target Goal With Raspberry Pi

by SybrinPypaert in Circuits > Raspberry Pi

509 Views, 1 Favorites, 0 Comments

Football Target Goal With Raspberry Pi

Target_goal.jpg

Hi, my name is Sybrin Pypaert and I'm a student Multimedia & Creative Technologies (MCT) at Howest. To show what I've learned this year, I made a football game called Football Target Goal where the goal is to shoot the right target indicated on the goal. I made this game because firstly I love playing football and secondly I think it's a very fun game to play when for example you want to take a break from for example studying or gaming.


Some features:

  • Login system
  • Play a game
  • Measure distance
  • Live update of current game played
  • Statistics of played games
  • Change colors of led strips


With a RFID tag you can track your own progress. To start a game, first you need to select an amount of shots you want to take. Then when the game is started, the distance sensor will measure the distance between you and the goal before every shot you take. The goal is to shoot as many times on the right target as possible. The led strips will be able to give you indications whether a distance is being measured or a target is being chosen.

Supplies

This project costs around €280

You can find some websites and prices for everything in the pdf file below.

Electronics

  • Raspberry pi 4 model B
  • RFID-RC522 sensor
  • HC-SR04 ultrasonic distance sensor
  • 6 x piezo discs sensors
  • MCP2008
  • LCD Display
  • PCF8574
  • Breadboard voeding
  • Button
  • 10 meters RBG LED-strips WS2812B
  • 5V 4A power supply
  • 5.5mm x 2.1mm DC Power Female Jack to 2 Conductor screws Down Connector 

Build material

  • 6 x thin wooden planks (33x33cm)
  • 1 x large thick wooden plank
  • Wooden poles (for the goal)
  • Some sort of foam material
  • Some extra wood
  • Black paint
  • 2 x angle irons
  • Flat iron metal strips
  • Tiny foam ball
  • Screws 
  • Duct tape

Building the Football Goal

IMG_20230603_151708.jpg
IMG_20230603_212356.jpg
IMG_20230609_155427.jpg
IMG_20230610_190136.jpg
IMG_20230610_192908.jpg
IMG_20230610_194259.jpg
IMG_20230610_194204.jpg
IMG_20230610_171058.jpg

Note: Before we go any further, their are some pictures taken with the goal painted en the goal not painted. It's because first I build the goal, and then when everything was working, I took it down a and painted the main wall, the squares and the case. So for some pictures you will see, things will be painted and on other pictures it won't. So if you want to paint it, you should do it before attaching everything together.


1. The poles

The goal I made is 120 x 80 x 60 cm (L x W x H). I bought this goal on vidaXL, but you can also make your own goal if you want to.

2. The main wall

The main wall needs to be thick (around 2cm) because otherwise the whole goal will generate to much vibration when a ball hits the goal and that's not good for the sensors. Between the poles and the goal, there is a small border from wood. I've made it this way, because otherwise the 6 squares will stick out a bit from the goal. You can screw this all togehter from the back with long screws.

3. The 6 squares

Each square is 33x33 cm. Draw these 6 squares on the thick main wall with a gap of 1cm between each square. Then in the center of each square, you make a whole. Then attach 2 stripes of foam to the side of a square with four screws in the corner. Do this 6 times and then screw them to the main wall.

4. Stability for the goal

At the bottom of the goal, you put wooden stick between the main wall and the pole, so it the main wall won't vibrate as much. Also attach to other poles to the main wall. This will also really help with stability.

5. The case

At the back of the goal, you make little case. This is where the raspberry pi and all the wires will lead to. The first part of the roof will be attached to the case. This is where the LCD and power-off butten will be. Then the second part you can just extend so you can see the wiring.

Fritzing Schema

Fritzing_breadboard.png
Fritzing_elektronica.png

You will need a 5V 4A power supply for the led strips. This is necessary because it must be possible to light up nearly 100 leds at the same time.

Wiring Sensors

IMG_20230609_155522.jpg
IMG_20230609_164128.jpg
IMG_20230609_164132.jpg
IMG_20230611_180532.jpg
IMG_20230611_192817.jpg
IMG_20230612_112901.jpg
IMG_20230612_182542.jpg
IMG_20230619_094806.jpg

1. The distance sensor

In the center of the crossbar, you make two holes. This is for the ultrasonic distance sensor. If you think that there's a chance that the sensor would fell out, you can cut a tiny foam ball in half and push one half in that tiny hole.

2. The led strips

The led strips are probably the hardest part of this all. We have not soldered the led strips so you need to make sure the led strips follow the right path through the goal because otherwise, you might miss a few spots. I've uploaded a picture where you can see how I've wired the ledstrips. To make a 90° angle, I made on each corner a hole where we make a little loop with the led strips. This way we can make a 90° angle.

3. Piezo sensors

Stick 6 piezo sensors on the back of the 6 squares. With the 6 large holes we created earlier in the main wall, you can easily stick the sensor on the squares.

4. Lcd display + button

As I already mentioned, the roof of the case will be out of two parts, the first part is stuck where the lcd and button will be on. And the other part, you can extend to see the wiring. In the case at the back, there are some holes where you can leed all wires to.

Database

EER-diagram.png

I hosted this database on my Raspberry pi using MariaDB.

There are 4 tables in total. The table 'speler' is where every user is saved. Every user can play games. All those games are stored in the table 'spel'. In each game u can shoot an number of times. Those shots are stored in the table 'schot_historiek'. Each shot is linked to a game and each game is linked to a player. The final table, table 'status_ledstrips' is where you can change the colors of those indications, for example red for selecting the target and green if you hit it.

Software

Frontend

The frontend runs on Apache. You can find a guide on how to install apache on my github.

Backend

In the raspi-config file, you need to enable SPI, I2C. The SPI with the MCP3008 is for the piezo sensors and the I2C with the PCF8574 is for the LCD display.

The backend runs on Flask. For this project, everything is written in Visual Studio Code. There are also some packages you need to install for this project.

You can find all packages required on my github in the requirements.txt file. The one package that is not in this file and you also need to install is spidev.

There are 2 libraries I've installed. One is for the RFID sensor and one is for the led strips.

  • The one for the RFID sensor is the MFRC522 with the SimpleMFRC522.
  • The one for the led strips is the rpi_ws281x library
  • Note: if you work in a venv (Virtual Envirement), it is possible that the library won't work if you try to install it with 'pip install rpi_ws281x'. The solutions I think I've found is to install this library with another command. So the library I've installed is 'pip install adafruit-circuitpython-neopixel'. And now I think you should be able to use the library 'rpi_ws281x' in a venv.

There are also some classes I've made myself. You can find these classes in the helpers folder on my github.


The entire code from frontend and backend you can also find on my github.