[ sorry for poor English ]
I'm doing my rf remote project with Arduino nano and nrf24l01,,, i have a trouble with it... When i press any one button on the transmitter side, it working fine,
( The output voltage of particular pin gives 4.8volt (say 5volt))
But press more than one button (2 or 3 etc), the voltage droped at the receiving end pins
What that error, and how to solve this problem...
Results:
Condition 1: [ok]
Switch Pin 1 - Press
Relay Pin 1's output - 4.8volt
Relay pin 2's output - 0 volt
Relay pin 3's output - 0 volt
Switch Pin 2 - Press
Relay Pin 1's output - 0volt
Relay pin 2's output - 4.8 volt
Relay pin 3's output - 0 vol
Switch Pin 3 - Press
Relay Pin 1's output - 0volt
Relay pin 2's output - 0 volt
Relay pin 3's output - 4.8 volt
Condition 2:
Switch Pin 1 and switch Pin 2 press at same time,
Relay pin 1's output - 2.4 volt
Relay pin 2's output - 2.4 volt
Relay pin 3's output - 0 volt
Condition 3:
Switch Pin 1 and switch Pin 2 press and Switch Pin 3 at same time,
Relay Pin 1's output - 1.2volt
Relay pin 2's output - 1.2 volt
Relay pin 3's output - 1.2volt
</>
// Transmitter
#include <SPI.h>
#include "RF24.h"
int msg[1];
RF24 radio(9,10); // nRF Module Communication pins
const uint64_t pipe = {0xF0F0F0F000LL}; // Start communication pipe
int Switch1 = 2;
int Switch2 = 3;
int Switch3 = 4;
void setup()
{
radio.begin();
radio.setDataRate(RF24_250KBPS); // Transmission bitrate
radio.setChannel(100); // Channel ID
radio.setRetries(15,15);
radio.openWritingPipe(pipe); // Tx Mode enabled
radio.openReadingPipe(1, pipe); // Rx Mode disabled
radio.startListening();
}
void loop()
{
if (digitalRead(Switch1) == HIGH)
{
msg[0] = 111;
radio.write(msg, 1);
}
if (digitalRead(Switch2) == HIGH)
{
msg[0] = 112;
radio.write(msg, 1);
}
if (digitalRead(Switch3) == HIGH)
{
msg[0] = 113;
radio.write(msg, 1);
}
}
</>
//Reciver code
#include <SPI.h>
#include "RF24.h"
int msg[1];
RF24 radio(9,10); // nRF Module Communication pins
const uint64_t pipe = {0xF0F0F0F000LL}; // Start communication pipe
int Relay1 = 2;
int Relay2 = 3;
int Relay3 = 4;
void setup()
{
radio.begin();
radio.setDataRate(RF24_250KBPS); // Transmission bitrate
radio.setChannel(100); // Channel ID
radio.setRetries(15,15);
radio.openWritingPipe(pipe); // Tx Mode disabled
radio.openReadingPipe(1, pipe); // Rx Mode enabled
radio.startListening();
pinMode(Relay1, OUTPUT);
pinMode(Relay2, OUTPUT);
pinMode(Relay3, OUTPUT);
}
void loop()
{
if (radio.available())
{
bool done = false;
while (!done)
{
done = radio.read(msg, 1);
if (msg[0] == 111)
{
digitalWrite(Relay1, HIGH);
}
else
{
delay (1);
digitalWrite(Relay1, LOW);
}
if (msg[0] == 112)
{
digitalWrite(Relay1, HIGH);
}
else
{
delay (1);
digitalWrite(Relay1, LOW);
}
if (msg[0] == 113)
{
digitalWrite(Relay3, HIGH);
}
else
{
delay (1);
digitalWrite(Relay3, LOW);
}
}
}
else
{
digitalWrite(Relay1, LOW);
digitalWrite(Relay2, LOW);
digitalWrite(Relay3, LOW);
}
}