Repository with test software implementations for Airsoft points: Airsoft - WiFi points - Arduino
If you are interested in purchasing firmware for WiFi points, contact: martinius96@gmail.com
Arduino LCD WiFi Stopwatch Schematics Pushbutton Capture Points Paintball DOMINATOR

WiFi points for Airsoft | Paintball


Entities in the WiFi points project:

Tím RED - tlačidlo pre používateľský vstup
Team RED
Tím GRE - tlačidlo pre používateľský vstup
Team GRE

Project description WiFi points:

Capture Points game mode for Airsoft and Paintball sports. The points communicate with each other via WiFi modules from the nRF24L01 series, while they exchange information about the status of the point (whether it is occupied and by which team). One point is a permanent transmitter and requires communication from the other point. The second point is the receiver and responds to the data received by the transmitter, thus avoiding collisions when communicating on the WiFi frequency 2.4 GHz. Each of the points uses an Arduino control microcontroller (Arduino Uno / Nano), or a separate chip (Atmel) AtMega328P, which controls the entire logic of the system. There are 2 teams in the game - RED team a 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 pushbuttons connected in the INPUT_PULLUP mode are used. Pressing the button feeds the GND signal to the Arduino digital input terminal (Active-LOW switching signal). Press duration / number of presses is not controlled and is not configurable. The point responds immediately to a button press. Game ends when both points are occupied by the same team. The change in the point is indicated by the detector, at the end of the game both detectors beep in an infinite loop and at the same time WiFi communication between the nRF24L01 modules is interrupted.
WiFi modules nRF24l01 communicate at 2.4 GHz. nRF24l01 (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 maximum transmission power. For external power supply, it is necessary to use a YL-adapter with a 3.3V converter and power it via an external adapter. Do not use a 5V power supply from the Arduino, there is a risk of destroying the controller, as well as the 3V3 terminal is not suitable for powering the module, as it has a high current consumption in more powerful transmission modes. Restart of both points is performed by resetting the Arduín button, or by pulling out and connecting the power supply (power-on cycle).

Wireless modules communicate at 2.4GHz, it is not WiFi technology, they do not require a router or access point! 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=-18dBm
  • RF24_PA_LOW=-12dBm
  • RF24_PA_MED=-6dBM
  • RF24_PA_HIGH=0dBm
  • 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 / externý zdroj 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

    Test program - WiFi points


    The goal of the test program is to test hardware compatibility (versions of nRF24L01 modules with a transfer rate of 250kbps, as not all of them support it). Test and implement a connection between the transmitter and the receiver with a callback of the receiver, which returns the data sent to the transmitter. The receiver has an integrated buzzer that beeps when it detects certain data - it indicates that there is a connection to the transmitter and the data is flowing. The tester is also suitable for use in the Airsoft game for the initial testing of the range and communication between the two nodes. The transmitter always transmits, the receiver only in response to the transmitter after receiving the data. It is possible to transmit different data in the structure, larger packets.

    Transmitter tester (Toto nie je program pre Airsoft WiFi projekt! - Projekt je platený)

    //nRF24L01 + PA + LNA - Transmitter tester
    //Author: Martin Chlebovec (martinius96)
    //Web: https://arduino.php5.sk
    //Donate: https://paypal.me/chlebovec
    
    #include <SPI.h>
    #include "RF24.h"
    // nastavení propojovacích pinů
    #define CE 4
    #define CS 3
    // inicializace nRF s piny CE a CS
    RF24 nRF(CE, CS);
    // nastavení adres pro přijímač a vysílač,
    // musí být nastaveny stejně v obou programech!
    byte adresaPrijimac[]= "prijimac00";
    byte adresaVysilac[]= "vysilac00";
    void setup() {
      // komunikace přes sériovou linku rychlostí 9600 baud
      Serial.begin(9600);
      // zapnutí komunikace nRF modulu
      nRF.begin();
      nRF.setDataRate( RF24_250KBPS );
      // nastavení výkonu nRF modulu,
      // možnosti jsou RF24_PA_MIN, RF24_PA_LOW, RF24_PA_HIGH and RF24_PA_MAX,
      // pro HIGH a MAX je nutnýv externí 3,3V zdroj
      nRF.setPALevel(RF24_PA_LOW);
      // nastavení zapisovacího a čtecího kanálu
      nRF.openWritingPipe(adresaVysilac);
      nRF.openReadingPipe(1,adresaPrijimac);
      // začátek příjmu dat
      nRF.startListening();
    }
    
    void loop() {
      // for smyčka pro postupné odeslání
      // hodnot 0 až 3 pro načtení všech dat
      // z přijímače
      for (int i=0; i < 4; i++ ) {
        // ukončení příjmu dat
        nRF.stopListening();
        // vytisknutí aktuální volby po sériové lince
        Serial.print("Posilam volbu ");
        Serial.println(i);
        // uložení startovního času komunikace
        unsigned long casZacatek = micros();
        // odeslání aktuální volby, v případě selhání
        // vytištění chybové hlášky na sériovou linku
        if (!nRF.write( &i, sizeof(i) )){
           Serial.println("Chyba při odeslání!");
        }
        nRF.startListening();
        unsigned long casCekaniOdezvy = micros();
        boolean timeout = false;
        while ( ! nRF.available() ){
        if (micros() - casCekaniOdezvy > 200000 ){
              timeout = true;
              break;
          }      
        }
        if ( timeout ){
          Serial.println("Chyba při prijmu, vyprseni casu na odezvu!");
        }
        else{
         
            unsigned long prijataData;
            nRF.read( &prijataData, sizeof(prijataData) );
            unsigned long casKonec = micros();
            Serial.print("Odeslana volba: ");
            Serial.print(i);
            Serial.print(", prijata data: ");
            Serial.println(prijataData);
            Serial.print("Delka spojeni: ");
            Serial.print(casKonec - casZacatek);
            Serial.println(" mikrosekund.");
        }
        delay(200);
      }
    }
    

    Receiver tester (This is not a program for the Airsoft WiFi project! - The project is paid)

    //nRF24L01 + PA + LNA - Receiver tester
    //Author: Martin Chlebovec (martinius96)
    //Web: https://arduino.php5.sk
    //Donate: https://paypal.me/chlebovec
    
    #include <SPI.h>
    #include "RF24.h"
    int prijem;
    const int buzzer = 2;
    #define CE 4
    #define CS 3
    RF24 nRF(CE, CS);
    byte adresaPrijimac[] = "prijimac00";
    byte adresaVysilac[] = "vysilac00";
    void setup() {
      Serial.begin(9600);
      pinMode(buzzer, OUTPUT);
      nRF.begin();
      nRF.setDataRate( RF24_250KBPS );
      nRF.setPALevel(RF24_PA_LOW);
      nRF.openWritingPipe(adresaPrijimac);
      nRF.openReadingPipe(1, adresaVysilac);
      nRF.startListening();
    }
    
    void loop() {
      unsigned long odezva;
      if ( nRF.available()) {
        // čekání na příjem dat
        while (nRF.available()) {
          nRF.read( &prijem, sizeof(prijem) );
        }
        Serial.print("Prijata volba: ");
        Serial.print(prijem);
        switch ( prijem ) {
          case 1:
    
            odezva = millis();
    
            tone(buzzer, 50, 500);
    
            break;
          case 2:
            odezva = millis() / 1000;
            break;
          case 3:
            odezva = micros();
            break;
          default:
            odezva = 0;
            break;
        }
        nRF.stopListening();
        nRF.write( &odezva, sizeof(odezva) );
        nRF.startListening();
      }
    }