Pages: [1]   Go Down
Author Topic: Controlling ESC with Arduino  (Read 2249 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 6
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hey All,

Officially i am new to this forum, though i have been looking through this, and the old forum for quite some time lol.

However I have recently run into a problem with trying to control an ESC with my uno that i have been unable to solve even after looking through all the forums. I mean I have been playing with this for quite some time trying to replicate the signal that should be sent to the ESC with the Arduino. I know what PWM values are sent from the original receiver, however I dont seem to be able to use this to make the motor work.

Is there some form of start up siginal that i have to send to it first, or is my understanding of how to produce a PWM for it fundamentally wrong? Is there anyone who could take the time to walk through this with me, or supply me with some well documented source code? It would really be appreciated.

The ESC is a SP-03058 from HSP if that helps (it didnt help me as i couldnt find any info on it lol)
Logged

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

Oh and i realise i forgot to say that as a side note the reason i put this in robotics and not hacking was because i plan on combining this(and motor) with an ultrasonic sensor and GPS to create a small object avoiding robot, which will navigate to a given co-ordinate.
Logged

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

Quote
I know what PWM values are sent from the original receiver, however I dont seem to be able to use this to make the motor work.
If this is an R/C ESC, you should be sending PPM, not PWM.
Try using the Servo library.
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: 6
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hey AWOL,

Thanks for that. Your right it is an rc one and Yea I read a few things about ppm. But I don't really understand what it is. And how do I set it up so that the servo library controls the esc? I'm sorry I'm still a little stumped. Could you tell me a bit more about it. Or maybe give me an example. Thanks again smiley
Logged

Leeds, UK
Offline Offline
Full Member
***
Karma: 0
Posts: 134
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

This is how did it, I found that out by reading through this thread.

You could probably swap in the standard servo library as well.

Logged

0
Offline Offline
Tesla Member
***
Karma: 116
Posts: 8944
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Using google to search the forum provides some reading material on ESCs.

http://www.google.com/search?q=esc+arm+site%3Aarduino.cc%2Fforum%2Findex.php&hl=en&num=100&lr=&ft=i&cr=&safe=images&tbs=
Logged

Consider the daffodil. And while you're doing that, I'll be over here, looking through your stuff.   smiley-cool

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

Hey guys so i think i have an understanding of how the ESC works now, thanks heaps for that. It appears now that i still need to get the arming value. Can you give me some idea about how to find this value either online or through code? thanks guys
Logged

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

Do you know how to arm it using the transmitter?
Have you got any material on this 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: 6
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Yeah when I turn on the ESC while its plugged in to the transmitter it arms it. and if i read this value of the arduino using pulse in i get that it is High for 1479 and Low for 18131. But i dont know how to replicate this properly. thanks smiley
Logged

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

Quote
of the arduino using pulse in i get that it is High for 1479 and
Have you tried:
Code:
myServo.writeMicroseconds (1479);
?
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: 6
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

hahaha oh wow thanks so much man i didnt know that command existed. Again thanks so much. It was great cause i wasnt expecting it to work and then all of a sudden it ran half way across the room, perhapes i should slow it down a little lol. oh well i am incredibly happy thank you. smiley
Logged

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

Quote
i didnt know that command existed
http://arduino.cc/en/Reference/Servo
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.

0
Offline Offline
Tesla Member
***
Karma: 116
Posts: 8944
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Below is some simple servo test code you can use with the serial monitor that should allow you to test your ESC.

Code:
// zoomkat 10-4-10 serial servo test
// type servo position 0 to 180 in serial monitor
// for writeMicroseconds, use a value like 1500
// for IDE 0019 and later
// Powering a servo from the arduino usually DOES NOT WORK.

String readString;
#include <Servo.h>
Servo myservo;  // create servo object to control a servo

void setup() {
  Serial.begin(9600);
  myservo.writeMicroseconds(2000); //set initial servo position if desired
  myservo.attach(7);  //the pin for the servo control
  Serial.println("servo-test-21"); // so I can keep track of what is loaded
}

void loop() {

  while (Serial.available()) {
    delay(1); 
    if (Serial.available() >0) {
      char c = Serial.read();  //gets one byte from serial buffer
      readString += c; //makes the string readString
    }
  }

  if (readString.length() >0) {
    Serial.println(readString);  //so you can see the captured string
    int n;
    char carray[6]; //converting string to number
    readString.toCharArray(carray, sizeof(carray));
    n = atoi(carray);
    myservo.writeMicroseconds(n); // for microseconds
    //myservo.write(n); //for degees 0-180
    readString="";
  }
}
Logged

Consider the daffodil. And while you're doing that, I'll be over here, looking through your stuff.   smiley-cool

Pages: [1]   Go Up
Jump to: