SoftTrainer: the Interactive Airsoft Shooting and Training Range.

by GuusLoccufier in Circuits > Raspberry Pi

26 Views, 1 Favorites, 0 Comments

SoftTrainer: the Interactive Airsoft Shooting and Training Range.

IMG-20240617-WA0004.jpg
bro-takes-photos-Fk5VfecUrjo-unsplash.jpg

As you may have read in the title, this is an interactive airsoft target / shooting range. This project was made for Project One, the first project of the bachelor MCT at howest. These targets light up following a plethora of training courses, depending on how long it takes you to shoot the Illuminated target you get a score. A sound gets played for reloads and all targets activate so that you can shoot as soon as you're done reloading. This way the soft trainer can not only see your target switching skills but also your reloading skills. On the web interface you can add users and training courses and of course look at those beautiful stats.


All files can be found on this my github https://github.com/howest-mct/2023-2024-projectone-mct-GuusLoccufier/

Supplies

What you will need:

  • 1x Raspberry Pi B

This will not only be our processing power but also our actual power as we won't be needing that much "juice" anyway. The pi will run the python code, the web server and the

  • 1x OLED 1306 (i2c)

To display the info needed to operate the program, I went with a readily available OLED, I like these better than LCD's for the quality and flexibility.

  • 1x 4x7 segment display

This will display the score.

  • 1x Rotary encoder

In my opinion, one of the most intrusive ways to get through a UI on a contraption like this.

  • 2x Button

A little power off and a confirmation button for at the start of the program, although this could also be done with the encoder.

  • 1x Passive buzzer

This way you can generate different tones for different events.

  • 1x Small breadboard

To house the MCP and the PCF's.

  • 1x MCP3008

A little PCI analog to digital converter with 8 channels.

  • 2x PCF8574

A I2C IO expander with 8 outputs one will control the LED's on the targets the other one will control the: a b c d e f g and dp segments of the 4x7 segment.

  • 2-8 Piezoelectric Sensor / Piezoelectric Element

The most important sensors of the project, these will detect if the targets been shot.

  • 2-8 LED's (same number as Piezo's)

These will indicate what target to shoot at.

Raspberry Pi

raspiClose.jpg
IMG_20240607_103250.jpg

Install Raspberry Pi OS or OS lite on the Pi while making sure you enabled ssh and set your username, password and preferred Wi-Fi network. After that, you should have your pi up and running. As we will be using Apache2 for our frontend we will need to install it:

sudo apt install apache2 -y

As for our database, we will use MariaDB, which you should also install:

sudo apt install mariadb-server mariadb-client -y

For the further install and safety of MariaDB, we will do a secure installation:

mysql_secure_installation

Now set a password and leave the default settings.


We are now able to go in our MariaDB server:

mysql -u root -p

Once in the server, we will configure a user:

grant all on *.* to 'YOUR_USERNAME'@'localhost' identified by 'YOUR_PASSWORD'; grant grant option on *.* to 'YOUR_USERNAME'@'localhost';

Now we should reload the privileges:

flush privileges

and exit the database:

exit


Now with the help of your favorite SQL connector / visualizer, (for example SQL workbench or DB Visualizer) you can connect to this database and run this SQL file to set up the database. https://github.com/howest-mct/2023-2024-projectone-mct-GuusLoccufier/blob/main/database/projectone.sql

Casing and Target

2024.06.17 11;47;38 FreeCAD.png
2024.06.17 11;48;06 FreeCAD.png
2024.06.17 11;47;52 FreeCAD.png
2024.06.16 14;24;11 FreeCAD.png
2024.06.17 11;48;18 FreeCAD.png

Now time for some light 3D work! You might think to yourself, is that an upside down breadboard? Or does all that wiring fit in that small case? And that would be a yes, to both of those questions. Well, at least I got it in there, although it was with a little bit of struggle. These designs are made in FreeCAD and are also available on the GitHub: https://github.com/howest-mct/2023-2024-projectone-mct-GuusLoccufier/tree/main/3d

Electronics

softTrainer_bb.png
IMG-20240617-WA0005.jpg
softTrainer_schem.png
IMG-20240617-WA0001.jpg
IMG-20240617-WA0007.jpg

Now time to have some fun and hope there's no magic smoke! Yes, it's time for the wiring. As you can see, it gets messy pretty quickly, so try to complete circuits one at a time and make note of what has been done and double-checked. If you're asking yes, those targets take painstakingly long to assemble but yes it's worth it and the hard work pays off.

The Code

Now we're getting to the fun part, that is, if you like pain and suffering as much as the next guy. Although you won't have to do as much work as the files are again on GitHub. For the backend, that is https://github.com/howest-mct/2023-2024-projectone-mct-GuusLoccufier/tree/main/backend and for the frontend it's https://github.com/howest-mct/2023-2024-projectone-mct-GuusLoccufier/tree/main/front.