Turnigy SCT 2WD Calibrating and testing with Arduino

Hi everyone!

Meanwhile the Kabuto’s chassis is done, I have joined a GPS-ROVER project which is based on an RC CAR (Turnigy SCT 2WD). The goal is to reach points outdoors based on GPS coordinates. I think nowadays it is not big challenge but I have never done it before, so now it’s a good opportunity.
20131019210

I’m not familiar with RC cars so first I will try to understand the basics. After reading the manual and doing some research I figured out that in order to make the Electric Speed Controller( or ESC in short) work you need to calibrate it after you turned it on.
20131019208
In the manual of the ESC you can read the following:
1. Move the throttle stick at the end point of forward direction and switch on the ESC, the motor sounds 1 short tone.
2. Wait for 6 seconds, the motor sounds 1 long tone(this means already got the top point of forward direction), at this moment move the throttle stick at the end of backward direction.
3. Wait for 3 seconds, when hear 1 long tone (that means it already got the top point of backward direction), then move the throttle stick at the neutral point.
4. First the motor sound 1 short tone, wait for 1 second, it sounds 1 triplets “di-be-du-” (this means it got the neutral position already). Then the ESC can work properly

This means I need to get a remote controller or something that imitates it. I have chosen the second option.
The remote controller sends PWM signals to the ESC, so an Arduino will be perfect for that.
20131020213
I used the 9th. pin (PWM pin) and I only connected that one and the ground to the ESC.

You can communicate with the ESC as if it was a servo so I used the Servo library of the Arduino with the serial through USB. The program is simple, you can send numbers 0 to 179 and 200 through the serial monitor of the Arduino development environment(without endline). The 0 is moving backward at full speed, 90 is idle, 179 forward at max speed and 200 is calibration mode as it was in the guide that mentioned before.

#include <Servo.h>

Servo esc;
int throttle = 0;
void setup()
{
  
  Serial.begin(9600);
  esc.attach(9);
  
}

void loop()
{
  //
  int readdata = 0;

  if (Serial.available() > 0) {
    // read the incoming byte:
    readdata = Serial.parseInt();
    if(readdata==200){

      Serial.println("CALIBRATION MODE IN 2 SEC");
      delay(1000);
      Serial.println("CALIBRATION MODE IN 1 SEC, NOW TURN ON THE ESC");
      delay(1000);
      /* 1. Move the throttle stick at the end 
       * point of forward direction and switch on 
       * the ESC, the motor sounds 1 short tone.
       */
      Serial.println("WRITING MAX VALUE");
      esc.write(179);
      /* 2. Wait for 6 seconds, the motor sounds 
       * 1 long tone(this means already got the
       * top point of forward direction), at this 
       * moment move the throttle stick at the end 
       * of backward direction.
       */
      delay(6000);
      Serial.println("WRITING MIN VALUE");
      esc.write(0);
      
      /* 3. Wait for 3 seconds, when hear 1 long tone
       * (that means it already got the top point of 
       * backward direction), then move the throttle 
       * stick at the neutral point.  
       * 
       */
      delay(3000);
      Serial.println("WRITING MIDDLE VALUE");
      esc.write(90);
      /* 4. First the motor sound 1 short tone, wait 
      *  for 1 second, it sounds 1 triplets "di-be-du-"
      *  (this means it got the neutral position already).
      *  Then the ESC can work properly
      */
      delay(1000);
      Serial.println("DI DU DI");
      readdata=90;
    } 
    if (0>readdata){
      readdata=0;
    }
    else if(179<readdata){
      readdata=179;
    }

    throttle=readdata;
    // say what you got:
    Serial.print("I received: ");
    Serial.println(readdata, DEC);

  }
  
  esc.write(throttle);
  delay(500);
}

This is good for testing and understanding how the ECS works with an Arduino. Next time I will create better code and also attach the wheel servo to the Arduino to make it move.

Final thoughts: This RC is maybe too much for a robot. When I tried at full power the wheels gave me better wind than my fan. I think I have to look for safety measures or my robot may end up swimming in the Danube river.

References:
http://dronesandrovs.wordpress.com/2012/11/24/how-to-control-a-brushless-motor-esc-with-arduino/

Advertisements

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s