NRF24L01+ sends or receives garbled data

Thread Starter

quique123

Joined May 15, 2015
404
Hi
I got everything wired up between a receiving Uno and a sending nano. I started by powering the nano sender from a power bank and I got garbled data. Second try I soldered a 10uF capacitor between Vcc and Gnd on the module pins but still got the same similar data. Thirdly I powered the sender from a dc regulator set to 3.3v powered by the same power bank and I still get similar results.

Wiring:

UNO RECEIVER
3.3V-----------VCC
GND-----------GND
7---------------CE
8---------------CSN
11--------------MOSI
12--------------MISO
13--------------SCK

NANO SENDER
3.3V-----------VCC
GND-----------GND
7---------------CE
8---------------CSN
11--------------MOSI
12--------------MISO
13--------------SCK


Code:
#include <SPI.h>
#include "RF24.h"
RF24 myRadio (7, 8); //ce & cs pins.  11,12,13 comm pins
byte addresses[][6] = {"0"}; //data container
struct package{
  int id=1;
  float temperature = 18.3;
  char  text[100] = "Send this data";
};
typedef struct package Package;
Package data;
void setup(){
  Serial.begin(115200);
  delay(1000);
  myRadio.begin();
  myRadio.setChannel(115);
  myRadio.setPALevel(RF24_PA_MAX);
  myRadio.setDataRate( RF24_250KBPS ) ;
  myRadio.openWritingPipe( addresses[0]);
  delay(1000);
}
void loop(){
  myRadio.write(&data, sizeof(data));

  Serial.print("\nPackage:");
  Serial.print(data.id);
  Serial.print("\n");
  Serial.println(data.temperature);
  Serial.println(data.text);
  data.id = data.id + 1;
  data.temperature = data.temperature+0.1;
  delay(1000);
}
Code: [Select]
#include <SPI.h>
#include "RF24.h"
RF24 myRadio (7, 8);
struct package
{
  int id=0;
  float temperature = 0.0;
  char  text[100] ="empty";
};
byte addresses[][6] = {"0"};
typedef struct package Package;
Package data;
void setup() {
  Serial.begin(115200);
  delay(1000);
  myRadio.begin();
  myRadio.setChannel(115);
  myRadio.setPALevel(RF24_PA_MAX);
  myRadio.setDataRate( RF24_250KBPS ) ;
  myRadio.openReadingPipe(1, addresses[0]);
  myRadio.startListening();
}
void loop() {
  if ( myRadio.available()) {
    while (myRadio.available())
    {
      myRadio.read( &data, sizeof(data) );
    }
    Serial.print("\nPackage:");
    Serial.print(data.id);
    Serial.print("\n");
    Serial.println(data.temperature);
    Serial.println(data.text);
  }
}

Results:

Package:0
0.00
Package:16904
0.00
B
Package:0
0.00
Package:8852
ovf
Package:1028
0.00
⸮ B ⸮<
Package:0
0.00
! B ⸮! B ⸮! B ⸮! B ! B B ⸮
Package:0
34.00
⸮B ⸮! B ⸮!⸮
Package:8452
34.00

Then I followed a tutorial from arduino.cc as was recommended and I still got similarly garbled data:

Simple nRF24L01+ Tutorial
 

Janis59

Joined Aug 21, 2017
1,257
Probably, if Youve read about 328 tablet may be fed from 3V3 or 5V0 disregarded the text with supersmall letters in below of page - in case of 3V3 the max freq of ZQ must be 8 MHz, and only in case of 5V0 it may be normal 16 MHz. So, I suspect Your 328 is twice overclocked now.
 
Top