Brushless Motor Overload Protection

Hello dear Friends

I am proud owner of an Arduino Micro and I would like to use it for a project.
I have here 700W brushless motor, 810KV, 3S LiPo (12V) and a brushless ESC. (uses the same signals as as servo)
I want to use the motor in a bike as some kind of auxiliary motor.
The mechanical part is solved and ready to install, but not the electrical part.

The motor isn't allowed to use more than 60A or it will burn (over long term)
My idea was, to use the Arduino for 2 things:

  1. Sensor the current and throttle the speed of the motor down if its over a certain value (60A)
  2. Getting an input from a button (on/off), if on run motor as fast as possible (unless point 1) interferes) if off don't do anything at all.

I never programmed anything :confused:
Can somebody please help me with the code and choosing the right Amp Sensor?

ACS758 springs to mind for a high current sensor, available in 50A and 100A versions I think. You might
want to add a temperature sensor to the motor as an extra check.

Thanks a lot!
That sensor is what I need.
Definitely precise enough and 100A is great too. (enough space for upgrades ^^ )

Temperature sensor would be great!
Any suggestions here too?

But still the big problem...the programm itself :S

Well I'd start thinking along these lines:

  if (analogRead (current_sensor_pin) > THRESHOLD)
    reduce_motor_drive ();

Temperature sensor could be another analog one, a thermistor, or the popular DS18B20

Thanks a lot!
I read about the temp sensors, analog seems to be quite okay for me.

I get your programm code, yay
But no idea what to do with it.
I made some arduino tutorials, like flashing a LED. And I saw some servo codes.
I managed to start the motor, but then it won't stop anymore :stuck_out_tongue:

#include <Servo.h>

Servo myservo;

const int buttonPin = 2; 
int buttonState = 0;

void arm(){
 // arm the speed controller, modify as necessary for your ESC  
 setSpeed(0);
 delay(2000); //delay 1 second,  some speed controllers may need longer
}

void setSpeed(int speed){
 // speed is from 0 to 100 where 0 is off and 100 is maximum speed
 //the following maps speed values of 0-100 to angles from 0-180,
 // some speed controllers may need different values, see the ESC instructions
 int angle = map(speed, 0, 100, 0, 180);
 myservo.write(angle);    
}

void setup()
{
 pinMode(buttonPin, INPUT);
 digitalWrite(buttonPin, HIGH);
 myservo.attach(9);
 arm();  
}


void loop()
{
 int speed;
 // read the state of the pushbutton value:
 buttonState = digitalRead(buttonPin);

 // check if the pushbutton is pressed.
  // if it is, the buttonState is LOW:
  if (buttonState == LOW) {
    setSpeed(100);
  }
  else{
    setSpeed(0);
  }


 }