Power hungry nRF24L01P + PA + LNA?

Hello people, im making a simple fixed wing controller. Basically, everything works perfectly until i enable power amplifier. My setup is, transmitter: Uno, SSD1306, 2 joysticks, 1 potentiometer, E01-ML01DP5 Ebyte (nRF24L01P + PA + LNA) with standard nrf adapter. Reciever (drone): Mega2560, 2 9g servos), also E01-ML01DP5 Ebyte (nRF24L01P + PA + LNA), 30A esc and motor. However i dont think receiver is problem here. When radio modules are set to "radio.setPALevel(RF24_PA_HIGH)" theres no communication. However if i disconnect transmitter and reconnect it, then once again upload the code it start working. I used to run transmitter on power bank (5v 1A) however as i imagine its not enough. It doesnt run unless i do the disconnect reconnect upload sequence. Should i use external power input for radio module? Also unplugging screen doesnt change anything.

heres radio model: https://pl.aliexpress.com/item/32783191387.html?spm=a2g0o.order_list.order_list_main.10.786d1c24bgamrX&gatewayAdapt=glo2pol

transmitter:

#include <SPI.h>
#include <RF24.h>
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>

#define SCREEN_WIDTH 128
#define SCREEN_HEIGHT 64

#define OLED_RESET 4
#define SCREEN_ADDRESS 0x3C

Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET);

RF24 radio(9, 10);

const byte address[6] = "00601";

struct sensorData {
  double numerPakietu;
  double wartoscroll;
  double wartoscpitch;
  double wartosctrims;
  double wartoscthrust;
} data;

void setup() {
  Serial.begin(57600);
  radio.setPALevel(RF24_PA_HIGH);
  if(!display.begin(SSD1306_SWITCHCAPVCC, SCREEN_ADDRESS)) {
    Serial.println(F("SSD1306 allocation failed"));
    for(;;);
  }

  display.display();
  delay(2000);
  display.clearDisplay();

  radio.begin();
  radio.openWritingPipe(address);
  pinMode(5, OUTPUT);
  pinMode(3, OUTPUT);
  digitalWrite(5, HIGH); 
  digitalWrite(3, HIGH); 
  radio.setDataRate(RF24_1MBPS);
}

void loop() {
  data.wartoscroll = analogRead(A0);
  data.wartoscpitch = analogRead(A1);
  data.wartosctrims = analogRead(A3);
  data.wartoscthrust = analogRead(A2);

  display.clearDisplay();
  display.setTextSize(1);
  display.setTextColor(SSD1306_WHITE);
  display.setCursor(0, 0);


  radio.write(&data, sizeof(data));

  display.print("Roll: ");
  display.println(int(data.wartoscroll));

  display.print("Pitch: ");
  display.println(int(data.wartoscpitch));

  display.print("Thrust: ");
  display.println(int(data.wartoscthrust));

  display.print("Trims: ");
  display.println(int(data.wartosctrims));


  display.print("Numer pakietu: ");
  display.println(int(data.numerPakietu));

  Serial.print("Wysłano numer pakietu: ");
  Serial.print(int(data.numerPakietu));
  Serial.print(", roll = ");
  Serial.print(int(data.wartoscroll));
  Serial.print(", pitch = ");
  Serial.print(int(data.wartoscpitch));
  Serial.print(", trims = ");
  Serial.print(int(data.wartosctrims));
  Serial.print(", thrust = ");
  Serial.println(int(data.wartoscthrust));

  data.numerPakietu = fmod((data.numerPakietu + 1), 256.0);

  display.display();
}

receiver:

#include <Servo.h>
#include <SPI.h>
#include <RF24.h>

Servo flaperon1;      
Servo flaperon2;      
Servo esc;       

RF24 radio(7, 8); 
const byte address[6] = "00601";

struct sensorData {
  double numerPakietu;
  double wartoscroll;
  double wartoscpitch;
  double wartosctrims;
  double wartoscthrust;
} receivedData;

void setup() {
  flaperon1.attach(36); 
  flaperon2.attach(38); 
  esc.attach(40);

  radio.begin();
  radio.openReadingPipe(1, address);
  radio.startListening();
  radio.setDataRate(RF24_1MBPS);
  radio.setPALevel(RF24_PA_MAX); 
  Serial.begin(57600);  
}

void loop() {
  if (radio.available()) {
    radio.read(&receivedData, sizeof(receivedData));

   
    int angleX = map(receivedData.wartoscroll, 0, 1023, -90, 90);  
    int angleY = map(receivedData.wartoscpitch, 0, 1023, -90, 90);   

    
    int trimY = map(receivedData.wartosctrims, 0, 1023, -90, 90);  // Zakres dla trymów
    angleY += trimY;

    
    angleY = constrain(angleY, -90, 90);

 
    int finalAngle1 = 90 + angleX - angleY;

   
    finalAngle1 = constrain(finalAngle1, 0, 180);

    flaperon1.write(finalAngle1);

  
    int finalAngle2 = 90 + angleX + angleY;

    finalAngle2 = constrain(finalAngle2, 0, 180);


    flaperon2.write(finalAngle2);

    int throttleValue = receivedData.wartoscthrust;
    int mappedThrottle = map(throttleValue, 511.5, 1023, 1480, 2000);

    mappedThrottle = constrain(mappedThrottle, 1480, 2000);

    esc.writeMicroseconds(mappedThrottle);

    Serial.print("Odebrano numer pakietu: ");
    Serial.print(int(receivedData.numerPakietu));
    Serial.print(", roll = ");
    Serial.print(int(receivedData.wartoscroll));
    Serial.print(", pitch = ");
    Serial.print(int(receivedData.wartoscpitch));
    Serial.print(", trims = ");
    Serial.print(int(receivedData.wartosctrims));
    Serial.print(", thrust = ");
    Serial.println(int(receivedData.wartoscthrust));
  }
}

Is the transmitter sending data continuously at loop speed ? Try pausing it for some time (say a second or so) each loop iteration.

You mean for a test or? I has to be non stop otherwise its gonna fall out of sky

Please post a schematic diagram of the setup, showing how everything is powered.

The Uno 5V output cannot power a radio with a PA.

1 Like

Newer versions of the library need a radio.stopListening(); call before transmission.
Add it as last radio initialization in setup.

A lower data rate could extend range.

High power settings may not work if the nodes are close.

The receiver will not detect loss of control and keep the last settings.
The transmitter does not care whether it succeeded in sending.

Yes. A test.

Look also at the reviews on amazon for a similar radio module: https://www.amazon.com/MakerFocus-nRF24L01P-Transmission-Interface-Anti-Interference/product-reviews/B07QC1SXJ8?reviewerType=all_reviews . Some report 1k resistors in the signal path making the standard 10MHz SPI speeds difficult to achieve and the performance erratic. You can try lowering the SPI speed. See RF24/COMMON_ISSUES.md at master · nRF24/RF24 · GitHub

Those modules can't tolerate a supply voltage of 5v. Power banks may not be ideal for powering projects if they have auto shutoff features.


So i should just get an external power supply for radio so it doesnt put any load on arduino? (also sorry for rough schematic)

Please add that to your diagram, which shows no power supply.


I also have 1500 mAh 7.4v/30C LiPo battert with soldered DC jack connector. However after i plug it into arduino, theres no change from powerbank. Still wont transmit.

If neither of those power options work with the high power setting, but the radio works on lower power settings with both, then the limitations of the Arduino voltage regulator is not the problem.

Something else is probably wrong.

Okay, thanks for radio.stopListening(); suggestion.

High power settings may not work if the nodes are close.

I assume its some what a protection thing? Should i take this thing to a field and test it outside? and also how big distance does it have to be to start working?

A lower data rate could extend range.

I know that but i sacrifice that for speed of controlling servos.

The receiver will not detect loss of control and keep the last settings.

So i should make receiver aware if theres no signal avaiable, and if theres no signal cut off engine power? aka. disarm?

The transmitter does not care whether it succeeded in sending.

Do you mean i should use radio.enableAckPayload(); ?
Wouldnt it make it even slower?

No, receiver input stage overload.

Theres adapter that makes sure its not 5v. Also i wouldnt like to disassemble those modules as i know i lack skill and tools to operate on electronic this small.
image

The voltage regulator on that adapter might not be able to supply the required current, at full power.

There are many possible explanations for your observation.

Okay i feel so embarrassed right now :sob:

i added the little radio.stopListening(); at the end of transmitter setup, and it works (for now).
Apparently you HAVE put this in code when you are using power amplifier. It works on max power on LiPo (7.4v). But thanks for motor disarming idea, if you wouldnt tell me about that it could have ended badly. Im really thankful for help from everyone of you.

Remember the time of last reception, allowing you to detect time of radio silence.

You should use the return code of radio.write, and maybe repeat the transmission on failure.

I don't think it is directly connected to the PA, but neccessary in any case.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.