In this post we are going to construct a circuit which can control the speed of 3 individual DC motors using 3 potentiometers wirelessly over a 2.4 GHz communication link.
The speed control for DC motors has enormous application in commercial,scientific and industrial sectors.
Even radio control toys like RC cars,RC helicopters and drones etc. has to control its speed of the DC motor so that the toys move as per users command.
The proposed project is a general purpose wireless DC motor speed control circuit which may be customized according to readers need.
This project can control only three DC motors that’s because of limited PWM pins available in Arduino boards. But,three DC motor controls might be enough for most of the small projects.
The project has a remote and receiver.
The remote consists of an Arduino, 3 potentiometers for controlling 3 individual motors independently at the receiver side.
A 2.4 GHz transceiver module which is the heart of the project connected at the remote and receiver which makes communication between two Arduinos possible.
At the receiver, we have 3 MOSFETs for driving three DC motors, an Arduino and a 2.4 GHz transceiver module.
The 2.4 GHz communication module is NRF24L01. Its pin configuration is illustrated below.
It works on SPI communication protocol. It can transmit data ranging from 250KBPS to 2 MBPS. It has 125 channels for communication. It has theoretical maximum range of 100 meters.
It works on the same band of your WI-FI.
Care must be taken while powering this NRF24L01 module as it works on 3.3 V and 5 V will kill the module.
Now let’s move on to remote controller circuit:
The Remote controller schematic:
The three 10K ohm potentiometers are connected to analog pins of arduino A0, A1 and A2.
The remote can be powered from a 9V battery by connecting via DC jack.
If you have any confusion regarding the wiring between Arduino and NRF24L01 module, please refer the table given beside the circuit.
Please download the library file here: https://github.com/nRF24/
Download Program for remote:
That concludes the remote controller circuit.
Now let’s see the receiver circuit.
The receiver schematic:
NOTE: The connection between NRF24L01 and Arduino is not shown in the above diagram; please connect NRF24L01 to Arduino as shown in the remoter controller circuit diagram.
The three MOSFETs are connected to PWM pins of Arduino board which are 6, 5 and 3. You can’t use non PWM pins for generating PWM signals in Arduino.
You may use any N-channel MOSFET whose gate threshold is less than 4 V. You must power the motors separately as per the motor’s voltage specification.
The Arduino board can be powered from 9V battery via the DC jack or from USB.
Download Program for receiver:
receiver
That concludes the receiver.
The potentiometer connected to A0 controls the motor at pin #3, the potentiometer connected to A1 controls the motor at pin #5 and the potentiometer connected to A2 controls the motor at pin #6 at the receiver.
The DC motors can be varied from full stop to maximum speed by rotating those10K ohm potentiometers.
Note 1:
if you are not using all the three motors for your project, please ground the unused potentiometer pins in the remote.
For example, if are using only one motor for your project; connect motor and MOSFET at pin #3 at receiver.
Connect the potentiometer to pin A0 and ground pins A1 and A2. Do nothing to pins PWM pins 5 and 6 at receiver side. Similarly ground only the A2 pinif you are using 2 motors.
Note 2:
You can connect the Arduino of either remote or receiver to computer and open the serial monitor; you can see some parameter such as the voltage level at analog pins, PWM level (0 to 255) and which motor is currently controlled.
If you have any quires regarding this project, please leave in the comment section, you may receive a quick reply.
Jay Bell says
This comment is about your 2.4GHZ Joystick RC CAR. It would not let me post on that site.
I modified your code but couldn’t get it to work. I was wondering if you could help me?
//——————Program Developed by R.Girish—————//
////// Modified by J. Bell ////////
Client
#include
#include
#include
RF24 radio(9,10);
const byte address[6] = “00001”;
const char var1[32] = “up”;
const char var2[32] = “down”;
char input[32] = “”;
const int output1 = 2;
const int output2 = 4;
void setup()
{
Serial.begin(9600);
radio.begin();
radio.openReadingPipe(0, address);
radio.setChannel(100);
radio.setDataRate(RF24_250KBPS);
radio.setPALevel(RF24_PA_MAX);
radio.startListening();
pinMode(output1, OUTPUT);
pinMode(output2, OUTPUT);
}
void loop()
{
while(!radio.available())
radio.read(&input, sizeof(input));
if((strcmp(input,var1) == 0)) //VAr1
{
digitalWrite(output1, HIGH);
digitalWrite(output2, LOW);
delay(10);
}
else if((strcmp(input,var2) == 0)) //VAr2
{
digitalWrite(output1, LOW);
digitalWrite(output2, HIGH);
delay(10);
}
}
//——————Program Developed by R.Girish—————//
//————–Program Developed by R.Girish—————//
////// Modified by J. Bell ////////
Server
#include
#include
#include
int X_axis = A0;
int x = 0;
RF24 radio(9,10);
const byte address[6] = “00001”;
const char var1[32] = “up”;
const char var2[32] = “down”;
int thresholdUP = 460;
int thresholdDOWN = 460;
void setup()
{
radio.begin();
Serial.begin(9600);
pinMode(X_axis, INPUT);
digitalWrite(X_axis, HIGH);
radio.openWritingPipe(address);
radio.setChannel(100);
radio.setDataRate(RF24_250KBPS);
radio.setPALevel(RF24_PA_MAX);
radio.stopListening();
}
void loop()
{
x = analogRead(X_axis);
if(x = thresholdDOWN)
{
radio.write(&var2, sizeof(var2));
}
delay(200);
}
//————–Program Developed by R.Girish—————//
admin says
I am sorry, I am not good with the Arduino coding, so it can be difficult for me to understand and improve your code
siddharth basava says
Hi sir, will the receiver receive commands from other rc toy car or rc toy helicopter transmitter? instead of NRF24L01 module. because I dont have NRF24L01 and I cant refer that.
Thank You.
admin says
Sorry Siddharth, I have no idea whether the NRF24L01 can be replaced with any other module or not
adam says
delete (Program for remote:) and (Program for receiver:) lines out of the code.
in Program for remote: sketch (constint threshold = 20;) change to
(const int threshold = 20;)
missing the space in there.
have fun adam
admin says
thank you very much for the help, I hope others will love this tip
jo says
Both files will not compile maybe due to the way it was saved.
admin says
then how can it be saved so that it compiles correctly, please suggest?
Robert Marshall says
Hi
Could you tell me if the code
radio.setChannel(100); on transmitter and receiver is to pair the 2 NRF24L01 s ?
If I wanted to use multiple transmitters and receivers, say 4 altogether, what should I set channel values to so they work separately
admin says
Hi, I am really sorry, my Arduino knowledge is not good so I can’t solve it for you. This article was submitted by another author.
If possible, you can refer this article to Arduino.cc forums, an expert there could perhaps help you out with a solution.