MPU6050 + nRF24L01: TX-RX problem

Hi guys, I’m sorry for my bad english but I’m italian, so you can understand me :slight_smile:

I’m trying to send data from an Arduino Mega (Transmitter) to a Arduino Uno (Receiver) through nRF24L01+ modules. The library I choose is the maniacbug RF24.
In the program for the Mega I’m controlling two modules: the first is nRF24L01+ on the other hand as second I’ve a GY-521 (MPU-6050).
I’m sending GY-521 data, such as: delta T, accelemetre angle and gyroscope angle, then I’ve filtered data with a complementary filter and I sent variables too.
I need to receive data and output them in the serial, for both receiving and transmitting I’m using typedef struct command.

The problem I’ve got is in the receiving part - but I only think that because, like in english, I’m bad in Arduino programming too - when I try to write the data I received, serial writes only 0.00.

I attached my programs, if someone can help me I’m thankful.

Ricezione_Postazione_PC.ino corresponds to Receiving program and Trasmissione_Barca_RC.ino corresponds to Transmitting program.

Ricezione_Postazione_PC.ino (1.88 KB)

Trasmissione_Barca_RC.ino (37.9 KB)

Resolved guys.

You try to receive a structure of 40 bytes length while the maximum possible packet size is 32, this will never work.

  typedef struct {
    float dt;
    float accel_angle_x;
    float accel_angle_y;
    float accel_angle_z;
    float unfiltered_gyro_angle_x;
    float unfiltered_gyro_angle_y;
    float unfiltered_gyro_angle_z;
    float angle_x;
    float angle_y;
    float angle_z;
  } GY_521_Data_Received;

I would suggest switching to a different library https://github.com/TMRh20/RF24

Whandall:
You try to receive a structure of 40 bytes length while the maximum possible packet size is 32, this will never work.

  typedef struct {

float dt;
    float accel_angle_x;
    float accel_angle_y;
    float accel_angle_z;
    float unfiltered_gyro_angle_x;
    float unfiltered_gyro_angle_y;
    float unfiltered_gyro_angle_z;
    float angle_x;
    float angle_y;
    float angle_z;
  } GY_521_Data_Received;



I would suggest switching to a different library https://github.com/TMRh20/RF24

So, need I to rewrite all the program?

If you care about

   float unfiltered_gyro_angle_z;
    float angle_x;
    float angle_y;
    float angle_z;

at least a change will be necessary.
You could send two different groups of values with identifier(s) in a small packet header common to all of your packets.