Controlling a Traxxas ESC with an Arduino

Controlling a Traxxas ESC with an Arduino

These are my notes for getting an Arduino Uno to control a Traxxas Velineon VXL-3s speed controller.

Disclaimer: use this information at your own risk.  I am not responsible for any damage.

Materials Needed

  • Traxxas ESC Velineon VXL-3s
  • Arduino Uno
  • Stock Traxxas 7.2v battery
  • Power cable

First you need to connect one of the Arduino PWM(~) signal pins to ESC connector’s white lead).  Be sure it’s the ESC connector and not the steering servo, they look the same.

Warning:  the other two red and black wires of the speed controller connector are used to supply power to the Traxxas radio receiver and it is 6 volts.  DO NOT use these wires to connect to the 5v and ground pins of the Arduino or it may damage your board since these pins bypass the voltage regulator.  It’s best to send power through the board’s DC plug which can handle a range of 7-12v.

For power, I used a Traxxas battery harness .  I cut off one of the battery connectors and spliced on a DC plug.   This allows powering the Arduino using the Traxxas battery at the same time it is plugged in to the ESC.

 

 

Figuring out the code to “arm” the ESC took some trial and error.  ESCs need a specific sequence of commands before they will turn the motor.  I assume this is for safety reasons, you wouldn’t want to turn on your RC car and have it suddenly take off at 30mph.  I couldn’t find a definitive guide on how to do this for Traxxas, just lots of unanswered forum posts.   For this reason I decided to post my notes in case it helps someone else.

I should also say this is my first time doing this and it may not be the best answer.  It may even be different for other Traxxas models(and it is certainly different for other brands).  I discovered this by accident.  Nothing had worked until I uploaded the Arduino Servo library Sweep sketch included in the IDE.  It loops forwards and backwards through all servo values and it had activated my ESC mysteriously.  From there I was able to narrow it down to a short range in the middle.  A single forward loop incrementally writing to the angles of 90 through 100 with a short delay in between is what it took to arm it.

Sample code:


#include <Servo.h>

Servo throttle;

int pos = 0;
int pin = 3;

void setup() {

   throttle.attach(pin);

   // This loop arms the ESC
   for (pos = 90; pos <= 100; pos += 1) { 
      throttle.write(pos);             
      delay(150);                       
   }
}

void loop() {
    throttle.write(120);
}

Lessons Learned:

  1. I should have removed the wheels.  There were a lot of sudden starts and stops at full speed while debugging.  The mass of the wheels at high speed coming to an instant stop damaged the spur gear.  Removing the wheels might have prevented that.
  2. Traxxas vehicles have a Training Mode which reduces the throttle rate by 50%.  This too might have helped prevent gear damage.

 

One thought on “Controlling a Traxxas ESC with an Arduino

Leave a Reply to andy Cancel reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.