Introduction: Airsoft / Paintball DOMINATOR Via Arduino + RFID RC522
What is DOMINATOR?
This is a device that is used when playing the King of the Hill game mode. The device should have a display with two times for both gaming teams. The team who gets to DOMINATOR presses the button and the time starts to count towards his team. (Both times are initially set to 00 hours, 00 minutes, and 00 seconds). The time is added until the point is occupied by another team and the button changes the time adding to its side. Because I wanted to distinguish the project, I used an RFID reader that can read cards and key fobs at 13.56MHz (there is also an equivalent at 125kHz) and in this way we can replace the mechanical buttons.
Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.
Step 1: How Does an RFID Reader System Work?
The RFID reader can read cards and key fobs at the specified frequency within 3-5cm. Therefore, the physical presence of a team member is required. Each team member has a card or key, whose code is pre-recorded and stored in the program. Each code is assigned to a team.
The card is also signaled by a buzzer, which announces the change. The time will begin to be added to the team that applied the card or key. In addition to the two teams, I also used a special key fob for the organizer, who, after placing the card, can pause the time in the event of a player's complaint about a hit, injury, or other situation in the game that could give another team an advantage.
Another user is part of the system - so-called. eraser that can zero and pause times at the same time. It is used, for example, when the game is started illegally, the key fob is invalid (for example, a knockout player). The system is not limited by the number of team members, it depends mainly on memory requirements for running the program, as the whole system works with an internal millis timer.
Step 2: Hardware, Program Principle, Source Code
What hardware was used?
- Control microcontroller - Arduino Nano / Atmega328P
- 2x leds - indication to which team time is added (blue / red)
- 20x4 LCD display - real-time team display
- 2x relay - for connection of lights to 230V (SSR / elmg.) - for example at night - functionality based on LED
- 1x buzzer
- 1x RFID reader RC522 at 13.56MHz
- 12x cards / key fobs (5x for teams, 1x organizer, 1x eraser)
The program works with millis, which is the processor time since power up. At regular intervals, once every 0.01 seconds (every 10ms), the system logic is performed to verify whether time is already being added to a team, if yes, the time is counted and displayed, ie 100x is displayed on the LCD per second, 100x refresh / second.
Using the interval of 0.001 seconds, the system was inaccurate and communication with the speed of 1000x refresh / second on the I2C bus on the display did not work correctly, as it took some time to read the cards. The RF5 library for the RC522 reader can interrupt to indicate card recording, which activates the detector. Based on the verification result via a simple if condition with card addresses (physical), we activate a variable that works with time and has logic in it - tenths, seconds, minutes, and hours.
There are 2 subroutines that are made up of bool variables. Each bool variable is for one team. If set to true, the logic for that team will be executed. Nothing will change if the same team keyring is attached. If another team's key fob is attached, the bool for the team to which the time computer changes to false and for the team to which the time counts to true. If the organizer attaches the key, both bool variables are set to false.
Seconds, minutes, and hours are stored in dynamic global variables that are handled inside true bool values. If eraser attaches the key, both bool variables are set to false and all global variables are set to 0.
Source code of DOMINATOR is not free! I offer software. If you are interested: email@example.com
Source code for reading ID of RFID cards: