Help With NRF24L01 @ 2.4GHz

Hello all,

I am trying to hack a Arduino car. I got most of the prototype assembled except the NRF24L01.

I have been reading on how to connect the transceiver to the Arduino and have noted that it uses SPI to communicate with the host micro-controller.

The problem is that the MOSI pin is being used by the motor driver. So I can't use the SPI pins.

Is there anyway to connect the NRF24L01 without redisigning the whole circuit because all of the wires are internally wired within the shield?

Thanks for helping out.

Unsigned_Arduino:
The problem is that the MOSI pin is being used by the motor driver. So I can't use the SPI pins.

Then you need to change the pin used for the motor driver - or get a different motor driver. There is no alternative to using the SPI pins with an nRF24.

Post a link to the datasheet for your motor driver and post your program

...R
Simple nRF24L01+ Tutorial

With NRFLite you can use 2-pin connection with any GPIO.

Any pins?

HookUpWire:
With NRFLite you can use 2-pin connection with any GPIO.

GitHub - dparson55/NRFLite: nRF24L01+ library with AVR 2 pin support, requiring very little code along with YouTube videos showing all available features. It can be installed via the Arduino IDE Library Manager

I don't think that is true. The code starts with

// TX example

#include <SPI.h>
#include <NRFLite.h>

The optional pins are for CE and CSN and they are optional with all the libraries. The three SPI pins are also essential.

...R

The 2-pin example code doesn't have #include <SPI.h>.

HookUpWire:
The 2-pin example code doesn't have #include <SPI.h>.

That was way down the page so I had not seen it. As stated in your link it will be much slower.

...R

I don't care how slow SPI is. As long it works.

There is a software serial lib, why not include a software spi lib? Can't seam to find one.

Unsigned_Arduino:
I don't care how slow SPI is. As long it works.

You have not explained why you can't control the motor without using some of the SPI pins? I have several projects that use nRF24s and motors.

And if you really must do software SPI it is not all that difficult. Just set the relevant pin (I think it is CSN for the nRF24), then toggle your SCK pin and prior to each toggle set your MOSI pin with the bit to be transmitted and after each toggle read your MISO pin to receive the incoming bit. The Atmega 328 datasheet has all the information including signal diagrams.

...R

The motor driver is internally wired!

I will reread your explanation on software SPI again. Can't concentrate right now. :o

Unsigned_Arduino:
The motor driver is internally wired!

It would help if you post a link to its datasheet.

...R

No, the motor driver is hardwired to the arduino!!!!!!! Can't change the schematic!!!

Anyway, I am using a Elegoo L298N Dual H Bridge Stepper DC Motor Driver Shield Expansion Development Board which can be found at https://www.elegoo.com/product/elegoo-l298n-dual-h-bridge-stepper-dc-motor-driver-shield-expansion-development-board/

Unsigned_Arduino:
No, the motor driver is hardwired to the arduino!!!!!!! Can't change the schematic!!!

Anyway, I am using a Elegoo L298N Dual H Bridge Stepper ......

Now I am even more confused. The H-bridge in your link is not hardwired to any Arduino, it can use whatever PWM pins you choose.

Can you post a photo of your Arduino with the hardwired motor driver.

...R

On my prototype the motor driver is stuck with the same pins because I am using the same shield that was in the original car!

Okay I found a solution...

This link:https://www.amazon.com/ELEGOO-Stepper-Expansion-Development-Arduino/dp/B01LNEHJF0/ref=sr_1_1?ie=UTF8&qid=1533754763&sr=8-1&keywords=Elegoo+L298N takes you to the buying page from amazon. There schematic is as follows in the description:

Also in the description;

/*define logic control output pin*/
int in1=6;
int in2=7;
int in3=8;
int in4=9;
/*define channel enable output pins*/
int ENA=5;
int ENB=11;
/*define forward function*/
void _mForward()
{
digitalWrite(ENA,HIGH);
digitalWrite(ENB,HIGH);
digitalWrite(in1,HIGH);//digital output
digitalWrite(in2,LOW);
digitalWrite(in3,LOW);
digitalWrite(in4,HIGH);
Serial.println("Forward");
}
/*define back function*/
void _mBack()
{
digitalWrite(ENA,HIGH);
digitalWrite(ENB,HIGH);
digitalWrite(in1,LOW);
digitalWrite(in2,HIGH);
digitalWrite(in3,HIGH);
digitalWrite(in4,LOW);
Serial.println("Back");
}
/*define left function*/
void _mleft()
{
digitalWrite(ENA,HIGH);
digitalWrite(ENB,HIGH);
digitalWrite(in1,HIGH);
digitalWrite(in2,LOW);
digitalWrite(in3,HIGH);
digitalWrite(in4,LOW);
Serial.println("Left");
}
/*define right function*/
void _mright()
{
digitalWrite(ENA,HIGH);
digitalWrite(ENB,HIGH);
digitalWrite(in1,LOW);
digitalWrite(in2,HIGH);
digitalWrite(in3,LOW);
digitalWrite(in4,HIGH);
Serial.println("Right");
}
/*put your setup code here, to run once*/
void setup() {
Serial.begin(9600); //Open the serial port and set the baud rate to 9600
/*Set the defined pins to the output*/
pinMode(in1,OUTPUT);
pinMode(in2,OUTPUT);
pinMode(in3,OUTPUT);
pinMode(in4,OUTPUT);
pinMode(ENA,OUTPUT);
pinMode(ENB,OUTPUT);
}
/*put your main code here, to run repeatedly*/
void loop() {
_mForward();
delay(1000);
_mBack();
delay(1000);
_mleft();
delay(1000);
_mright();
delay(1000);
}

So I don't need anything connected to the MOSI pin! :slight_smile: That was just to enable the controll of the right motor!

So, the lesson is that never just assume what's on the outside.

I feel so stupid. :o

So all I have to do is to redesign the shield! Yay!

[sigh].

Unsigned_Arduino:
That was just to enable the controll of the right motor!

Do you mean the "correct" motor or the motor on the right-hand side?
The diagram seems to be controlling 2 motors without using the SPI pins.

Unsigned_Arduino:
So all I have to do is to redesign the shield! Yay!

In the light of Reply #15 I don't understand that comment.

...R