Go Down

Topic: NRF24L01 2.4ghz wireless on arduino (Read 11689 times) previous topic - next topic

josephchrzempiec

Hello i have a question i been looking into wireless setups to send the wireless signal from one room to another room but not sure what one to choose from the rf315mhz is one of them i have seems to work can can only use one pair at a time. also have a 433mhz rf works same way just a stronger signal  better range. but another wireless device module NRF24L01  2.4ghz Wireless RF Transceiver Module  which i found on ebay from what I'm reading they can send a signal and receive a signal. better and longer range then the 433mhz and the 315 mhz rf. but what I'm stuck on in my project i have 3 rooms with a button in each room  and a forth arduino  that i want to receive the signal form each one and light up 3 different leds each led from one of the room. so my question is if anyone has NRF24L01 module on each transmitting side and a single one on the receive side with the leds can it tell in sketch which one comes from where? can someone help me out please sorry new to this and trying to get more information about the NRF24L01 module?

fungus


my question is if anyone has NRF24L01 module on each transmitting side and a single one on the receive side with the leds can it tell in sketch which one comes from where? can someone help me out please sorry new to this and trying to get more information about the NRF24L01 module?


The NRF24L01+ is very commonly used with Arduinos. A quick google search will give you thousands of pages.

There's even a playground page for them: http://playground.arduino.cc/InterfacingWithHardware/Nrf24L01
Advanced Arduino

josephchrzempiec

#2
Aug 25, 2014, 02:46 pm Last Edit: Aug 25, 2014, 02:49 pm by josephchrzempiec Reason: 1
hello fungus thank you yes i  found many topics on the NRF24L01  module and tut but what i can't find if it be able to run 2 or more transmitting  to a single receiving  nrf24l01 module or only a single NRF24L01  for transmitting and NRF24L01  receiving NRF24L01 module?

fungus


hello fungus thank you yes i  found many topics on the NRF24L01  module and tut but what i can't find if it be able to run 2 or more transmitting  to a single receiving  nrf24l01 module or only a single NRF24L01  for transmitting and NRF24L01  receiving NRF24L01 module?


An NRF24L01  can listen to six transmitters simultaneously. See the "MultiCeiver" section of the datasheet.


Advanced Arduino

josephchrzempiec

oh awesome thank you  I'm thinking about investing in like 4 of them  the cost on ebay is real cheap from china 10 of them for 6 dollars us. but what happens if you want to use more then 6 i guess you will need a second receiver to pick up the next 6?

josephchrzempiec

hello fungus thank you for the information on the rf transmitting and receiving i found this video on youtube  to help me with this i have a hard time learning new thing but  the information in his video help me also have some pretty cool examples on how to turn on 2 leds from one transmitter to a single receiver  i have tested it and i was amazed on the range of the rf line to sight i got 70 ft i didn't go any more then that just to test and around walls and brick walls it tested up to 50 ft and worked perfectly theses rf modules are awesome. This is the video https://www.youtube.com/watch?v=aJVSrGwZs2s now it's in Russian but that is okay. only  if i can find the way to add more on the transmitting side i mean add 3 or 4 more modules for transmitting and the 1 receiving  can light up some more leds i be  almost finished with my home automated project. i live in a apartment complex where we can not run wires so only way is wireless and so far i love these modules.


Joseph

MarkT


oh awesome thank you  I'm thinking about investing in like 4 of them  the cost on ebay is real cheap from china 10 of them for 6 dollars us. but what happens if you want to use more then 6 i guess you will need a second receiver to pick up the next 6?


So long as all your devices aren't transmitting continuously and colliding packets all the time
you can use as many as you want really, its radio!

You will have to code an ID for each station though, in order to identify it, and transmit
this with each packet - you would be starting to build an an-hoc wireless network.

Have a look for existing WSN implementations out there, one of them might be just what
you need.  If you don't know what WSN means google it and you'll see!
[ I DO NOT respond to personal messages, I WILL delete them unread, use the forum please ]

josephchrzempiec

#7
Sep 05, 2014, 08:58 pm Last Edit: Sep 10, 2014, 10:45 am by josephchrzempiec Reason: 1
well this is more for lighting control with Pir sensors with the nrf24. and switches to turn off and on things. all are transmitting not receiving.  just one single receiver.  but  not all at once.

josephchrzempiec

#8
Sep 10, 2014, 06:20 am Last Edit: Sep 10, 2014, 07:55 am by josephchrzempiec Reason: 1
i mange to get the NRF2401 to transmit on one  module and Receive one a second module with the code below.

Transmit sketch

Code: [Select]

#include <SPI.h>

#include "nRF24L01.h"

#include "RF24.h"

int msg[1];

// Set up nRF24L01 radio on SPI bus plus pins 9 & 10

//Contacts from the radio to connect NRF24L01 pinamnam -> Arduino

//SCK -> 13

//MISO -> 12

//MOSI -> 11

//CSN -> 10

//CE -> 9

RF24 radio(9,10);

const uint64_t pipe = 0xE8E8F0F0E1LL; // fax transmission channel

//button connected to these pins

int buttonPin1 = 2;

int buttonPin2 = 3;

void setup(void){

radio.begin();

radio.openWritingPipe(pipe); // Open channel

}

void loop(void){

//until the button (buttonPin1) pressed send the package (111) Arduino ?2

if (digitalRead(buttonPin1) == HIGH){

msg[0] = 111;

radio.write(msg, 1);

}

if (digitalRead(buttonPin2) == HIGH){

msg[0] = 112;

radio.write(msg, 1);

}

}





and this is the receive sketch


Code: [Select]

#include <SPI.h>

#include "nRF24L01.h"

#include "RF24.h"

int msg[1];

// Set up nRF24L01 radio on SPI bus plus pins 9 & 10

//Contacts from the radio to connect NRF24L01 pinamnam -> Arduino

//SCK -> 13

//MISO -> 12

//MOSI -> 11

//CSN -> 10

//CE -> 9

RF24 radio(9,10);

const uint64_t pipe = 0xE8E8F0F0E1LL; // channel address

//LEDs connected to these pins

int LEDpin1 = 2;

int LEDpin2 = 3;

void setup(void){
 Serial.begin(9600);  
 
radio.begin();

radio.openReadingPipe(1,pipe); // Open one of the 6-channel reception

radio.startListening(); //Begin to listen

pinMode(LEDpin1, OUTPUT);

pinMode(LEDpin2, OUTPUT);

}

void loop(void){

if (radio.available()){

bool done = false;

while (!done){

done = radio.read(msg, 1);

//if the packet came from Arduino ?1 (111), the LED (lights) LEDpin1, HIGH

if (msg[0] == 111){

delay(10);

digitalWrite(LEDpin1, HIGH);
Serial.println("Led 1 On");
}

else {

digitalWrite(LEDpin1, LOW);
Serial.println("Led 1 Off");
}

delay(10);

if (msg[0] == 112){

delay(10);

digitalWrite(LEDpin2, HIGH);
Serial.println("Led 2 On");
}

else {

digitalWrite(LEDpin2, LOW);
Serial.println("Led 2 Off");
}

delay(10);

}

}

}



and works but i can not figure out how to gets a Third module to transmit to the receiver.  can someone please help me out not even sure what to do to extend the sketch. when i add the same sketch to the third module  i can hit a button from the third module and it shows the same leds turn on in the receiver but not the new leds. i added. I really need help can some one help me please?

josephchrzempiec

i still can't figure out how to get more nrf24l01 to transmit to the single receiver. i can do a 1 on 1 but that's all. does anyone know how to can transmit  one or two more transmitter of a single push button on each one?

MarkT

Im tempted to say forget pipes, they're a complication, just send a simple packet -
then everyone can listen to everyone.  My memory is vague, I think there's a broadcase
mode for pipes anyway?  In the datasheet its called "Enhanced ShockBurst(tm)" which
is marketing tripe to my mind - its just some support for packet-retry that can be viewed
as a help or a hinderance depending on how you want to arrange things.

Program a unique code in the EEPROM of each Arduino that can be used as an identifier
for the sender.  As I said its ad-hoc networking, so read up about WSNs.  You'll learn
more doing it yourself anyway.  IMO, that is.
[ I DO NOT respond to personal messages, I WILL delete them unread, use the forum please ]

WendoNZ

For these radios typically you have a pipe open on the receiver for each sender to a max of 6, as the comments in the code indicate. S create 6 different pipes before calling startListening() and you should be able to receiver from multiple senders. I've never seen a broadcast mode of these. Typically if you need more than 6 senders you setup a mesh where the central unit has 6 connections, those 6 have up to 6 themselves etc

MarkT

Well I've used them without the shockburst stuff in order to get decent
throughput (768kb/s) in 1M baud rate (you can't do ack/retry per packet
at that rate, and its simpler.

If you need retry and acks anyway per packet, use it, but there's nothing
difficult about putting source and destination id's in a packet in software.
You get to choose the size of the id's too.
[ I DO NOT respond to personal messages, I WILL delete them unread, use the forum please ]

fungus


Well I've used them without the shockburst stuff in order to get decent
throughput (768kb/s) in 1M baud rate (you can't do ack/retry per packet
at that rate, and its simpler.


Unless you're trying to use multiple senders. Which he is.
Advanced Arduino

josephchrzempiec

this is what I'm trying to do. i have total of 6 NRF24l01 i have 1  just receiving and 5 just for transmitting each one of the transmitter ones have a push button on them  and on the receiver one haves 5 LED what I'm trying to do is when one of the transmitting side hits the button say transmitter one that the receiver side on led 1 turns on and is button is released then the led 1 turns off same with transmitter 2,3,4 and 5  does the same thing turns on 2,3,4 and 5 on the receiver side. not all transmitting at the same time that's is my current goal right now something simple as the leds to turn on.

Go Up