Working through problems with nrf24 and nano

I am trying to build a RC car using nerfs and nanos,
Started with the dronebot RC car and radiohead library.
My first attempt failed bad.
Couldn't even get it to upload.
Searching led me to try the old bootloader.
After selecting the nano board.
I went to tools>processor and could see old bootloader.
Now I could upload the sketch.

Next problem:
Failed to init.
Went to mechatronics and tried testing them failed,..
bunch of squares in the serial monitor.
Well on one of the nanos, the chip on the bottom was getting hot
I unplugged the nerf and it was still getting hot.
I got one of the proto boards off ebay so I didn't go to all the trouble of soldering everything in place and used a different nano.
I am using the adapter board with the voltage regulator.
Running it off the 5 volts from the nano.

I saw Robin2 was on here and helping people troubleshoot his tutorial:
[Simple nRF24L01+ 2.4GHz transceiver demo - Community / Exhibition / Gallery - Arduino Forum]
(Simple nRF24L01+ 2.4GHz transceiver demo - #3 by Robin2)

So I started working with that.
I'm on the first one. Simple one-way transmission.
Since I started with the dronebot wiring my CE is 8 and CSN is 10
I changed the sketch to match.
I have the 2 ports hooked to their proper nanos and am running them both at the same time through 2 of my laptop USB ports.
Using windows 10.

Now I am getting something readable on the serial monitor:
"SimpleTx Starting
Data Sent Message 0 Tx failed
Data Sent Message 0 Tx failed" etc.
So that's progress but I haven't been able to figure out why it's staying at zero and failed.
Any hints?

Your topic was MOVED to its current forum category as it is more suitable than the original

The problem is probably in the code that you did not post, the schematic of your project which you did not post, the components of the project which you did not detail or maybe the power supply of your project which you did not mention

Full details please

If You have a question about code, then post the code here. Use the code tag symbol, </>.

Sometimes, another example may help:

https://randomnerdtutorials.com/nrf24l01-2-4ghz-rf-transceiver-module-with-arduino/

OK UKHeliBob so you think it's more appropriate for the programming questions section.
Thanks, even though I don't think code is the problem.
I copied it right from the tutorial and I think Robin2 knew what he was doing.

The list of other problems I had;
bad board got hot and made squares in the serial monitor,
wouldn't upload until I used old bootloader
weren't code related, just problems with my project that I listed because others might run into them if they try working with nerfs and nanos.

...and instead of just linking to the page with the code I'll post it here:
receiver:

// SimpleRx - the slave or the receiver

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

#define CE_PIN   8
#define CSN_PIN 10

const byte thisSlaveAddress[5] = {'R', 'x', 'A', 'A', 'A'};

RF24 radio(CE_PIN, CSN_PIN);

char dataReceived[10]; // this must match dataToSend in the TX
bool newData = false;

//===========

void setup() {

  Serial.begin(9600);

  Serial.println("SimpleRx Starting");
  radio.begin();
  radio.setDataRate( RF24_250KBPS );
  radio.openReadingPipe(1, thisSlaveAddress);
  radio.startListening();
}

//=============

void loop() {
  getData();
  showData();
}

//==============

void getData() {
  if ( radio.available() ) {
    radio.read( &dataReceived, sizeof(dataReceived) );
    newData = true;
  }
}

void showData() {
  if (newData == true) {
    Serial.print("Data received ");
    Serial.println(dataReceived);
    newData = false;
  }
}

And for the transmitter:

// SimpleTx - the master or the transmitter

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


#define CE_PIN   8
#define CSN_PIN 10

const byte slaveAddress[5] = {'R','x','A','A','A'};


RF24 radio(CE_PIN, CSN_PIN); // Create a Radio

char dataToSend[10] = "Message 0";
char txNum = '0';


unsigned long currentMillis;
unsigned long prevMillis;
unsigned long txIntervalMillis = 1000; // send once per second


void setup() {

    Serial.begin(9600);

    Serial.println("SimpleTx Starting");

    radio.begin();
    radio.setDataRate( RF24_250KBPS );
    radio.setRetries(3,5); // delay, count
    radio.openWritingPipe(slaveAddress);
}

//====================

void loop() {
    currentMillis = millis();
    if (currentMillis - prevMillis >= txIntervalMillis) {
        send();
        prevMillis = millis();
    }
}

//====================

void send() {

    bool rslt;
    rslt = radio.write( &dataToSend, sizeof(dataToSend) );
        // Always use sizeof() as it gives the size as the number of bytes.
        // For example if dataToSend was an int sizeof() would correctly return 2

    Serial.print("Data Sent ");
    Serial.print(dataToSend);
    if (rslt) {
        Serial.println("  Acknowledge received");
        updateMessage();
    }
    else {
        Serial.println("  Tx failed");
    }
}

//================

void updateMessage() {
        // so you can see that new data is being sent
    txNum += 1;
    if (txNum > '9') {
        txNum = '0';
    }
    dataToSend[8] = txNum;
}

Components are 2 arduino nanos.
Transmit and receive.
This nerf:
Addicore NRF24L01+PA+LNA with Antenna 2.4GHz Wireless Transceiver

This adapter between the 2:
Addicore nRF24L01+ Adapter Board

The adapter makes it so I can run the nerf on 5 volts from the nano.

A schematic:
Any tips on how to draw and post a schematic let me know.
I couldn't find a how to for posting pictures and the one from dronebot doesn't seem to want to load on my flicker.
So of course
SCK goes to 13 on the nano
MOSI to pin 11
MISO to pin 12
and
CSN to pin 10
CE to pin 8

Power for the adapter goes to 5Volts on the nano, where it is regulated down to 3.3 to power the nrf24.
ground is to ground.
A picture of it is a little ways down on this page:
nRF24L01 Wireless Joystick for Arduino Robot Car | DroneBot Workshop

mrburnette, Thanks for the link. I see it uses the radiohead library like dronebot's page.
For this simple beginners attempt to get them to "talk" I'm trying the TMRh20 version of the RF24 library like Robin2 suggested. But I will be switching to the radiohead library to complete the project the way dronebot did it.

So I guess the question is what it's failing to do?
Is it not sending the message to the receiver,
or not bouncing back when it shows this message in the serial monitor:
"SimpleTx Starting
Data Sent Message 0 Tx failed
Data Sent Message 0 Tx failed"
Am I supposed to hook the receiver up to another power source then check the serial monitor for the transceiver? Other way around?
Since I have both hooked to the same laptop is the serial monitor for the master or slave? Since the message is the same whichever serial monitor I click on. I was thinking the serial monitor would relate to the Arduino window it was hooked to.

I wanted to try this "simple" program because it was on arduino forum and I thought Robin2 was on here to help me if it didn't work.
Both were failed logic on my part.
The bad library and lack of help from Robin2 sent me back to the original dronebot site to use the radiohead library.
And I got it to work with the nano that doesn't get hot and the old bootloader.

So list of problems and solutions is all here.
Thank you to mrburnette for pointing me away from this failed tutorial and back toward using the radiohead library.
Hope this helps someone else.

Now to wire it up to my RC car

Robin has been seriously ill for a while now and has concentrated on getting better, but his example sketches are known to work and are familiar to many users here if you needed help with them

Thanks for the info.

Sorry to hear about Robin2.

I’m going to try getting them to work over at the dronebot forum for awhile.

That’s the original tutorial I started with.

They started acting up again.

Craig

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