Escolar Documentos
Profissional Documentos
Cultura Documentos
CARDÁPIO
PCB Design
Nevertheless, in order to keep this circuit compact, I made a
custom PCB using the EasyEDA free online circuit design
software. Here, I arranged the 8 channels right next to a 5V and
a Ground rail, and so we can directly connect servos and ECSs to
them. The channel number 9 is located at a separate position,
near the VCC pin of the Arduino, so we can use for example, an
ESC for powering the Arduino with its Battery Eliminator Circuit
feature which provides 5V. Of course, we could use any other
channels for that purpose, as the VCC pin is connected to those
5V rail as well.
As for the channels number 7 and 8, we can see here how there
are interrupted with these pin headers. If we want to use them,
we just have to connect the two pins together. The
programming header is located at the top right corner and the
100uF capacitor serves for both the voltage regulator and the
NRF24L01 module. On the bottom left corner of the PCB, I
placed the analog pins.
Here we can note one more thing, and that’s that some Arduino
Pro Mini boards might have different pins arrangement, so
therefore I included one more version of the PCB so you can
choose the one that match with your Arduino Pro Mini board.
Here’s a link to the project files of this PCB. So once I finished
the design, I generated the Gerber file needed for
manufacturing the PCB.
Gerber files:
Here we can simply drag and drop the Gerber file and once
uploaded, we can review our PCB in the Gerber viewer. If
everything is all right then we can go on and select the
properties that we want for our PCB. And that’s it, now we can
simply order our PCB at a reasonable price. Note that if it’s your
first order from JLCPCB, you can get up to 5 PCBs for only $2.
PCB Assembly
After several days the PCBs have arrived. The quality of the PCBs
is great and everything is exactly the same as in the design.
Now we can move on and assemble the PCB. First, we need to
solder the pin headers of the Arduino board. A convenient way
to do that is to use a breadboard to stick the pin headers in it
and so the board will stay firmly in place while soldering. As I
said earlier, depending on your board, the pins might vary a bit,
so keep that in mind when soldering them.
Also, there are some Ground pins that we need to leave free as
there are some traces running on the PCB under them. Once I
soldered the Arduino board, I cut the excess length off the pins.
Next, I placed all other pin headers in place. We need both male
and female pin headers, or it’s actually up to you what pin
headers you will choose to use. However, it’s good idea to use
male pin headers for the digital channels as the servo motors
and the ESC connections are female, so we can easily connect
them.
The voltage regulator is a surface mount component so I used
some Blue-Tack adhesive to hold it in place while soldering.
Lastly, once we solder the two capacitors in place, we can attach
the NRF24L01 module to the appropriate pin headers.
Depending on the application, or the range that we need, we
can use either the normal module with the on-board antenna,
or the one to which we can attach a bigger antenna and can
achieve wireless communication of up to 700 meters in open
space. So that’s it, our Arduino RC Receiver is now ready and we
can use it for anything we want.
L298N Driver
……………………………….. Amazon / Banggood / AliExp
ress
12V High Torque DC Motor
………….. Amazon / Banggood / AliExpress
DC Motor w/ Plastic Tire Wheel
……. Amazon / Banggood / AliExpress
Breadboard and Jump Wires
………… Amazon / Banggood / AliExpress
Disclosure: These are affiliate links. As an Amazon Associate I
earn from qualifying purchases.
So, the connections are really simple, the 12V coming from the
batteries go the 12V pin on our receiver, and the six control pins
of the driver go to the 6 channels. We need to note here that in
order to be able to control the speed of the motors we need to
provide PWM signal to the Enable A and Enable B pins of the
driver. In our receiver the channels number 2, 3, 6 and 9 can
output PWM signals, so there I connected the Enable pins of the
driver to the channels number 2 and 6 in this case.
/*
by Dejan, www.HowToMechatronics.com
*/
#include <SPI.h>
#include <nRF24L01.h>
#include <RF24.h>
struct Data_Package {
byte j1PotX;
byte j1PotY;
byte j1Button;
byte j2PotX;
byte j2PotY;
byte j2Button;
byte pot1;
byte pot2;
byte tSwitch1;
byte tSwitch2;
byte button1;
byte button2;
byte button3;
byte button4;
};
Data_Package data; //Create a variable with the above structure
int motorSpeedA = 0;
int motorSpeedB = 0;
void setup() {
pinMode(enA, OUTPUT);
pinMode(enB, OUTPUT);
pinMode(in1, OUTPUT);
pinMode(in2, OUTPUT);
pinMode(in3, OUTPUT);
pinMode(in4, OUTPUT);
//Serial.begin(9600);
radio.begin();
radio.openReadingPipe(0, address);
radio.setAutoAck(false);
radio.setDataRate(RF24_250KBPS);
radio.setPALevel(RF24_PA_LOW);
resetData();
}
void loop() {
// Check whether we keep receving data, or we have a connection between the two
modules
currentTime = millis();
resetData(); // If connection is lost, reset the data. It prevents unwanted behavior, for
example if a drone jas a throttle up, if we lose connection it can keep flying away if we dont
reset the function
if (radio.available()) {
radio.read(&data, sizeof(Data_Package)); // Read the whole data and store it into the
'data' structure
// Parse the data from the Joystic 1 to the throttle and steering variables
throttle = data.j1PotY;
steering = data.j1PotX;
digitalWrite(in2, LOW);
digitalWrite(in3, HIGH);
digitalWrite(in4, LOW);
// Convert the declining throttle readings for going backward from 110 to 0 into 0 to 255
value for the PWM signal for increasing the motor speed
digitalWrite(in1, LOW);
digitalWrite(in2, HIGH);
digitalWrite(in3, LOW);
digitalWrite(in4, HIGH);
// Convert the increasing throttle readings for going forward from 140 to 255 into 0 to
255 value for the PWM signal for increasing the motor speed
else {
motorSpeedA = 0;
motorSpeedB = 0;
// Convert the declining steering readings from 140 to 255 into increasing 0 to 255 value
// Move to left - decrease left motor speed, increase right motor speed
if (motorSpeedA < 0) {
motorSpeedA = 0;
motorSpeedB = 255;
// Convert the increasing steering readings from 110 to 0 into 0 to 255 value
// Move right - decrease right motor speed, increase left motor speed
motorSpeedA = motorSpeedA + xMapped;
motorSpeedA = 255;
if (motorSpeedB < 0) {
motorSpeedB = 0;
// Prevent buzzing at low speeds (Adjust according to your motors. My motors couldn't
start moving if PWM value was below value of 70)
motorSpeedA = 0;
motorSpeedB = 0;
void resetData() {
// Reset the values when there is no radio connection - Set initial default values
data.j1PotX = 127;
data.j1PotY = 127;
data.j2PotX = 127;
data.j2PotY = 127;
data.j1Button = 1;
data.j2Button = 1;
data.pot1 = 1;
data.pot2 = 1;
data.tSwitch1 = 1;
data.tSwitch2 = 1;
data.button1 = 1;
data.button2 = 1;
data.button3 = 1;
data.button4 = 1;
So, once we read that data, we can do whatever we want with it.
In this case, we will use the Joystick 1 Y-axis value for controlling
the throttle and the X-axis value for controlling the steering. I
put this data into separate throttle and steering variables. The
values we are getting from the joysticks are from 0 to 255. So, if
we move the joystick down, we will set the driver control pins
appropriately so the car moves backwards, and use the throttle
value for controlling the speed of movement. The same
principle applies for driving forward, left and right. Again, I
already have a detailed tutorial on how this car works so you
can check that out for better understanding. At the bottom of
the code we can note the resetData() custom function, which
reset all values to their initial default values so in case the radio
communication is lost, the car will spot moving.
Brushless Motor
……………………….. Amazon / Banggood / AliExpress
ESC 30A
……………………………………… Amazon / Banggood / Ali
Express
Li-Po battery ……………………..
…… Amazon / Banggood / AliExpress
MG996R Servo Motor
……………… Amazon / Banggood / AliExpress
Disclosure: These are affiliate links. As an Amazon Associate I
earn from qualifying purchases.
The input signals for controlling both servos and brushless
motors using ESCs are almost the same. They use specific 50Hz
PWM signal which can be easily generated using the Arduino
Servo library.
Note: When using MG996R servos with this setup, they might
cause a problem in the circuit and burn the Arduino Pro Mini.
The might draw a higher current and which could cause voltage
spikes at the 5V rail. The Arduino Pro Mini should handle up to
5.5v at the 5V pin, but when those spikes occur that might burn
the Arduino. I had this problem when testing the circuit, and
someone in the comments section also reported the same. A
solution to this might be place a bigger decoupling capacitors
at the servos but I’m not quite sure and I haven’t tested it. So
please be aware of this problem.
/*
by Dejan, www.HowToMechatronics.com
*/
#include <SPI.h>
#include <nRF24L01.h>
#include <RF24.h>
#include <Servo.h>
Servo servo1;
Servo servo2;
struct Data_Package {
byte j1PotX;
byte j1PotY;
byte j1Button;
byte j2PotX;
byte j2PotY;
byte j2Button;
byte pot1;
byte pot2;
byte tSwitch1;
byte tSwitch2;
byte button1;
byte button2;
byte button3;
byte button4;
};
void setup() {
Serial.begin(9600);
radio.begin();
radio.openReadingPipe(0, address);
radio.setAutoAck(false);
radio.setDataRate(RF24_250KBPS);
radio.setPALevel(RF24_PA_LOW);
resetData();
servo1.attach(4); // D4 - CH1
servo2.attach(5); // D5 - CH2
void loop() {
// Check whether we keep receving data, or we have a connection between the two
modules
currentTime = millis();
resetData(); // If connection is lost, reset the data. It prevents unwanted behavior, for
example if a drone jas a throttle up, if we lose connection it can keep flying away if we dont
reset the function
if (radio.available()) {
radio.read(&data, sizeof(Data_Package)); // Read the whole data and store it into the
'data' structure
// Controlling servos
servo1Value = map(data.j2PotX, 0, 255, 0, 180); // Map the receiving value form 0 to 255
to 0 to 180(degrees), values used for controlling servos
servo1.write(servo1Value);
servo2.write(servo2Value);
escValue = map(data.j1PotY, 127, 255, 1000, 2000); // Map the receiving value form 127
to 255 to 1000 to 2000, values used for controlling ESCs
esc.writeMicroseconds(escValue); // Send the PWM control singal to the ESC
void resetData() {
// Reset the values when there is no radio connection - Set initial default values
data.j1PotX = 127;
data.j1PotY = 127;
data.j2PotX = 127;
data.j2PotY = 127;
data.j1Button = 1;
data.j2Button = 1;
data.pot1 = 1;
data.pot2 = 1;
data.tSwitch1 = 1;
data.tSwitch2 = 1;
data.button1 = 1;
data.button2 = 1;
data.button3 = 1;
data.button4 = 1;
So, using jump wires I connected these pins to the VCC pin of
the Arduino, and also connected the 4 control input pins of the
driver to 4 digital channels. As I said, this driver supports PWM
control, so for the motor B, or the rear motor, I used the PWM
channels number 2 and 3.
You can get the components needed for this example from the
links below:
MGRC RC Car
………………………………… Amazon / Banggood / AliExp
ress
MX1508 DC Motor Driver
……………… Amazon / Banggood / AliExpress
Breadboard and Jump Wires
………… Amazon / Banggood / AliExpress
Disclosure: These are affiliate links. As an Amazon Associate I
earn from qualifying purchases.
The code for this RC car is very similar to the first example.
/*
Arduino RC Receiver - RC Model control
by Dejan , www.HowToMechatronics.com
*/
#include <SPI.h>
#include <nRF24L01.h>
#include <RF24.h>
struct Data_Package {
byte j1PotX;
byte j1PotY;
byte j1Button;
byte j2PotX;
byte j2PotY;
byte j2Button;
byte pot1;
byte pot2;
byte tSwitch1;
byte tSwitch2;
byte button1;
byte button2;
byte button3;
byte button4;
};
int motorSpeedA = 0;
int motorSpeedB = 0;
void setup() {
pinMode(in1, OUTPUT);
pinMode(in2, OUTPUT);
pinMode(in3, OUTPUT);
pinMode(in4, OUTPUT);
Serial.begin(9600);
radio.begin();
radio.openReadingPipe(0, address);
radio.setAutoAck(false);
radio.setDataRate(RF24_250KBPS);
radio.setPALevel(RF24_PA_LOW);
resetData();
void loop() {
// Check whether we keep receving data, or we have a connection between the two
modules
currentTime = millis();
resetData(); // If connection is lost, reset the data. It prevents unwanted behavior, for
example if a drone jas a throttle up, if we lose connection it can keep flying away if we dont
reset the function
if (radio.available()) {
radio.read(&data, sizeof(Data_Package)); // Read the whole data and store it into the
'data' structure
// Parse the data from the Joystic 1 to the steering and throttle variables
steering = data.j2PotX;
throttle = data.j1PotY;
// Convert the declining throttle readings for going backward from 110 to 0 into 0 to 255
value for the PWM signal for increasing the motor speed
analogWrite(in3, motorSpeedB);
digitalWrite(in4, LOW);
// Convert the increasing throttle readings for going forward from 140 to 255 into 0 to
255 value for the PWM signal for increasing the motor speed
digitalWrite(in3, LOW);
analogWrite(in4, motorSpeedB);
else {
digitalWrite(in3, HIGH);
digitalWrite(in4, HIGH);
digitalWrite(in1, HIGH);
digitalWrite(in2, LOW);
digitalWrite(in1, LOW);
digitalWrite(in2, HIGH);
else {
digitalWrite(in1, HIGH);
digitalWrite(in2, HIGH);
}
}
void resetData() {
// Reset the values when there is no radio connection - Set initial default values
data.j1PotX = 127;
data.j1PotY = 127;
data.j2PotX = 127;
data.j2PotY = 127;
data.j1Button = 1;
data.j2Button = 1;
data.pot1 = 1;
data.pot2 = 1;
data.tSwitch1 = 1;
data.tSwitch2 = 1;
data.button1 = 1;
data.button2 = 1;
data.button3 = 1;
data.button4 = 1;
1.
Biszku Gábor
January 10, 2021 at 11:05 pm
Hi Dejna
Reply
Dejan
January 13, 2021 at 5:23 pm
Hey, thanks! Well it has 9 channels so yes, it can
control 2 servos and 6 DC motors at the same time.
Reply
2.
Jette
June 23, 2020 at 8:48 am
Hi, Dejan. Thank you very much for the great project. I
found the Arduino Pro mini can’t provide enough power
for MG996R. Is it possible to add a mini dc converter to
the pcb? MP1584EN or mini360 is a great one for instance.
Thank you again.
Reply
Dejan
July 11, 2020 at 4:11 pm
That’s true, the Arduino Pro mini can’t provide
enough power for a MG996R servo, so adding a DC
converter to the PCB is good idea.
Reply
Mahargha Debnath
November 24, 2020 at 4:46 am
using the 2nd example’s codes can we control
brushed escs to drive the maximum no. of motors
Reply
Lothar Löwer
January 3, 2021 at 9:10 pm
First of all: Dejan, thank you very much for the
great project. I also build up a transmitter an s
receiver and it works quite good (I still have
problems with the MPU6050).
Hi Mahargha,
of course you can control brushed escs. The
receiver simply generates the signals to control
the speed of an esc or servo. But – in case you
use more than one esc with a BEC circuit –
please disconnect the +5V wires of the other
escs to ensure to use a single 5V voltage
supply.
Reply
3.
Sonu prajapati
June 11, 2020 at 8:46 am
Sir can we use in this project l298 as a motor controller
Reply
Dejan
June 22, 2020 at 7:27 am
Yes, you could use the L298 motor controller in
combination with this RC receiver.
Reply
4.
AJ
May 16, 2020 at 2:35 pm
Hey Dejan, is it compulsory to use 0.1 uf capacitor or any
other value is fine .
Reply
Dejan
May 18, 2020 at 9:46 pm
You can use anything similar or close to it.
Reply
5.
Wolfgang Rupp
May 4, 2020 at 10:52 am
Hi,i have a
question, also connect other servos to the reciver or only
the SG90?
If I use other servos the Arduino pro mini has problems ….
because of the load/ amp ?……
when i that servo MG995 with the reciver connect has the
arduino mini pro malfunction
he function then not more…..
Can you help me?
greetings
Wolfgang Rupp
Reply
Dejan
May 5, 2020 at 6:34 am
Hey, I’m sorry to hear that. But the same happened
to me. I though it was a problem with my particular
MG996R motors that I used. They malfunction my
Arduino too.
I tried other two MG996R servos and it worked. In
the example with the plane I also tried 4 SG90 and it
works.
Nevertheless I guess the problem is with the current
the MG996R draw and they somehow cause a
voltage spike higher that 5.5V, and that burns the
Arduino Pro Mini.
Not quite sure, but maybe if you place bigger
decoupling capacitors at the servos could help with
this problem.
Or you can use separate 5V power supply, instead of
the 5V from PCB board.
Sorry about the inconvenience. I will add this note in
the article as well so people will be aware of it.
Reply
Wolfgang Rupp
May 5, 2020 at 8:26 am
Hi,
is all good, your projects are verry good, the
arduino pro mini 5v can only 40mA per exit, i
have then the servos separately with electricity
provided, and works perfect, also without
interference, the MG 995 Servos have, too with
me Interference caused.
As soon as I the MG 995 Servo with the Arduino
pro mini connect,bother something
if my project is
finished i will send a video,
Reply
6.
Andrzej
May 3, 2020 at 2:18 pm
Hi. Great project! I have a question: if we use two identical
sets of transmiter-receiver, can we control two models
independently at the same time, at the same frequency?
Reply
Dejan
May 4, 2020 at 6:44 am
Hey, thanks! Yes, you can change the channel or the
name of the “address” variable in the code.
Reply
7.
james
April 21, 2020 at 12:37 pm
It would be a great event to be able to control your
motorized slider camera with pan and tilt with your
arduino rc transmitters and arduino rc receiver. Will you be
able to do this; it would be your masterpiece. Hello and
many compliments for your pages.
Reply
Dejan
April 22, 2020 at 3:02 pm
Hey, thanks for the comment. It’s true, controlling
the motorized camera slider project with the DIY RC
transmitter would be really awesome. But I’m afraid,
currently I don’t have the time to modify that project.
In such a case, the PCB will have to be modified and
also the code. It’s not that it’s too hard or it has too
much work on it, it’s simple and old project to which
I don’t think of going back to it for now. Anyway, if
you understand well how the transmitter and the
receiver work, you should be able to implement it on
your own.
Reply
8.
umar abdullah mohd pauzi
April 18, 2020 at 11:05 am
hi dejan.just one quick question.are the PCB single layer or
double layer?because i do not know how many layer to
choose when ordering from JLPCB.really appreciate your
help.
Reply
Dejan
April 18, 2020 at 12:29 pm
Hey, it’s a 2 layer PCB.
Reply
9.
Wolfgang Rupp
April 11, 2020 at 10:35 pm
Hi Dejan,
I hope you are fine,………
the transmitter is finished and works perfectly, once took
the sketch from the hovercraft, works very well ………..
only for the Arduino pro Mini the new version I had to lay
two wires for the pin 4 and 5 on the transmitter board …….
I’m eagerly waiting for your new receiver projects …
Wish you a happy Easter and health
greeting
Wolfgang Rupp from Germany
Reply
10.
Wolfgang Rupp
April 2, 2020 at 12:20 pm
Hello Dejan,
everything was regulated with the order of the boards
from JLCPCB, I had ordered 5 boards, but the ordering
process turned into 5 orders, no idea how this could have
happened, but now everything is okay, boards are
ordered, now it says waiting….
Reply
Dejan
April 2, 2020 at 1:02 pm
Hey, that’s great!
Yes, we can fine-tine the RC plane rudder with the
potentiometer. I will also include sensitivity control
with the second potentiometer. I mean, we can add
many features, it’s all about how we can program the
receiver.
Stay tuned, the project is coming in a week or
two.
Reply
11.
Paul
April 2, 2020 at 1:34 am
Hello Dejan,
Would it be possible for you to export the gerber files of
your Transmitter and Receiver PCBs as a stp.file?
I would greatly appreciate this, so i can print custom cases
for both!
Sadly i can not work with just the gerber files and fusion, a
trial and error approach using the pictures would be
possible, but will waste filament, which right now is better
used for face shields!
Again, i would appreciate it very much if you could help
with that.
Reply
Dejan
April 2, 2020 at 10:19 am
Hey, I don’t have a .stp file from the PCBs and I’m not
sure how I can make one. The gerber files is all I
have, plus I guess you have already checked the
EasyEDA project files, I’m not sure if that would be of
any help, but maybe it will. You could use the
measuring tool there to get the precise dimensions,
but that would be the same as measuring the
physical PCB by hand. Let me know if you think of
any other idea how to make .stp files for 3D printing.
Reply
Paul
April 2, 2020 at 7:03 pm
Hi Dejan,
you guessed wrong and that helped!
I totally missed that EasyEDA project link and its
useability for my build, I was able to export it as
.dxf-File, which will be usable in Fusion360!
Thanks for the reminder, now i can design a
proper Case
Thank you.
Reply
12.
Wolfgang Rupp
April 1, 2020 at 11:47 am
Hi,
thanks for the quick help,
I got in touch with JLCPCB this morning and sent the zip
file again. I’m still waiting for an answer ……
This is my third order from JLCPCB, the Gerber files from
your project RC Sender and the Range Measurer and
Digital Spirit Level were also flawless ……..
I will write to you as soon as I hear something
greeting
Wolfgang Rupp
Reply
13.
Wolfgang Rupp
March 31, 2020 at 5:31 pm
Hi Dejan,
I hope all of you are healthy,
I am overwhelmed by the new project, that is exactly what
I was looking for, I almost finished the transmitter, I just
had to put the two pins A4 and A5 with short cables to the
pins on the board, since I used the Arduino pro mini in the
(old version) nowhere to be found.
Your new project
is exactly the right thing, as we should stay at home here
in Germany.
This is my second project of yours, the first was Range
Measurer and Digital Spirit Level, which I copied, it works
great.
Thank you for the new project, stay healthy.
Warm greetings from Germany
Wolfgang Rupp
Reply
Dejan
April 1, 2020 at 6:50 am
Hey, thank you, I’m glad to hear it! Have fun
building!
Reply
Wolfgang Rupp
April 1, 2020 at 9:24 am
Hy,
I ordered the boards yesterday evening with
the Gerber file: DIY Arduino RC Receiver PCB v2
– Gerber file
and JLCPCB support,
support wrote me this answer this morning.
Hi sir
Well got your order with many thanks ~
gr
Wolfgang Rupp
Reply
Dejan
April 1, 2020 at 10:59 am
Hey, I’ve just checked the PCB and the
gerber file, they look fine. I’m not sure
what happened. Maybe try to cancel that
order and make a new one. And please let
me know whether you managed to order
the PCB.
Reply
Leave a Comment
Comment
NameEmailWebsite
YouTube
Facebook
Patreon
Table of Contents
1. Arduino RC Receiver Circuit Diagram
2. PCB Design
2.1. DIY Arduino RC Receiver PCB v1 - Gerber file
2.2. DIY Arduino RC Receiver PCB v2 - Gerber file
3. PCB Assembly
4. Exemplo 1 – Carro RC Arduino
5. Exemplo 2 – Servos do Receptor RC Arduino e Controle de Motores
Brushless
6. Exemplo 3 - Controle de Modelo de Carro RC
denunciar este anúncio
PROJETOS EM DESTAQUE
denunciar este anúncio
Como mecatrônica
HowToMechatronics é um site de educação na área de
Engenharia Mecânica, Elétrica e de Computação. Tutoriais,
Dicas, Truques, Como Funciona, Projetos, Exemplos, Códigos
Fonte, Download de arquivos e muito mais podem ser
encontrados aqui.
Divulgação
HowToMechatronics é um participante do Amazon Services LLC
Associates Program, um programa de publicidade de afiliados
projetado para fornecer um meio para os sites ganharem taxas
de publicidade por publicidade e links para a Amazon.com
Copyright © 2022 HowToMechatronics.com. Todos os direitos
reservados. Termos e Condições | Política de Privacidade
x