So I've read on some forums that you should not use analogWrite() on ESC's but use the servo library instead. But the servo library is a bit too "slow" since we need something that has a higher refresh rate than 50 Hz since the ESC (Turnigy Multistar 20A) runs at around 400-500Hz according to hobbyking, so I was wondering is there an alternative to the servo library? Or should we just use analogWrite().
Sorry if I haven't made myself clear and thank you for your time
As I understand it the 400Hz is the maximum frequence the ESC can handle.
I don't think there would be a problem with using a lower frequence, but I don't know for sure
It is the servo signal that is sent. It also means that the highest refreshrate would be 500 hz to make room for a 2ms signal.
Perhaps you have a link to the specifications for that high frequency system?
I suspect you could take a look at most multirotor flightcontrollers, for example the pixhawk I linked to.
Most modern tx/rx rc - systems have options for low/high refreshrate which is usually 10/20 ms.
This can give some problems for certain analog servos, but most digital servos are fine.
Ofcource you could argue that hih refresh rates isn't really nessecary when it is a human that controls the input, but that is not the case for multirors and other things that are controlled by gyros and other sensors
This is a picture from my Frsky receiver, the servosignal is 1,5 ms, repeated every 9 ms
Yea, I'm also trying to build a quad and I've been using Basel's code as an example, but he used analogWrite for output, but I've been told I should use the servo library since ESC's expect servo signals so i'll try to speed up the servo signal using the link from Erni.
but I've been told I should use the servo library since ESC's expect servo signals s
A servo signal is just PWM, which is exactly what analogWrite does, but a normal 50Hz R/C signal has a particularly low duty-cycle, typically 5-10%
At this frequency, simple eight bit resolution PWM wouldn't provide fine enough control - the whole range would be covered by just 12 counts.
Erni:
It is the servo signal that is sent. It also means that the highest refreshrate would be 500 hz to make room for a 2ms signal.
Because 2ms represent 100% duty cycle at 500Hz I had assumed that a different range of pulse widths would be used (e.g from 100usecs to 200usecs) but it appears not.