Hi,
I'm trying to make a remote control with nrf24l01 transmitter/receivers, and it works fine when I'm powering the transmitter with usb. However, when I power the transmitter with a battery (7.4v, 450 mAh), it stops sending data. If i start it using usb, then plug in the battery and then unplug the usb, it works but if i start it directly with the battery, it doesn't. So I don't think this has anything to do with the battery. Am I missing something ? I also have a 10uF capacitor to regulate the 3.3v sent from the arduino to the transmitter.
Thank you for your help
Edit : It's an Arduino nano. You can see two voltage regulators on the board but they are not connected, these were for previous tests.
Depending on the Nano (clone) there may or may not be a discrete 3v3 regulator on board. The 3v3 may be derived from the USB chip which is active only if there is a USB cable attached. Even then you normally get only about 50mA which is hardly enough for a radio.
Interesting is that you appear to have had some success with the Nano's 3v3 supply when using a USB cable because the NRF24L01 are usually very sensitive to under-powering.
I see so basically the regulator only activates if powered on with usb and doesn't deactivate if I switch to the battery without turning it off in the meantime, but it doesn't activate if I start it directly with the battery ? If I understood correctly, isn't there a way to activate the regulator in the code?
And I have a capacitor, doesn't it work?
Can you post a picture of the Nano (both sides) or a link to the vendor page where you ordered it. Interesting will be if it has a separate 3v3 regulator and what USB/UART chip it has. Also include the code that you have loaded onto it.
Nano doesnt give stable 3.3v bro (cloning board?) You need nice voltage regulator such as, AMS1117 3.3v or use NRF24L01 breakout as shown by @6v6gt (this is better).
If you use AMS1117 3.3v you can add 1uf at VIN and GND of the AMS1117 3.3v to help it stable. Here's the schematic diagram I recommended!
Make certain if the battery decrease the voltage so you need to connect the AMS VIN directly to the battery and Ground it to Nano board. (Note: 3.3v of nano board will give noise and unstable voltage).
Mine with AMS1117 3.3v (SMD) (NO problem appears, works like champ!)
Here it the code !
I'll edit my post to show a picture of the project
#include <SPI.h>
#include <nRF24L01.h>
#include <RF24.h>
#include <Wire.h>
#include <printf.h>
int timer = 0;
// Define the digital inputs
#define b1 2 // Button 1
#define b2 3 // Button 2
#define b3 4 // Button 3
RF24 radio(9, 10); // nRF24L01 (CE, CSN)
const byte address[6] = {0x30, 0x31, 0x30, 0x30, 0x31}; // Address: "00001"
// Max size of this struct is 32 bytes - NRF24L01 buffer limit
struct Data_Package {
byte j1PotY;
byte j2PotX;
byte j2PotY;
byte button1;
byte button2;
byte button3;
};
Data_Package data; //Create a variable with the above structure
void setup() {
Serial.begin(9600);
printf_begin();
// Define the radio communication
radio.begin();
radio.openWritingPipe(address);
radio.setChannel(76); // on transmitter
radio.setAutoAck(false);
radio.setDataRate(RF24_250KBPS);
radio.setPALevel(RF24_PA_LOW);
radio.stopListening(); // Must be in TX mode to send
delay(5);
radio.printDetails();
// Activate the Arduino internal pull-up resistors
pinMode(b1, INPUT_PULLUP);
pinMode(b2, INPUT_PULLUP);
pinMode(b3, INPUT_PULLUP);
// Set initial default values
// Values from 0 to 255. When Joystick is in resting position, the value is in the middle, or 127. We actually map the pot value from 0 to 1023 to 0 to 255 because that's one BYTE value
data.j1PotY = 127;
data.j2PotX = 127;
data.j2PotY = 127;
data.button1 = 1;
data.button2 = 1;
data.button3 = 1;
}
void loop() {
// Read all analog inputs and map them to one Byte value
data.j1PotY = map(analogRead(A1), 0, 1023, 0, 255);
data.j2PotX = map(analogRead(A2), 0, 1023, 0, 255);
data.j2PotY = map(analogRead(A3), 0, 1023, 0, 255);
data.button1 = digitalRead(b1);
data.button2 = digitalRead(b2);
data.button3 = digitalRead(b3);
// Send the whole data from the structure to the receiver
radio.write(&data, sizeof(Data_Package));
print_info();
}
void print_info(){
timer++;
if (timer>6000){
Serial.println(data.j1PotY);
Serial.println(data.j2PotX);
Serial.println(data.j2PotY);
Serial.println(data.button1);
Serial.println(data.button2);
Serial.println(data.button3);
timer = 0;
}
}