Controlling brushless motor with I2c Pca9685 [RESOLVED]

Hey guys

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

Thanks in advance,
Marco

bicopter_rc_pid2_vAltitude.ino (15.4 KB)

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:

Northof49 Thanks for the answer!!!

To control the brushless motors I a using a esc connected to the arduino.

What I am was wondering is if I can connect the esc to the controller you suggested to also control the brushless motors.

I will give the pca9685 a try I think it will give me the accuracy that i need to have the bicopter steady

If you have any other suggestion pls shoot!!!!

Thanks a lot !!!!!!

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.

You should be able to control all the servos and the ESC (that expects pwm servo like input) off the pca9685 controlled by your Arduino.

Hello!!

I am builfing a bicopter flight controller from scratch

Recently I bought a pca9685. I had no problem controlling the servos with it, but when I try to control the brushless motors I had no luck yet

I was able to arm it with this
servos.setPWM(3,0,1);

But I have no Idea on how to make it run. Which is the min and max throttle. I still not ableto get it right

How can I canfigure the ESC. Like when I start the ESC with the radio controller at full throttle and the move it down to 0 throttle

I hope I was clear

Looking forward to hearing from you guys

Thanks in advance

Marco

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?

Steve

Steve thanks for taking the time.

Sorry for the lack of context.

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

The esc is a generic one running simonk

Hope it helps

Looking forward to hearing from you.
Marco

Guys I finally bought the pca9685. I was able to control the servos but i am having a hard time calibrating and controling my two brushless motors

How do I send the signal of min and max throttle to the esc using the adafruit_pwmservodriver library?

Thanks,
Marco

Guys any idea on this?

Thanks

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.

Bob.

Sorry for that my mistake

Any idea on how should i make the communication between the pca and the esc?

Thanks

Hey guys Y found the answer

I use a 50hz frequency

and the 0 throttle is a value of 210 and full throttle 410

If anyone needs the code just let me know

Hi Rossi86m,
I need to know how did you controlled your motor with pca9685, thanks alot

Hey how are you!!!

Sure

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

Cheers,
Marco

1 Like