Pages: [1]   Go Down
Author Topic: How to use Arduino board to control R/C speed controller?  (Read 1662 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 17
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi,

I am trying to use my arduino uno board to control my R/C car's speed controller. But I don't know how to make circuit and what should I write on Arduino IDE.

Please give me some advice. Thanks a lot.
Logged

Global Moderator
UK
Offline Offline
Brattain Member
*****
Karma: 310
Posts: 26620
I don't think you connected the grounds, Dave.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Use the Servo library, if it is a standard RC ESC.
Logged

"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

Offline Offline
Newbie
*
Karma: 0
Posts: 17
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks for replying

i don't know how to check whether my RC esc is standard or not.

i  tried Servo library, it didn't work.

The following is what i wrote on Arduino IDE


Code:
#include<Servo.h>

Servo esc;

void setup()
{
esc.attach(9);
}

void loop()
{
esc.write(180);
delay(150);
esc.write(0);
delay(150);
}

My esc's white wire is connected to pin 9. Black wire is connected to GND.
Logged

Global Moderator
UK
Offline Offline
Brattain Member
*****
Karma: 310
Posts: 26620
I don't think you connected the grounds, Dave.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
i don't know how to check whether my RC esc is standard or not.
You haven't told us what it is either, so that makes it doubly difficult.
It may have an arming sequence that you're not sending it.
Logged

"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

Offline Offline
Sr. Member
****
Karma: 6
Posts: 429
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

http://techvalleyprojects.blogspot.co.uk/2012/06/arduino-control-escmotor-tutorial.html
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 17
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

My EEC is Tamiya TEU104BK, it is made for RC cars. I am not true that whether it is different from ESCs for RC airplane.

Does anyone have same experience as I have?

Thanks for you teaching.
Logged

UK
Offline Offline
Tesla Member
***
Karma: 141
Posts: 7970
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

This part of your code

Code:
void loop()
{
esc.write(180);
delay(150);
esc.write(0);
delay(150);
}

turns the motor on and off (or off and on) every 150 milliseconds.

I would start with a program that just turns the motor on and leaves it running such as ...

Code:
void setup()
{
   esc.attach(9);
   esc.write(45);
}

void loop() {

}

And then I would try changing the esc.write values to see what happens.

If the car can go forwards and backwards it is possible that the central servo position (90) = stop and 0 and 180 represent full forward and full reverse. It is also possible the the ESC needs a separate channel signal for fwd and rev.

...R
Logged

Dubai, UAE
Offline Offline
Edison Member
*
Karma: 22
Posts: 1675
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi,
   Its a very standard Car ESC with forwards and reverse.

I would try

void setup()
{
 esc.Attach(8);

 // set the centered position to arm the ESC
 esc.writeMicroseconds(1500);

 // stay centered for 5 seconds
 delayMicroseconds(5000);
}

then in your loop, use esc.writeMicroseconds to send values between 1000 (full reverse) 1500 (centered=neutral) and 2000 (full forwards).

To see where I get these values from, read this -

http://rcarduino.blogspot.ae/2012/01/how-to-read-rc-receiver-with.html

Duane B

rcarduino.blogspot.com


Moderator edit: turned off smileys
« Last Edit: April 18, 2013, 03:28:30 am by Coding Badly » Logged


Offline Offline
Newbie
*
Karma: 0
Posts: 17
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks for your replying. There are all useful. Because of these useful replying, my project have a chance to be continue.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 17
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

When i was using DuaneB's code, my RC motor can run forward. But when i want to my motor run backward, it couldn't work.

The following is my code:
Code:
#include<Servo.h>

Servo esc;

void setup()
{
esc.attach(8);

esc.writeMicroseconds(1500);
delayMircroseconds(5000);
}

void loop()
{
esc.writeMicroseconds(1600);
delay(1500);
esc.writeMicroseconds(1200);
delay(1500);
}
It suppose that the motor should run forward, wait for 1500 microseconds and run backward. It didn't run like what it supposed to be. Please give me some help.

By the way,did the code esc.wrtieMicroseconds which was in "void setup()" mean the center point of ESC is 1500?
Logged

Dubai, UAE
Offline Offline
Edison Member
*
Karma: 22
Posts: 1675
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

The ESC is designed to put the brakes on the first time you enter reverse after travelling forwards - this is to protect the gears, the can easily get damaged when going from full speed ahead to full speed reverse.

To enter reverse you will need to go reverse, neutral, reverse so 1300,1500,1300

Duane B

rcarduino.blogspot.com
Logged


Global Moderator
UK
Offline Offline
Brattain Member
*****
Karma: 310
Posts: 26620
I don't think you connected the grounds, Dave.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
It suppose that the motor should run forward, wait for 1500 microseconds and run backward.
You need to be careful distinguishing your millis and your micros.
Code:
delay(1500)
is a delay of 1.5 seconds.
Logged

"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

Pages: [1]   Go Up
Jump to: