Repository with test software implementations for Airsoft points: Airsoft - WiFi points - Arduino
The firmware is available free of charge
Arduino DOMINATOR WiFi Stopwatch Schematics Pushbutton Capture Points Paintball

WiFi points for Airsoft | Paintball


Entities in the WiFi points project:


Team red - button for user entry
Team RED
Team red - button for user entry
Team GRE

Project description WiFi points:


Capture Points game mode is suitable for Airsoft and Paintball sports. The points communicate with each other via WiFi modules nRF24L01, while they exchange information about the status of the point (whether it is occupied and by which team). The first point operates in permanent transmitter mode and expects a response from the second point after the information is transmitted. The second point works in the receiver mode and responds to the reception of the transmitter data (callback). This communication mechanism prevents collisions. The situation that both points transmitted simultaneously and were unable to receive the information is not so dangerous. Each of the points uses an Arduino control microcontroller (Arduino Uno / Nano) or a separate chip (Atmel) ATmega328P, which controls the logic of button presses. There are 2 teams in the game - RED team and GRE team who play against each other and try to occupy both points by pressing the appropriate button. Button input indicates the action of occupying a point by a member of the RED or GRE team. The switching buttons connected in the INPUT_PULLUP mode are used, they are switched to ground (active-low signal). The hold time / number of presses is not verified in the available software implementation. The point responds immediately when the button is pressed without pausing.


The game ends when both points are occupied by the same team. A change in point is indicated by a detector that beeps each time a button is pressed. At the end of the game, both detectors beep in an endless loop. At the same time, WiFi communication between the nRF24L01 modules will be interrupted so that no further information is transmitted and the result of the game is final. WiFi modules nRF24L01 (version without + PA + LNA) communicate at about 70 meters, nRF24l01 + PA + LNA also per kilometer, respectively in the forest and otherwise disturbed environment at the level of 450-700 meters at a maximum transmission power of 1 mW. With external power supply, it is possible to use the YL-105 adapter with a 3.3V converter and power it via an external adapter in the range of 5 to 18V. The 5V power supply from the Arduino is not recommended, as it threatens to destroy the controller, as it is not able to supply the required current for maximum power. When powering the nRF24L01 via a 3V3 Arduino terminal, it is possible to supply the lowest transmit power of 0.0158 mW. Both points are restarted by RESET button onboard of Arduino boards, or by pulling out and connecting back the power supply (power-on cycle). Theoretically, WiFi points can be extended to 8 points (8 pipelines), which communicate with each other, respectively. they can only communicate with the transmitter based on the proposed logic. However, it is necessary to add an identifier for each point to distinguish them. The transmitter that initiates the communication can thus distinguish the occupation of the team on all WiFi points that are implemented in the system. When transmitting a larger amount of data, it is also possible to use a structure where it is possible to transmit multiple data types simultaneously as one packet. The receiving point can thus obtain data from the expected structure based on the size of the individual data types.

Wireless modules communicate at 2.4 GHz. The modules have their own communication channel with a choice of up to 140 channels.

Supported module speeds nRF24L01:


  • 250 kbps - this option is not supported for older nRF24L01!
  • 1 Mbps
  • 2 Mbps

  • Power modes of nRF24L01 modules:


  • RF24_PA_MIN = -18 dBm --> 0,0158 mW
  • RF24_PA_LOW = -12 dBm --> 0,0631 mW
  • RF24_PA_MED = -6 dBm --> 0,2512 mW
  • RF24_PA_HIGH = 0 dBm --> 1 mW

  • Block diagram - WiFi points - Airsoft:


    Bloková schéma / Block scheme - Capture Points - Airsoft / Paintball, Arduino, nRF24L01

    Compatible control hardware for WiFi Airsoft points:



    Peripherals for WiFi Airsoft points:


    2x WiFi module nRF24L01 / nRF24L01 + PA + LNA
    2x WiFi module nRF24L01 / nRF24L01 + PA + LNA
    Pushbutton (pushbutton)
    4x Pushbutton
    Buzzer
    2x Buzzer
    2x LEDs
    4x LEDs

    Wiring diagram - WiFi points


    WiFi body - DOMINATOR - schéma zapojenia - Arduino / Airsoft, stopwatch, DOMINATION

    WiFi points - test connection


    WiFi body - - Arduino pre Airsoft, Paintball

    WiFi points - Capture Points - How it works:


    Table connection of terminals - Configurable DOMINATOR - fully corresponds to the wiring diagram:

    Arduino Uno / Nano (AtMega328P) nRF24L01
    GND GND
    3V3 / external source Vcc
    D3 CSN
    D4 CE
    D11 MOSI
    D12 MISO
    D13 SCK
    Arduino Uno / Nano (AtMega328P) LED diodes
    GND GND
    D7 IN (RED)
    D8 IN (GREEN)
    Arduino Uno / Nano (AtMega328P) Pushbuttons (INPUT_PULLUP)
    GND GND
    D5 IN (RED)
    D6 IN (GRE)
    Arduino Uno / Nano (AtMega328P) Buzzer
    D2 IO
    GND GND

    Available libraries for microcontrollers (Arduino)


    Library archive (.zip) expand to C:/Users/[User]/Documents/Arduino/libraries
    Library name Library function Download
    RF24

    Library for AVR microcontrollers (ATmega) Arduino Uno / Nano / Mega. It allows to control WiFi modules nRF24L01 (nRF24L01 + PA + LNA) communicating via SPI bus.

    Download

    Program - WiFi points


    Program - NODE 1 (permanent transmitter)


    // nRF24L01 transmitter
    //WiFi points for Airsoft Points
    //Created by: martinius96@gmail.com
    //Donate coffee: paypal.me/chlebovec
    
    #include <SPI.h>
    #include "RF24.h"
    #define CE 4
    #define CS 3
    RF24 nRF(CE, CS);
    int response = 8;
    int received = 12;
    const int buzzer = 2;
    const int red_team = 5;
    const int blue_team = 6;
    const int red_led = 7;
    const int blue_led = 8;
    byte adresaPrijimac[] = "prijimac00";
    byte adresaVysilac[] = "vysilac00";
    boolean last_packet = false;
    void setup() {
      Serial.begin(9600);
      pinMode(buzzer, OUTPUT);
      pinMode(red_led, OUTPUT);
      pinMode(blue_led, OUTPUT);
      pinMode(red_team, INPUT_PULLUP);
      pinMode(blue_team, INPUT_PULLUP);
      nRF.begin();
      nRF.setDataRate( RF24_250KBPS ); //RF24_250KBPS, RF24_1MBPS, RF24_2MBPS
      nRF.setPALevel(RF24_PA_LOW); //RF24_PA_MIN, RF24_PA_LOW, RF24_PA_HIGH, RF24_PA_MAX
      nRF.openWritingPipe(adresaVysilac);
      nRF.openReadingPipe(1, adresaPrijimac);
      nRF.startListening();
    }
    
    void loop() {
      if (response == received) {
        if (last_packet == false) {
          last_packet = true;
          nRF.stopListening();
          nRF.write( &response, sizeof(response) );
          delay(50);
        }
        tone( buzzer, 900, 800);
        delay(1000);
      } else {
        nRF.stopListening();
        int output_red = digitalRead(red_team);
        int output_blue = digitalRead(blue_team);
        if (output_red == LOW) {
          response = 1;
          digitalWrite(red_led, HIGH);
          digitalWrite(blue_led, LOW);
        } else if (output_blue == LOW) {
          response = 2;
          digitalWrite(red_led, LOW);
          digitalWrite(blue_led, HIGH);
        }
        nRF.write( &response, sizeof(response) );
        nRF.startListening();
        while (nRF.available()) {
          nRF.read( &received, sizeof(received) );
        }
        Serial.println("Received datas: ");
        Serial.println(received);
        Serial.println("Response: ");
        Serial.println(response);
        delay(50);
      }
    }
    

    Program - NODE 2 (permanent receiver with callback to the transmitter)


    // nRF24L01 receiver
    //WiFi points for Airsoft Points
    //Created by: martinius96@gmail.com
    
    #include <SPI.h>
    #include "RF24.h"
    int response = 3;
    int received = 4;
    const int buzzer = 2;
    const int red_team = 5;
    const int blue_team = 6;
    const int red_led = 7;
    const int blue_led = 8;
    #define CE 4
    #define CS 3
    RF24 nRF(CE, CS);
    byte adresaPrijimac[] = "prijimac00";
    byte adresaVysilac[] = "vysilac00";
    boolean last_packet = false;
    void setup() {
      Serial.begin(9600);
      pinMode(buzzer, OUTPUT);
      pinMode(red_led, OUTPUT);
      pinMode(blue_led, OUTPUT);
      pinMode(red_team, INPUT_PULLUP);
      pinMode(blue_team, INPUT_PULLUP);
      nRF.begin();
      nRF.setDataRate( RF24_250KBPS ); //RF24_250KBPS, RF24_1MBPS, RF24_2MBPS
      nRF.setPALevel(RF24_PA_LOW); //RF24_PA_MIN, RF24_PA_LOW, RF24_PA_HIGH, RF24_PA_MAX
      nRF.openWritingPipe(adresaPrijimac);
      nRF.openReadingPipe(1, adresaVysilac);
      nRF.startListening();
    }
    
    void loop() {
      if (response == received) {
        if (last_packet == false) {
          last_packet = true;
          nRF.stopListening();
          nRF.write( &response, sizeof(response) );
          delay(50);
        }
        tone( buzzer, 900, 800);
        delay(1000);
      } else {
        if ( nRF.available()) {
          while (nRF.available()) {
            nRF.read( &received, sizeof(received) );
          }
          Serial.println("Received datas:: ");
          Serial.println(received);
          Serial.println("Response: ");
          Serial.println(response);
          nRF.stopListening();
          int output_red = digitalRead(red_team);
          int output_blue = digitalRead(blue_team);
          if (output_red == LOW) {
            response = 1;
            digitalWrite(red_led, HIGH);
            digitalWrite(blue_led, LOW);
          } else if (output_blue == LOW) {
            response = 2;
            digitalWrite(red_led, LOW);
            digitalWrite(blue_led, HIGH);
          }
          nRF.write( &response, sizeof(response) );
          nRF.startListening();
        }
      }
    }