Home        Store        Docs        Blog

What causes this?


(Richard) #1

@Rusty-

With the ESC powered and connected to a motor, and you plug in a live USB connection to the processor, a spurious full RPM signal is sent to the motors.

If the processor is externally powered from the control box (12v), and then you plug in the USB cable, all’s well.

The problem with having to have the control box power on is when you forget to center the motor speed control on the box. In any event it is a problem that could prove destructive.

I don’t want to have to remove an end cap and disconnect ESC power every time I make a program change.

During my PID testing a lot of changes are being made.

Thanks, Richard

 


(Rusty) #2

Richard,

Most likely a signal is being sent to the ESC. We’ve seen this happen when the Arduino is unplugged or reprogrammed, because the PWM signal can get cut short, resulting in a valid control signal. I’m not sure what would cause this on power up.

Can you explain what’s happening in a bit more detail? If I understand correctly, you have the motors powered, but not the Arduino. You then plug the Arduino into a USB port and the motors immediately spin to full throttle. Is that correct?

Best,

Rusty


(Richard) #3

Rusty, when making program changes for PID calibration I only remove the rear end cap to give access to the USB port. The motor battery disconnect is accessed from the front end cap, so power remains on to the ESC/motor.

On processor program startup, a 1500 usec pulse is sent to the ESC, then a 2 second delay.

void setup(){
Serial.begin(9600);
mag.begin(); //LSM303 initialize
rightMotor.attach(rightESCpin);
pinMode(rightESCpin, OUTPUT);
pinMode(autoHdgPin,INPUT);
//Initialize ESC
rightMotor.writeMicroseconds(1500);
delay(2000);
}

With no external (12v) power applied to the Arduino processor, when the USB port is connected to the computer, a high speed runaway occurs. If external power is first connected before plugging in the USB, this runaway does not occur.

Turning on external power to the processor never causes this problem, so it is not a power surge issue. It must have something to do with the Serial.begin initialization, but I don’t see how. You would think the 1500 usec signal to the ESC would stop the nonsense.

I will change the program to first send the 1500 usec pulse before doing anything else.

 


(Richard) #4

Moving the ESC initialization to the first line of setup() has solved the problem.


(Rusty) #5

Richard,

Glad you figured it out. I’m not sure exactly why that helped. Any ideas?

-Rusty


(Jacob) #6

Did the motors, go full throttle for only a moment, or were they stuck on full throttle after plugging in?


(Richard) #7

Stuck on full throttle. I can’t come up with any reason why.


(Richard) #8

It turns out the problem is in the analog input signal (x) from the control box. I have noted that even after power is removed there is a signal on the analog input A pin showing up on my serial monitor. It is jumping all over but responds to the rheostat movement (now just a variable resistance). Looks like I better puts some 10k pulldowns on those pins. I don’t understand why the pot isn’t doing the same thing. Weird.


(Richard) #9

Okay, with more experimentation I have discovered that when power is removed from the voltage divider feeding the analog pin, an RC circuit is formed using capacitance in the A/D input and resistance from the voltage divider. You can watch the signal to the ESC just decay off below 1500, and the motor takes off. So a 10k pulldown is definitely not the fix. The only solution is to unplug the USB cable before killing control power. Everyday it is something new!