gibberish data from nrf2401 transievers,, code is good (see below)

My code that gives me certainty is a copy paste. the codes are working just fine, and my received data is somehow gibberish. Pasted below. THe code I will leave out because it is exactly from the educ8.cs youtube example on the nrf2401 module,, you can find the link here.

I have a hardware issue perhaps. I am connected through an adafruit servo shield on the reciever side (my project is an rc quadruped robot experiment), although the code that I am sure works is the one from the video (I went ahead and uploaded it because the pins for the transceiver are the same and it will just ignore my other connections).

I have previously experienced success with this module,, although since then I DID fly somewhere with it,, and incidentally all of my spares are left behind.... so I can't swap check for about 3 weeks or so minimum,, maybe 2 months.........

THe transmitter appears to be working just fine,,
the receiver appears to be just completely out of tune or something. I haven't yet swapped the modules back and forth, but to be honest I don't see how they can be broken,, I think the servo shield might be causing a problem?? My successful experiment did not use the servo shield, but I want the shield because it will leave lots of pins open for other experiments.

Package:-1
nan
ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ

Package:-1
nan
ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ

Package:-1
nan
ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ

Package:0
0.00

Are you sure you are viewing the data using the correct baud rate?

If you are then the gibberish is due to your code so post both of the programs.

...R
Simple nRF24L01+ Tutorial

I've unplugged my servo shield, and the results don't change. the codes are available from the link,, or else tomorrow I will post them,, I'm just posting a quick note before I sign off,,, anyway I have a great deal of confidence in the posters example codes,,, perhaps his code doesn't work with the new library,,, but the wording is the same as the examples for the new library,,,,

maybe I have bad hardware,, but again I can't even see how it could be bad,, it should be more than durable for any treatment I've given it....

On some boards I've needed a decoupling capacitor to get the NRF24L01 to work reliably. I use a 4.7uf electrolytic and a 0.1uf ceramic between the voltage supply and ground as close to the NRF24L01 as possible.

tsmspace:
or else tomorrow I will post them,

I can wait.

anyway I have a great deal of confidence in the posters example codes,,, perhaps his code doesn't work with the new library,,, but the wording is the same as the examples for the new library,,,,

That's why we need to see the code that YOU have uploaded to your Arduinos.

And what new library?

...R

Robin2:
I can wait.
That's why we need to see the code that YOU have uploaded to your Arduinos.

And what new library?

...R

As I said, this is a duplicate from an example on an internet tutorial page, linked in the op,,. however I do agree it is helpful to have it presented, so here the codes are.....

as for a capacitor,, perhaps I will be able to try that,, I am on a trip so most of my components are not here,,, but I DID bring a little baggy of parts from an arduino starter kit,, so perhaps I can hook that up.. another concern might be that although I didn't have trouble before,, perhaps there are more wifi signals in this tourist area??

The new library is the new rf24,, apparently the library has a newer version that replaces the old "maniac bug" version,, so although the codes appear interchangeable (I'm not using any of the language in codes that suggest they require the new library) I don't actually know what needs to be different.

transmit code.

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

RF24 myRadio (7, 8);
byte addresses[][6] = {"0"};

struct package
{
  int id=1;
  float temperature = 18.3;
  char  text[100] = "Text to be transmitted";
};


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);

}

Receive code

#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);
  }

}

well,, I used a capacitor,, no change. I don't even have to have the transmitter on to recieve the gibberish. It just starts blasting away with nonsense on the receiver end. I wonder if perhaps my module is no good?? I did fly somewhere with it i carryon,, but I certainly don't recall any significant charge...

The first question that arises is where have you installed the RF24 library?
And with the TMRh20 version of the RF24 library you also need to include nRF24L01.h.

All of which makes me wonder what library you are using.

Have you tried any of the examples in the link I gave you in Reply #1 ?

Your struct is much bigger than 32 bytes which is the max for a single message. Is it automatically sending several messages or should you be breaking the message into small chunks before sending it? I have never needed to send more than 32 bytes myself.

...R

So the first example in reply #1,, it isn't working for me.

so more than 32 bytes,, is this because is has char text[100]??

It doesn't seem to behave differently with your simple tx, simple receive posts,, I can touch the wires to get a bunch of garble hits.

I really have to wonder if my flight didn't do them in,, like maybe the xray scanner. They are tiny little chips, and weren't in any static baggies,, and DID have the wires hooked up to them....

I did wire the ground and 3.3v in reverse once, but they worked after that so I don't think that broke them.

Robin2:
The first question that arises is where have you installed the RF24 library?
And with the TMRh20 version of the RF24 library you also need to include nRF24L01.h.

All of which makes me wonder what library you are using.

Have you tried any of the examples in the link I gave you in Reply #1 ?

Your struct is much bigger than 32 bytes which is the max for a single message. Is it automatically sending several messages or should you be breaking the message into small chunks before sending it? I have never needed to send more than 32 bytes myself.

...R

ok. good news. I hit my reset button on my transmitter just a whole bunch of times in a row,, and suddenly I started to get successful transmit and recieve. bad news,, it doesn't just run forever.

I'm using your simple transmit example. it counts to 9 a few times before starting to miss. sometimes only counts to 3. maybe its' just a lot of intereference.

tsmspace:
ok. good news. I hit my reset button on my transmitter just a whole bunch of times in a row,, and suddenly I started to get successful transmit and recieve. bad news,, it doesn't just run forever.

I'm using your simple transmit example. it counts to 9 a few times before starting to miss. sometimes only counts to 3. maybe its' just a lot of intereference.

Have you a 10µF capacitor across Vcc and GND of the nRF24? That is sometimes essential.

Are you using my pair of example programs without any changes whatever? They are meant to work as a pair and you only mention using "your simple transmit example"

One thing to watch out for is that pressing the Arduino reset button does not reset the nRF24. You need to disconnect the power for that to happen.

If you suspect interference can you try it in a very different location?
If not you could try changing to a different channel - but both Tx and Rx must use the same channel.

...R