Interfering digital I/O pins in NRF24L01 / motorshield libraries RC TANK PROJECT

Hello everyone,

I am working on a RC tank project. I came up with a code that successfully uses a joystick to control 2 DC motors (through a L293D motor-shield) so that functions FORWARD, BACKWARDS, LEFT, RIGHT, and STOP can be performed.

This code uses the "now ancient" Adafruit Motor Shield V1 library: <AFMotor.h>

The next step is to add NRF24L01 transceivers that I have in order to control these motors wirelessly. I have an additional Arduino Uno that I will use along with the joystick (and one of the NRF24L01 transceivers) to be the controller.

My question is: How do I wire the NRF24L01 on the Receiving Arduino?
It appears that the pinout for the NRF24L01 interferes with the pinout for motorshield. It looks like Digital pin 12 specifically will be a problem for me. I have attached photos of the pins used by the libraries for both the NRF24L01 and the motorshield.


NRF24L01 libraries I am using: <SPI.h>
<nRF24L01.h>
<RF24.h>

Link to NRF24L01 information; https://arduino-info.wikispaces.com/Nrf24L01-2.4GHz-HowTo

Motorshield Library I am Using: <AFMotor.h>

Link to motorshield information; https://cdn-learn.adafruit.com/downloads/pdf/adafruit-motor-shield.pdf

This Simple nRF24L01+ Tutorial may help.

To use an nRF24 you must be able to connect it to the Mosi Miso and SCK pins for SPI. No others will do. If you are using an UNO they are pins 11, 12 and 13.

You can use any I/O pins for CE and CSN

...R

Robin2:
This Simple nRF24L01+ Tutorial may help.

To use an nRF24 you must be able to connect it to the Mosi Miso and SCK pins for SPI. No others will do. If you are using an UNO they are pins 11, 12 and 13.

You can use any I/O pins for CE and CSN

...R

The motorshield manual claims that 'digital pins 4, 7, 8, and 12 are used to drive the DC/stepper motors via the 74HC595 latch which is spoken to by the Arduino." The problem I see here is that both the NRF24L01 and the motorshield want to use digital pin 12. Any suggestions?

Another question I have that may help is;

Is there a way to edit the motorshield library so that I can change digital pin 12 to a different pin so that pin 12 can be used by the NRF24L01?

belae1ka:
Is there a way to edit the motorshield library so that I can change digital pin 12 to a different pin so that pin 12 can be used by the NRF24L01?

That depends on how pin 12 is physically used on the shield. This sort of problem is the main reason I don't like shields.

Have you a schematic for the shield?

...R

I believe the schematic for the motor shield can be found here-> https://github.com/adafruit/Adafruit-Motor-Shield-for-Arduino

I do suppose this problem can probably be solved by pulling off one of the L293D IC chips and wiring/running the motors that way. However, when I tried this the 5V from the arduino was powering the motors which is not what I want. I only want the 5V from the arduino to run the logic on the L293D IC and I want to power the motors externally so that the motors don’t draw current from the source powering the arduino. There was a jumper that I was able to remove on the motorshield that allowed me to power the motors externally. What do you think?

Here is a photo of the L293D IC layout (Pin 8 can be used as the external power supply);

Here is a picture of the “advanced” layout; What is the difference between the two? What purpose do the capacitors serve?

Please someone help :slightly_frowning_face:

I am not familiar with the L293.

...R