Hi,
Would someone out there know an answer to my Arduino/Brushless motor problem.
I have a standard BLDC motor and ESC which is controlled via a Arduino Zero, its programmed for 1 min on and 1min off to drive a fan.
The 1 min works well at the desired speed etc then after the delay (oneMinute); constant, the motor shuts off for 1 min but beeps every 2 secs untill it turns on after the next 1 min.
How can I stop this beep??
Vimeo link to video for what the 'Beep is"
https://vimeo.com/337397830
cheers
jason
My sketch code is:
const long oneSecond = 1000; // a second is a thousand milliseconds
const long oneMinute = oneSecond * 60;
const long threeMinute = oneMinute * 3;
const long oneHour = oneMinute * 60;
const long twoHour = oneHour * 2;
const long threeHour = oneHour * 3;
int sensorPin = A0; // select the input pin for LDR//
int sensorValue = 0; // variable to store the value coming from the sensor
int speed;
#include <Servo.h>
Servo myservo;
void arm() {
// arm the speed controller, modify as necessary for your ESC
setSpeed(0);
delay(1000); //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()
{
Serial.begin(9600);
myservo.attach(9);
arm();
}
void loop()
{
// read the value from the sensor:
sensorValue = analogRead(sensorPin);
Serial.print("LDR light reading of ");
Serial.println(sensorValue); //prints the values coming from the sensor on the screen
//set speed of the fan from ESC after daylight check
if(sensorValue < 2100)
digitalWrite(9,LOW);
else digitalWrite(9,HIGH);
// sweep up from 0 to to set speed (0 to 100 full speed) in 20 seconds
for(speed = 0; speed <= 40; speed += 5) {
setSpeed(speed);
delay(1000);
}
delay(oneMinute); //run the motor for 1 hr
setSpeed(0);
delay(oneMinute); // stop the motor for 1 hr then loop
}