hey guys, in my previous post and video, I have told you that I will be cloning the DJI Tello drone using Arduino to my best knowledge. I have already told you about the components that you will need for this project and the STL file for the frame in my last post. You can check it HERE if you have not yet checked it. In this post, I will show you how to test if your NRF24L01 module for the transmitter and receiver is working fine. Many of the time, when making a project like this, you, think that you have done something wrong in wiring the components or that your code is wrong, when in fact, the NRF24l01 itself can be faulty due to excess heat while soldering, or wrong voltage input or factory fault. In this case, it's better to test if the NRF24l01 is working fine before even proceeding with the project.

DIY Tello part  2


For this post, you will need the Arduino RF Nano, two of it, or Two Arduino nano and two NRF24L01 SMD versions of the normal one if you can't get the SMD. In my previous post, I have already told you guys where to buy these components to get them faster. 

First of all, if you do not have the RF nano, you will have to connect your arduino to the NRF24l01 SMD as shown below.

If you do not have the SMD version of the NRF24L01, you can make the connection with the normal one as shown below.



Once you have made all the connection, you will have to upload the code for the transmitter test in one Arduino and the code for the Receiver code on another arduino. Make sure that you have the NRF24 library installed. If you do not have it, you can go to Sketch > Include libraries > Manage Libraries, then search for RF24 and scroll down to install the RF24 by Thmr20.




Then upload the transmitter test code in one of the Arduino. You should have both Arduino connected to perform this test.

You can download the test code or copy and paste it from below. 

DOWNLOAD TRANSMITTER TEST CODE


Transmitter Test Code

/*TheFScreations
 *Transmitter test code
 *Subscribe to my channel
 */

/* include library
 *  make sure to download the rf24 library
 */
#include <SPI.h>
#include <nRF24L01.h>
#include <RF24.h>

  
const uint64_t pipeOut = 0xE8E8F0F0E1LL; // The same as in the receiver

RF24 radio(10, 9); //CE , CSN pin initialization

struct MyData {
  byte throttle;
};

MyData MyData;

void resetData() 
{
  //These are the start values of each channel
    
  MyData.throttle = 0;
}

void setup()
{
  //Start everything up
  radio.begin();
  radio.setAutoAck(false);
  radio.setDataRate(RF24_250KBPS);
  radio.openWritingPipe(pipeOut);
  resetData();
}

/**************************************************/

void loop()
{

  MyData.throttle = 0;
  


  radio.write(&MyData, sizeof(MyData));
}



////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

Now, you should upload the receiver test code in another arduino. You can download the receiver test code or copy and paste it from below.

Receiver Test code

//Receiver test code
#include <SPI.h>
#include <nRF24L01.h>
#include <RF24.h>
const uint64_t pipeIn = 0xE8E8F0F0E1LL; //same as in the transmitter

RF24 radio(10, 9);// CE & CSN pin 


struct MyData {
byte throttle; 

};

MyData data;

void resetData()
{

data.throttle = 0;


}

/**************************************************/

void setup()
{
Serial.begin(9600); //Set the speed to 9600 bauds if you want.

resetData();
radio.begin();
radio.setAutoAck(false);
radio.setDataRate(RF24_250KBPS);

radio.openReadingPipe(1,pipeIn);
radio.startListening();

}

/**************************************************/

unsigned long lastRecvTime = 0;

void recvData()
{
while ( radio.available() ) {
radio.read(&data, sizeof(MyData));
lastRecvTime = millis(); //here we receive the data
}
}

/**************************************************/

void loop()
{
recvData();
unsigned long now = millis();
//Here we check if we've lost signal, if we did we reset the values 
if ( now - lastRecvTime > 1000 ) {
// Signal lost?
resetData();
}

Serial.print("Throttle: "); Serial.print(data.throttle);  Serial.print("  \n  ");




}

/**************************************************/

Both of the Arduino should be connected. On the receiver, Arduino IDE, open the serial monitor and you should see the Throttle value that is being sent from the transmitter. In the transmitter code, change the throttle value in the void loop and check the serial monitor for the receiver to check if you are receiving the correct value. If you are receiving the correct value, that means your NRF is working fine, else, one or both ur NRF is not working and should be changed. 

You can watch the video about it on my youtube channel to better understand this test


Thank you guys to watch this post, hope you will like this project. Make sure to subscribe to my channel. In my next post, I will show you how to make the Electronic Speed Controller(ESC) for the brushed motor.