I am trying to embark on a project using 3 to 5 arduino to communicate together using NRF24 . The project is about having one arduino communicating with other arduino which can be used as a monitoring system, like monitoring if a door is closed or not and at same time monitoring if a light having been switch off or not and to be able to switch off the light from the first arduino and so on. I know its easy if every arduino communicates within range between each other but it becomes imposible if the range is exceeded.
So I thought what about if there is an arduino using NRF24 that act as a repeater, But the NRF24 does not do full duplexing, so I thought what if two NRF24 is connected to the proposed repeater so when the repeater receive from one NRF24 it will then send through the other NRF24.
I have very limited programming skills but if anybody out there have tried or can try or if possible at all.
From your description of the requirements, you only need one NRF24 on the repeater station. Timing shouldn't be an issue.
Start off with repeater in recv mode receiving and verifying packets from the sender, and the end receiver in recev mode waiting for a message from the repeater's ID.
When repeater receives correct message from transmitter, it changes mode to transmit and resends the message to the end receiver's ID.
End receiver then receives and verifies message from repeater and commits to proper response.
reverse the process if the sender requires verification of the action.
Are you referring to a " bucket brigade" or " domino chain" radio link with " n" radios ?
What is "n" ?
I did something similar with a mesh of RF24s that would each find their nearest neighbors and self-organise into a routing tree, but it was a pretty messy solution. After I got it working, I kind of wished I hadn't. There is an RF24Network library built on top of the RF24 library which provides a slightly more general addressing/forwarding scheme. This would probably do what you want, and that would be a better bet IMO.
So I tried this codes to see if it will work but it seems I am missing something.......... ![]()
This code is for the transmiter
#include <SPI.h>
#include "RF24.h"
int msg[1];
RF24 radio(9,10);
const uint64_t pipes[2] = {
0xF0F0F0F000LL, 0xF0F0F0F0FFLL};
int switchPin1 = 2;
void setup(void){
radio.begin();
radio.setDataRate(RF24_250KBPS);
radio.setChannel(100);
radio.setRetries(15,15);
radio.openWritingPipe(pipes[1]);
radio.openReadingPipe(1, pipes[0]);
radio.startListening();
}
void loop(void){
if (digitalRead(switchPin1) == HIGH){
msg[0] = 8;
radio.stopListening();
radio.write(msg, 1);
radio.startListening();
}
}
While this is for the REPEATER
#include <SPI.h>
#include "RF24.h"
int msg[1];
RF24 radio(9,10);
const uint64_t pipes[2] = {
0xF0F0F0F000LL, 0xF0F0F0F0FFLL};
void setup(void){
radio.begin();
radio.setDataRate(RF24_250KBPS);
radio.setChannel(100);
radio.setRetries(15,15);
radio.openWritingPipe(pipes[0]);
radio.openReadingPipe(1, pipes[1]);
radio.startListening();
}
void loop(void){
if (radio.available()){
bool done = false;
while (!done){
done = radio.read(msg, 1);
if (msg[0] == 8){
delay(10);
msg[0] = 5;
radio.stopListening();
radio.write(msg, 1);
radio.startListening();
}
delay(10);
}
}
}
THis is for the RECEIVER
#include <SPI.h>
#include "RF24.h"
int msg[1];
RF24 radio(9,10);
int LEDpin1 = 2;
const uint64_t pipes[2] = {
0xF0F0F0F000LL, 0xF0F0F0F0FFLL};
void setup(void){
radio.begin();
radio.setDataRate(RF24_250KBPS);
radio.setChannel(100);
radio.setRetries(15,15);
radio.openWritingPipe(pipes[0]);
radio.openReadingPipe(1, pipes[1]);
radio.startListening();
pinMode(LEDpin1, OUTPUT);
}
void loop(void){
if (radio.available()){
bool done = false;
while (!done){
done = radio.read(msg, 1);
if (msg[0] == 5){
delay(10);
digitalWrite(LEDpin1, HIGH);
}
else {
digitalWrite(LEDpin1, LOW);
delay(10);
}
}
}
}
I want to send 8 to the repeater which then send 5 to the receiver that lights up an led
Thanks peterH didn't see your post before posting my codes I will try and check that out...............internet, been messing up
Is it possble that one of the Arduinos is located where it can talk to all the others even if those at the extreme ends can't talk to each other. Like this - B can talk to A and C, but C can't talk to A.
A----------------------B--------------------------C
...R
Yes that is possible if they are at transmitting signal range......but I am looking for a solution where they (RF24) can still communicate even if the one at the other end cannot receive signal from the transmitter but instead another RF24 relays signal from the transmitter to the receiver
ati105:
Yes that is possible if they are at transmitting signal range......but I am looking for a solution where they (RF24) can still communicate even if the one at the other end cannot receive signal from the transmitter but instead another RF24 relays signal from the transmitter to the receiver
I understand what you have said, but I don't understand why. Doors don't usually change location so I don't understand why you can't predict the range between devices.
Can you give us an overall description of the project.
...R
Robin2:
I understand what you have said, but I don't understand why.
I think the point is that all the RF24s can reach each other indirectly but there is no single one which can reach all the others. This is the same problem that lead me to set up my mesh network.
I understand what you have said, but I don't understand why. Doors don't usually change location so I don't understand why you can't predict the range between devices.
Lets say the maximum distance between two RF24 is 2 meters and you are placing one RF24 at the door and the the other RF24 is about 4 meters away that means you will need another RF24 between them to relay a signal from RF24 at the door to the RF24 4 meters away.
Hope this is clear enough
Predicted, measured, absolute, distance between nodes is greater than reliable range of the individual nodes, hence the need for the 'bucket brigade' with the inserted repeater node.
Or spend more money and get nodes with greater ranges.
There are few problems, concievable by man, which cannot be resolved by sufficient application of force, be it mechanical, political (/military), and/or economic. Brute force solution may not be ellegant, but it usually works.
ati105:
Lets say the maximum distance between two RF24 is 2 meters
That seems an incredibly short range. I have some 2.4GHz transceivers and (though I haven't tested) I would expect the range to be 5 to 10 metres. But maybe you are allowing for obstacles (walls) between devices.
...R
That seems an incredibly short range. I have some 2.4GHz transceivers and (though I haven't tested) I would expect the range to be 5 to 10 metres. But maybe you are allowing for obstacles (walls) between devices.
Thats why I started with the sentence "let say", not the real distance, I know RF24 have longer range than 2 meters.
ati105:
Thats why I started with the sentence "let say", not the real distance, I know RF24 have longer range than 2 meters.
So how about some realism so that we can figure out what problem needs to be solved.
...R
I don't think 2-3 meters is completely unrealistic. Mine struggle to get through a brick wall and have a range of a few meters with direct line of sight. Even an internal partition wall cuts the range down significantly.
PeterH:
I don't think 2-3 meters is completely unrealistic.
Fair enough - I don't have the experience.
But it would be helpful if the OP could describe what he actually wants to do rather than posing purely theoretical questions.
If the range really is short maybe wireless is not the correct solution.
...R