Strange ESC working

Hi guys!

I used an Arduino Uno to controll the Hobbywing 1060 Brushed ESC. I used a simple code in Arduino. This code works fine, i can control the ESC speed, and the direction of motor rotating.

But! Sometime the ESC controll the motor wrong. I didn’t push the remote but the motor start running for 1 sec… Any idea why??

A video from the problem:

#include <Servo.h>
Servo motor1;                     

void setup() {
 pinMode(11, OUTPUT); 
 pinMode(6, INPUT);             

void loop() {
 int motor=pulseIn(6, HIGH);                         

Maybe pulseIn times-out.

Some debug prints should help you find out.

BTW, pulseIn returns unsigned long, not int.

Does the ESC need setting up when you power everything up.
What does the manual for the ESC tell you?

Can you please post a copy of your circuit, in CAD or a picture of a hand drawn circuit in jpg, png?

How are you powering the Arduino, what model, and powering the ESC?
Do you have a gnd connection between the ESC and the Arduino?

Tom.. :slight_smile:

There is actually an ESC library specifically designed for ESC's, based upon the Servo library.

I am using the library for my ESC and I have never had any weird things happen.

Here is a link to the creator(s) website from where you should be able to get the library (Arduino IDE has it listed as RC_ESC).

RC_ESC Library

Hope it helps!

PS: I have never bothered to use the Servo library (never knew you could use it) because I researched the ESC implementation with Arduino first and came across the ESC library before reading about the Servo library.