Introduction: DigiFlag

If you like to play capture the flag and want to know how to digitalize the game a bit this is the place to be. In this instructable you will automize the the scores and you will see who died in the game.



  • Drill
  • glue gun
  • esp
  • uart adapter
  • soldering iron
  • Supplies:
  • Druksensor x4
  • LDR x4
  • LED x2
  • Display x1
  • esp x4
  • raspberry pi x1
  • wooden chest x1
  • breadboard x3
  • pvc pipe x1
  • jumper cabels x80
  • power suply for pi x1
  • wooden plank x2
  • stick x2
  • resistor 10kohm x6
  • resistor 475ohm x2
  • potentiometer x1
  • isolation tape x5

Step 1: Database

The project database exists out of 6 columns. Every column has his own id. Most of the elements are INT's or VARCHAR, but for the elements that will contain the tag we need to use a DOUBLE. When the scheme is finished forward engineer the database so that we can implement data.

Step 2: Circuit

For the circuit you will need a lot of the listed components. Follow the scheme, dont solder anything yet so that when there is a fault in the circuit u can easily swap out or rewire the faulty component. Plug in the pi power suply and see if the LCD lights, the brightness of the LCD text can be adjusted by the potentiometer.

Step 3: Pycharm

For this step you will need the pycharm program once this is installed we can start setting up the configuration. Press on file in the top left corner, then select preferences or settings, select deployment. On this screen you need to click on the plus icon and select an SFTP configuration. Name the configuration and fill in the fields, the host stands for the ip address of you're pi, the user name and password from the. Go to mappings and choose the directory that you want to use. Return to the previous screen and hit test connection. When this gives a succesfull reply click on ok.

Step 4: Backend

Here you will write the code for the backend. Start of by writing the setup here, reset the LCD so that there are no older messages displayed. Then write the routes to the esp's so that you receive a json message from the esp and update the score or death in the database. then write have the websockets these are used to communicate with the frontend. finaly write the rfid()function this will set the death element in the data on 0 when the tag is scanned. You can find all the codes for this project in the additional folder.

Step 5: ESP8266

The ESP module is coded in arduino so be sure to install arduino ide. Once installed go to file, preferences and type the link shown in the picture into "the additional Boards Manager URLs:" text box. Hit ok then open tools at the top of you're screen go to boards, boards manager and scroll all the way down and install esp8266. Once this is done go to file examples and select the basicHttpClient, fill in the wifi configuration and. Now edit the file like I did in the last photo. Take the uart adapter and solder a button between the gpio0 and the ground. Plug in the esp into the adapter and plug it into an usb port while holding the button. Now go to tools and select the newly apeared com poort select from boards the generic esp8266 and start the upload. Once you see a procentage apear release the button. For the other esp's u will have to change the api path to that of the corresponding one in the backend.For the 2 last ones u will have to change both pin 0 and 2 to digitalRead and change the if to if(s1 && s2 == HIGH).

Step 6: Frontend

Build the frontend by replicating the design by inputting tekst in the html file and adding classes. By assigning href links to buttons we can switch through pages. By editing a css with the classes made in the html you can change the structure of the page. By implementing JavaScript you can send the value of the slider to the backend and let the game know when to start the game.

Step 7: Behuizing

Start of by deviding the planks in 8 equal rectangles, make sure that u have enough left to cut out every side 4times. When thats done glue 3 of rectangles together and glue the 2x sides on top of the left over rectangle. Put a nail through every corner of the bottom rectangle. Then drill 2 wholes just big enough for the pvc pipe through the 3rectangles that are glued together. Place a breadboard with the pressure cercuit inside of the bottom part with the sides. Carefully align the pressure sensors so that they are beneath the pipes and push the glued rectangles over the pipes. Repeat this proces for the second camp. Then take a bit of left over wood, drill 2 small holes and a cut out that fits the esp pins. Pierce the shirt with the LDR and put the legs of through the 2holes solder the circuit directly without a breadboard. Pierce the front of the shirt with an LED and connect it with the esp sew the circuit into the shirt. Repeat this process 2times. For the final step take the chest and drill a hole so that you're LCD will fit then drill two smaller holes in the chest so that you can fit the wires of the rfid through. Place you're circuit in the chest and you're done.