I am building a bicopter and for some reason, that i am think is an interference between the timers that i use to control the motors and the interrupts that i use to get the signals from the RC control, I am getting ticks on the servos
Someone recommend me to use a I2c Pca9685 to control both the servos and the motors of the bicopter.
I would like to know your thoughts before doing it
Attached you will find the flight controller code that I am working on
My observation is that using an Arduino to drive servos results in twitching servos. Nothing you would notice while they are in motion, but if they are supposed to stand still, they twitch. Some brands worse than others. I switched to pca9685 and they are rock steady.
What are you using to drive the brushless motors? A standard RC brushless motor controller that takes servo style pwm inputs? Should be as simple as controlling a servo. If so, take a look at this article:
Some of the PCA9685 that I purchased have shipped from the factory with the headers attached. I think these came from AliExpress. Others needed the headers soldered on. (maybe adafruit?)
If I were putting this in a copter, I would want it without headers and just solder on the 4 or so servos worth of headers that I need.
If you post your code it will be easier to help with it. I'm guessing that you're using the Adafruit_PWMServo library but what else you're doing I have no idea. E.g. what PWM frequency have you set?
It might also help to know what ESC you're trying to run because they're not all the same. Have you calibrated the SERVOMIN and SERVOMAX to suit the ESC? What values?
Yes I am using adafruit library.
I am setting the frequency to 60hz
servos.setPWMFreq(60);
When I was using the servo library to set up the motors I used writemicroseconds(2000) as full throttle and writemicroseconds(1000) as no throttle. I don't know how to calibrate it using the pca9685
Topics MERGED.
Please keep it all in the same place and don't throw the same topic around.
That simply wastes peoples time and effort and makes it harder for anyone wanting to help.
Basically testing the motors sending different signals i found out that the max and min throttle of my motors are
//MOTORS #define MIN_THROTTLE 217
** #define MAX_THROTTLE 410**
Then I create my pca
Adafruit_PWMServoDriver servos = Adafruit_PWMServoDriver(0x40);
Then I init the pca void initPCA() {
** servos.begin(); **
** servos.setPWMFreq(50); //Frecuecia PWM de 60Hz o T=16,66ms** }
Then I init the motors void initMotors() {
** servos.setPWM(2,0,204);**
** servos.setPWM(11,0,204);**
** delay(1000);** }
And finally I send the power servos.setPWM(2,0,poweryneg); servos.setPWM(11,0,powerypos);
First parameter is the pin in which the motor is attached and the last one is the power between 217 and 410 in my case
I hope it helps and let me know anything else you need