2 NRF 24l01 and arduino UNO Project

Discussion in 'Wireless & RF Design' started by yatindeshpande77, Jan 6, 2016.

  1. yatindeshpande77

    Thread Starter Member

    Dec 20, 2015
    38
    0
    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 (Text):
    1. /* YourDuinoStarter Example: nRF24L01 Transmit Joystick values
    2. - WHAT IT DOES: Reads Analog values on A0, A1 and transmits
    3.    them over a nRF24L01 Radio Link to another transceiver.
    4. - SEE the comments after "//" on each line below
    5. - CONNECTIONS: nRF24L01 Modules See:
    6. http://arduino-info.wikispaces.com/Nrf24L01-2.4GHz-HowTo
    7.    1 - GND
    8.    2 - VCC 3.3V !!! NOT 5V
    9.    3 - CE to Arduino pin 9
    10.    4 - CSN to Arduino pin 10
    11.    5 - SCK to Arduino pin 13
    12.    6 - MOSI to Arduino pin 11
    13.    7 - MISO to Arduino pin 12
    14.    8 - UNUSED
    15.    -
    16.    Analog Joystick or two 10K potentiometers:
    17.    GND to Arduino GND
    18.    VCC to Arduino +5V
    19.    X Pot to Arduino A0
    20.    Y Pot to Arduino A1
    21.  
    22. - V1.00 11/26/13
    23.    Based on examples at http://www.bajdi.com/
    24.    Questions: terry@yourduino.com */
    25.  
    26. /*-----( Import needed libraries )-----*/
    27. #include <SPI.h>
    28. #include <nRF24L01.h>
    29. #include <RF24.h>
    30. /*-----( Declare Constants and Pin Numbers )-----*/
    31. #define CE_PIN   9
    32. #define CSN_PIN 10
    33. #define JOYSTICK_X A0
    34. #define JOYSTICK_Y A1
    35.  
    36. // NOTE: the "LL" at the end of the constant is "LongLong" type
    37. const uint64_t pipe = 0xE8E8F0F0E1LL; // Define the transmit pipe
    38.  
    39.  
    40. /*-----( Declare objects )-----*/
    41. RF24 radio(CE_PIN, CSN_PIN); // Create a Radio
    42. /*-----( Declare Variables )-----*/
    43. int joystick[2];  // 2 element array holding Joystick readings
    44.  
    45. void setup()   /****** SETUP: RUNS ONCE ******/
    46. {
    47.   Serial.begin(9600);
    48.   radio.begin();
    49.   radio.openWritingPipe(pipe);
    50. }//--(end setup )---
    51.  
    52.  
    53. void loop()   /****** LOOP: RUNS CONSTANTLY ******/
    54. {
    55.   joystick[0] = analogRead(JOYSTICK_X);
    56.   joystick[1] = analogRead(JOYSTICK_Y);
    57.  
    58.   radio.write( joystick, sizeof(joystick) );
    59.  
    60. }//--(end main loop )---
    61.  
    62. /*-----( Declare User-written Functions )-----*/
    63.  
    64. //NONE
    65. //*********( THE END )***********
    RX:-

    Code (Text):
    1. /* YourDuinoStarter Example: nRF24L01 Receive Joystick values
    2.  
    3. - WHAT IT DOES: Receives data from another transceiver with
    4.    2 Analog values from a Joystick or 2 Potentiometers
    5.    Displays received values on Serial Monitor
    6. - SEE the comments after "//" on each line below
    7. - CONNECTIONS: nRF24L01 Modules See:
    8. http://arduino-info.wikispaces.com/Nrf24L01-2.4GHz-HowTo
    9.    1 - GND
    10.    2 - VCC 3.3V !!! NOT 5V
    11.    3 - CE to Arduino pin 9
    12.    4 - CSN to Arduino pin 10
    13.    5 - SCK to Arduino pin 13
    14.    6 - MOSI to Arduino pin 11
    15.    7 - MISO to Arduino pin 12
    16.    8 - UNUSED
    17.  
    18. - V1.00 11/26/13
    19.    Based on examples at http://www.bajdi.com/
    20.    Questions: terry@yourduino.com */
    21.  
    22. /*-----( Import needed libraries )-----*/
    23. #include <SPI.h>
    24. #include <nRF24L01.h>
    25. #include <RF24.h>
    26. /*-----( Declare Constants and Pin Numbers )-----*/
    27. #define CE_PIN   9
    28. #define CSN_PIN 10
    29.  
    30. // NOTE: the "LL" at the end of the constant is "LongLong" type
    31. const uint64_t pipe = 0xE8E8F0F0E1LL; // Define the transmit pipe
    32.  
    33.  
    34. /*-----( Declare objects )-----*/
    35. RF24 radio(CE_PIN, CSN_PIN); // Create a Radio
    36. /*-----( Declare Variables )-----*/
    37. int joystick[2];  // 2 element array holding Joystick readings
    38.  
    39. void setup()   /****** SETUP: RUNS ONCE ******/
    40. {
    41.   Serial.begin(9600);
    42.   delay(1000);
    43.   Serial.println("Nrf24L01 Receiver Starting");
    44.   radio.begin();
    45.   radio.openReadingPipe(1,pipe);
    46.   radio.startListening();;
    47. }//--(end setup )---
    48.  
    49.  
    50. void loop()   /****** LOOP: RUNS CONSTANTLY ******/
    51. {
    52.   if ( radio.available() )
    53.   {
    54.     // Read the data payload until we've received everything
    55.     bool done = false;
    56.     while (!done)
    57.     {
    58.       // Fetch the data payload
    59.       done = radio.read( joystick, sizeof(joystick) );
    60.       Serial.print("X = ");
    61.       Serial.print(joystick[0]);
    62.       Serial.print(" Y = ");    
    63.       Serial.println(joystick[1]);
    64.     }
    65.   }
    66.   else
    67.   {  
    68.       Serial.println("No radio available");
    69.   }
    70.  
    71. }//--(end main loop )---
    72.  
    73. /*-----( Declare User-written Functions )-----*/
    74.  
    75. //NONE
    76. //*********( THE END )***********
    77.  
     
  2. sailorjoe

    Member

    Jun 4, 2013
    361
    63
    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?
     
  3. yatindeshpande77

    Thread Starter Member

    Dec 20, 2015
    38
    0
    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: Jan 7, 2016
Loading...