2 NRF 24l01 and arduino UNO Project

Thread Starter

yatindeshpande77

Joined Dec 20, 2015
38
Hi guys,
As I found the drawbacks of simple 433 & 315Mhz modules I decide to switch in next module i.e. NRF24L01.
My objective of project::-
I want to make 10 TX-RX pairs of wireless system which could operate simultaneously!
These 10 pairs will be in within 50 meter of range so either I need different channel of operation to let them work simultaneously or some thing different! I read that RF_CH register can make a channel selection but I didnt get depth of that register and how can i command it from uc to NRF?
Basically it is going to be used in screw tightning system where once it gets tighted it will connect switch giving pulse which will send to corrosponding rx then opperator will take tx and will tight next screw each opperator will have one tx and his one rx pair!
SO how can i make it in more power saving way?

How much I made to work:-
I am using arduino UNO pair and I was lucky that I got proper libraries!
I am able to establish communication link between a pair of NRF
My code is:-
TX:-

Code:
/* YourDuinoStarter Example: nRF24L01 Transmit Joystick values
- WHAT IT DOES: Reads Analog values on A0, A1 and transmits
   them over a nRF24L01 Radio Link to another transceiver.
- SEE the comments after "//" on each line below
- CONNECTIONS: nRF24L01 Modules See:
http://arduino-info.wikispaces.com/Nrf24L01-2.4GHz-HowTo
   1 - GND
   2 - VCC 3.3V !!! NOT 5V
   3 - CE to Arduino pin 9
   4 - CSN to Arduino pin 10
   5 - SCK to Arduino pin 13
   6 - MOSI to Arduino pin 11
   7 - MISO to Arduino pin 12
   8 - UNUSED
   -
   Analog Joystick or two 10K potentiometers:
   GND to Arduino GND
   VCC to Arduino +5V
   X Pot to Arduino A0
   Y Pot to Arduino A1
  
- V1.00 11/26/13
   Based on examples at http://www.bajdi.com/
   Questions: terry@yourduino.com */

/*-----( Import needed libraries )-----*/
#include <SPI.h>
#include <nRF24L01.h>
#include <RF24.h>
/*-----( Declare Constants and Pin Numbers )-----*/
#define CE_PIN   9
#define CSN_PIN 10
#define JOYSTICK_X A0
#define JOYSTICK_Y A1

// NOTE: the "LL" at the end of the constant is "LongLong" type
const uint64_t pipe = 0xE8E8F0F0E1LL; // Define the transmit pipe


/*-----( Declare objects )-----*/
RF24 radio(CE_PIN, CSN_PIN); // Create a Radio
/*-----( Declare Variables )-----*/
int joystick[2];  // 2 element array holding Joystick readings

void setup()   /****** SETUP: RUNS ONCE ******/
{
  Serial.begin(9600);
  radio.begin();
  radio.openWritingPipe(pipe);
}//--(end setup )---


void loop()   /****** LOOP: RUNS CONSTANTLY ******/
{
  joystick[0] = analogRead(JOYSTICK_X);
  joystick[1] = analogRead(JOYSTICK_Y);
 
  radio.write( joystick, sizeof(joystick) );

}//--(end main loop )---

/*-----( Declare User-written Functions )-----*/

//NONE
//*********( THE END )***********
RX:-

Code:
/* YourDuinoStarter Example: nRF24L01 Receive Joystick values

- WHAT IT DOES: Receives data from another transceiver with
   2 Analog values from a Joystick or 2 Potentiometers
   Displays received values on Serial Monitor
- SEE the comments after "//" on each line below
- CONNECTIONS: nRF24L01 Modules See:
http://arduino-info.wikispaces.com/Nrf24L01-2.4GHz-HowTo
   1 - GND
   2 - VCC 3.3V !!! NOT 5V
   3 - CE to Arduino pin 9
   4 - CSN to Arduino pin 10
   5 - SCK to Arduino pin 13
   6 - MOSI to Arduino pin 11
   7 - MISO to Arduino pin 12
   8 - UNUSED
  
- V1.00 11/26/13
   Based on examples at http://www.bajdi.com/
   Questions: terry@yourduino.com */

/*-----( Import needed libraries )-----*/
#include <SPI.h>
#include <nRF24L01.h>
#include <RF24.h>
/*-----( Declare Constants and Pin Numbers )-----*/
#define CE_PIN   9
#define CSN_PIN 10

// NOTE: the "LL" at the end of the constant is "LongLong" type
const uint64_t pipe = 0xE8E8F0F0E1LL; // Define the transmit pipe


/*-----( Declare objects )-----*/
RF24 radio(CE_PIN, CSN_PIN); // Create a Radio
/*-----( Declare Variables )-----*/
int joystick[2];  // 2 element array holding Joystick readings

void setup()   /****** SETUP: RUNS ONCE ******/
{
  Serial.begin(9600);
  delay(1000);
  Serial.println("Nrf24L01 Receiver Starting");
  radio.begin();
  radio.openReadingPipe(1,pipe);
  radio.startListening();;
}//--(end setup )---


void loop()   /****** LOOP: RUNS CONSTANTLY ******/
{
  if ( radio.available() )
  {
    // Read the data payload until we've received everything
    bool done = false;
    while (!done)
    {
      // Fetch the data payload
      done = radio.read( joystick, sizeof(joystick) );
      Serial.print("X = ");
      Serial.print(joystick[0]);
      Serial.print(" Y = ");     
      Serial.println(joystick[1]);
    }
  }
  else
  {   
      Serial.println("No radio available");
  }

}//--(end main loop )---

/*-----( Declare User-written Functions )-----*/

//NONE
//*********( THE END )***********
 

sailorjoe

Joined Jun 4, 2013
365
The library you're using has a function to set and get the channel. Do you see that in the RF24.h file?

By the way, are all the screws being driven in at the same time, or just one at a time?
 

Thread Starter

yatindeshpande77

Joined Dec 20, 2015
38
Yes they could be! But I solve that problem by selecting different channel over register setting!
Basically I am using 2 NRF24l01 with 2 UNO where one is used for transmitting and other for RX!
My basic objective is I want to transmit signal (same signal) to receiver side when a single button is pressed ( this will happen when screw get tighten and it will be pressed for 20ms on approx)
My receiver will be at wall so will be powered using mains but my transmitter will be handheld so I have to power it with battery!
Now to increase battery life I want to put my TX arduino and NRF in power down mode and i will wake up my arduino with interrupt over pin change.
Now my problem is How I could wake up NRF module I saw few example of it but they used watchdog as there need was periodic but in my project I cant predict intervals so watchdog will be of no use!
So any body know how to make NRF wake up with micro controller, or is any command arrive from uC will wake it up?
If there is any good link by reading it I could get better approach or inputs then please tell me!
 
Last edited:
Top