Hi all,
I am quite new to using motors and PWM signals in general so I am struggling to understand the response of my motors. I have looked around which has helped me understand certain aspects such as the duty cycle, but I can't quite understand why my motors are behaving in the way that they are.
I am currently trying to build a quadcopter and know that the Arduino mega 2560 (the board I am using for this) has 490Hz PWM on certain pins. As I understand it a motor can be driven using analogWrite, which has a range of 0 to 255, 0 being 0% duty cycle and 255 is 100% duty cycle. I have a simonk 30A ESC connected between the Arduino and the Motor (A2212/13T -1000KV), see attached diagram (I made up some of the blocks, but it should be representative. Note I have also powered the Arduino using the USB input instead too with no effect).
As output pin 5 is a 490Hz PWM, that would be a 2000us period. I thought that motors tended to respond between the region of 1000us to 2000us. However, when I went to drive the motor I found that the motors only responded in a around 3% of the analogWrite range (i.e. values of between 20 - 30 as an input to analogWrite). Approximately, at an input of 20, the motor would be at its minimum spin, at 30 it would be pretty much max. To me, this is a Ton time of 156us for the lower range and 236us for the upper range (?). Beyond this range, the motor would eventually just stop, I get no where near 255.
To keep it as simple as possible, I am simply trying to understand why my motor responds between input values of 20 - 30 rather than 0 - 255 in this code pasted below:
int motor = 5;
int val = 0;
void setup() {
pinMode(motor, OUTPUT);
Serial.begin(9600);
}
void loop() {
while (val < 255) { //Simply stepping up through the range, watching the motor.
analogWrite(motor, val);
delay(1000);
val = val + 1;
Serial.print(val);
}
}
Just as a parts list:
- Arduino mega 2560
- A2212/3T Brushless Motor https://www.amazon.co.uk/gp/product/B00O7JKCF8/ref=ppx_yo_dt_b_search_asin_title?ie=UTF8&psc=1
- Simonk 30A ESC https://www.amazon.co.uk/gp/product/B00M93JFWK/ref=ppx_yo_dt_b_search_asin_title?ie=UTF8&psc=1
Any advice would be much appreciated! I can normalise the response within this range if I have to, but I would just like to understand why this operating range is the case. Let me know if I've left any vital info out.
Thanks
Edit: https://photos.app.goo.gl/xQrhXsFc6MqdStbz7 photo wouldn't upload.