Go Down

Topic: Problem with controlling ESC with arduino Nano (Read 1 time) previous topic - next topic

Calond

Apr 16, 2018, 12:03 pm Last Edit: Apr 16, 2018, 12:23 pm by Calond
I am building a quadcopter controlling the ESC with arduino. The first two ESC were going fine and working as intended these were located on pin 9&10, but when I hooked up the third one on pin 13 it did not work. (I used those pins, because those pins are PWM pins) I was asking around on reddit and there someone said that pin 9&10 are using 980 hertz and the other pins are using 490 hertz. Is this the issue and is it resolvable? Or is it something else that i did wrong.

Using this code:
https://github.com/RB-ENantel/RC_ESC/

EDIT:
also the tx light goes on when I use the 13 pin. This does not happen with the other pins.

TolpuddleSartre

ESCs usually use servo rate PWM signals, with a frame rate of 50 Hz, and a low duty cycle of around 5 to 10%.
Use the Servo library.

Calond

well the code has an esc library that is based on the servo library. It creates a servo object and adds some extra stuff or should I do it differently?

TolpuddleSartre

Quote
or should I do it differently?
Should you do what differently?

Calond

Should you do what differently?
addressing the esc with different code than I am doing now, because you say i should use the servo library, but the ESC library is based on the servo library.

TolpuddleSartre

I don't understand your question.
If you are using the Servo library, or a library derived from it, then you are not using either 490 or 980 Hz hardware PWM.
The Servo library can use any pin, but disables hardware PWM on pins 9 and 10.

Post code and a schematic if you want answers.

slipstick

Please post the code you're using. Without that it is really difficult to see if you should be doing anything different. The link to the library is interesting and it does appear to use the normal Servo library. But we need to see how you are trying to use it.

Since it is using Servo it doesn't need PWM pins just normal digital pins so pick a different one. Pin13 is usually a bad idea precisely because it is linked to the onboard LED.

Steve

Calond

well i just got my genuine arduino uno in the mail and using pin 6, 9,10 and 11 it works, so maybe it is a faulty arduino nano. I did order it from china for 2 dollars. I will be looking into this and posting my code in a while. Thanks so far

MartinL

Hi Calond,

While ESCs for fixed wing aircraft operate at 50Hz, those for quadcopter use operate at a standard PWM frequency around 490Hz.

I suggest using the analogWrite() function on the pins that use the 490Hz PWM outputs (3, 9, 10 & 11), instead of the servo library.

Go Up