I’m asked a lot about how I get my radio control working using the NRF24 radio modules and I finally have it figured out enough to share with you. It’s taken me a while because I wanted to make sure it was right before I settled on the code. I have been using my John Deere 8360RT model as a test bed for the code and I’ve worked through various glitches, lost data as a result of poor coding and ultimately ended up with it working well enough for a small tutorial.
I’m going to locate the code on the forum here: Code for RC control using Arduinos and NRF24L01 modules
That way as you guy’s modify the code or improve it you can post your own versions. This code does not control a servo because the NRF24 library and servo library are trying to use the same timer in the Atmega chip so the code wont compile. I don’t have time to look into this because it is not needed in my full RC tractor code and I’ll be focusing on that. I think you just need to install a different servo library that uses Timer2 to get this working with a servo, if you figure it out let people know in the forum thread.
This tutorial requires the following items:
2 3.3V Arduino Pro Minis (ebay: http://goo.gl/0aTSkh)
1 FTDI cable or similar
2 NRF24L01 Modules (ebay: http://goo.gl/hbKpyL)
1 Joystick Module (ebay: http://goo.gl/f91IwV)
1 TB6612FNG dual motor driver (ebay: http://goo.gl/yFQ0lM)
1 DC motor
1 LED + resistor (ebay: http://goo.gl/79wVoS)
The first thing to do is upload the code to your Arduinos using the FTDI cable or a similar device. Then you need to connect a radio module to each arduino, here are the pinouts of each device.
You need to use 3.3 volt Arduino Pro minis because the NRF24L01 will be damaged by voltages over 3.6 volts. Connect the pins as follows:
Arduino | NRF24L01 |
---|---|
VCC | VCC |
GND | GND |
D8 | CE |
D10 | CSN |
D13 | SCK |
D11 | MOSI |
D12 | MISO |
You should now have both arduinos connected to an NRF24L01 radio module, one for the controller and one for the receiver.
Take the joystick module and connect it to one of your Arduinos as follows:
Arduino | Joystick Module |
---|---|
VCC | VCC |
GND | GND |
A1 | Joystick X Position |
A0 | Joystick Y Position |
D7 | Joystick Button |
This is the controller finished.
Your other Arduino must now be connected to the TB6612FNG dual motor driver as follows:
Arduino | TB6612FNG Motor Driver |
---|---|
VCC | VCC |
RAW | VM |
GND | GND |
D5 | PWMA |
D7 | AIN1 |
D6 | AIN2 |
VCC | STBY |
hi please can you update the link ok Code for RC control using Arduinos and NRF24L01 modules is dead