Go Down

Topic: How to use Arduino board to control R/C speed controller? (Read 1 time) previous topic - next topic

tomyhu1995

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.

AWOL

"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.

tomyhu1995

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: [Select]
#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.

AWOL

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.
"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.


tomyhu1995

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.

Robin2

This part of your code

Code: [Select]

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: [Select]

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

DuaneB

#7
Apr 18, 2013, 10:26 am Last Edit: Apr 18, 2013, 10:28 am by Coding Badly Reason: 1
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

tomyhu1995

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

tomyhu1995

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: [Select]

#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?

DuaneB

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

AWOL

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: [Select]
delay(1500)
is a delay of 1.5 seconds.
"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.

Go Up