Project is not available for free download! If you are interested in purchasing the software part of the project with the functionality described on the given page, contact: martinius96@gmail.com
Zakúpiť projekt / Buy project
Arduino NRF24L01+PA+LNA Schematics WiFi LCD Capture point Eagle Airsoft Paintball Nerf Wars

Wifi points over Arduino Nano


Used hardware:

  • Arduino NanoEthernet Shield Wiznet W5100
  • Nrf24l01 + PA + LNA
  • Pushbuttons
  • LED diodes
  • Buzzer
  • Description of functionality and use:

  • The system is designed for Airsoft / Paintball / Nerf Wars for Capture point game mode.
  • The system uses the Arduino Nano pair for the 2 points that players are fighting on, each of the boards being two diodes, two detectors, two wifi modules nRF24l01 + PA + LNA. In addition to these components, the buttons for each of the teams are also placed on the boards.
  • One button is for Team 1 (yellow team) and second for Team 2 (red team). In the event of a cast, they press their button to change the color of the point according to their team.
  • If one team occupies both points, the detector sounds at both points (the game ends or continues according to the organizer"s rules). This may mean, for example, only the end of the round or the addition of points. In real-time, both Arduina communicate with the nRF24l01 + PA + LNA modules. The response between the two Arduins is at 1-5ms.
  • Thanks to the nRF24l01 modules, it is possible to communicate with Arduin at huge distances of hundreds of meters in an uninterrupted environment (nRF24l01 offers over 120 channels for communication to 2.4Ghz.) With an external 5v / 3.3v source it is possible to communicate up to 1.1 kilometers.
  • Scheme:

    Schéma zapojenia - Arduino Nano s WiFi komunikačným modulom NRF24l01 + PA + LNA

    Transmitter tester (This is not code for Airsoft WiFi project! - project is paid)

    //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_HIGH);
      // 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 code for Airsoft WiFi project! - 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_HIGH);
      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();
      }
    }