I want to make real life Street light monitoring system.Control street light I want mesh network .please someone tells me can I make mesh network of nrf24l01 ?
I want use this for street light control. I will send signal to light also I will send light working condition to server.so I am using
nrf24l01 module.I try for one way communication .this work successfully. But I can't communicate bidirectionally .please help me.
Transmitter code:
#include <SPI.h>
#include <nRF24L01.h>
#include <RF24.h>
#define led 12
RF24 radio(7, 8); // CNS, CE
const byte addresses[][6] = {"00001", "00002"};
boolean buttonState = 0;
void setup() {
pinMode(12, OUTPUT);
radio.begin();
radio.openWritingPipe(addresses[1]); // 00001
radio.openReadingPipe(1, addresses[0]); // 00002
radio.setPALevel(RF24_PA_MIN);
}
void loop() {
delay(5);
radio.stopListening();
int potValue = analogRead(A0);
int angleValue = map(potValue, 0, 1023, 0, 180);
radio.write(&angleValue, sizeof(angleValue));
delay(5);
radio.startListening();
while (!radio.available());
radio.read(&buttonState, sizeof(buttonState));
if (buttonState == HIGH) {
digitalWrite(led, HIGH);
}
else {
digitalWrite(led, LOW);
}
}
Receiver code:
#include <SPI.h>
#include <nRF24L01.h>
#include <RF24.h>
#include <Servo.h>
#define button 4
RF24 radio(7, 8); // CNS, CE
const byte addresses[][6] = {"00001", "00002"};
Servo myServo;
boolean buttonState = 0;
void setup() {
pinMode(button, INPUT);
myServo.attach(5);
radio.begin();
radio.openWritingPipe(addresses[0]); // 00002
radio.openReadingPipe(1, addresses[1]); // 00001
radio.setPALevel(RF24_PA_MIN);
}
void loop() {
delay(5);
radio.startListening();
if ( radio.available()) {
while (radio.available()) {
int angleV = 0;
radio.read(&angleV, sizeof(angleV));
myServo.write(angleV);
}
delay(5);
radio.stopListening();
buttonState = digitalRead(button);
radio.write(&buttonState, sizeof(buttonState));
}
}
AshwiniGunjal:
I want use this for street light control. I will send signal to light also I will send light working condition to server.so I am using
nrf24l01 module.I try for one way communication .this work successfully. But I can't communicate bidirectionally .please help me.
Have you carefully studied the link in Reply #1. Your program in Reply #2 suggests that you did not.
This Simple nRF24L01+ Tutorial may help - but it does not use the Mesh feature.
...R
This thread is not about mesh networking, but does show how to do 2 way communication.
Rats, beat me to it, Robin2. Great minds?
LoRa seems to be the current best-practise. I think Nordic do make LoRa modules. Search around - you will be surprised at the technology that already exists for this task.
groundfungus:
This thread is not about mesh networking, but does show how to do 2 way communication.Rats, beat me to it, Robin2. Great minds?
yes This thread is about Bidirectional communication.Before going toward mesh I tried for Bidirectional communication.
AshwiniGunjal:
Before going toward mesh I tried for Bidirectional communication.
You are making it very difficult to help you. You are not sharing information.
- What happened when you tried bi-directional communication?
- Was that working?
- In what way does it not meet your requirement so that you need to extend to the Mesh system?
...R