Arduino Forum

Topics => Robotics => Topic started by: rossi86m on Aug 22, 2019, 08:43 pm

Title: Servo twitching - Bicopter
Post by: rossi86m on Aug 22, 2019, 08:43 pm
Hey all!

I am building a bicopter for some time now on my free time. I am polishing the last things but there is something i can not fix.

For some reason once I start the brushless motors the servos start moving like crazy and i dont know why

I am using the following parts:
- 12v lipo battery
- 2 2204 brushless motors
- 2 18A simonk esc
- 2 mg90 servos
- mpu6050 gyro
- pca9685 servo driver
- arduino nano
- LM2596S voltage regulator
- 4channel rc receiver

Attached you will find
- My code
- The connection diagram
- A video of how the servos get crazy

Video: https://photos.app.goo.gl/GoPZ3pwnSEA6Dp1t8

Let me know if I am missing something

I appreciate your help

Thanks in advance!
Marco

Title: Re: Servo twitching - Bicopter
Post by: jremington on Aug 23, 2019, 12:01 am
When servos "go crazy", it is almost always due to inadequate servo power supply. Budget for 1 Ampere per servo.

The posted connection diagram is completely useless.
Title: Re: Servo twitching - Bicopter
Post by: rossi86m on Aug 23, 2019, 12:42 am
Thanks for taking the time

Let me know what other info is useful, so you can give  me an answer

Cheers,
Marco
Title: Re: Servo twitching - Bicopter
Post by: jremington on Aug 23, 2019, 01:04 am
A complete and accurate schematic diagram, with specifications for all the components including the batteries and voltage regulators, is required to diagnose power supply problems like this.
Title: Re: Servo twitching - Bicopter
Post by: rossi86m on Aug 23, 2019, 04:33 pm
Thanks again for taking the time.

I am learning on the go.

Here is the schematic, I hope it helps. Pls let me know what other info I can include
The battery is a 2200 mah lipo
Thanks in advance

Looking forward to hearing from you!

Cheers!
Marco
Title: Re: Servo twitching - Bicopter
Post by: jremington on Aug 23, 2019, 04:52 pm
The diagram does not show how the servos are powered, which is most likely the problem.
Title: Re: Servo twitching - Bicopter
Post by: rossi86m on Aug 23, 2019, 04:58 pm
The diagram does not show how the servos are powered, which is most likely the problem.
They are both connected to the pca9685.
It has 3 pins for each servo
- Signal
- v+
- gnd

There is more clear
https://i.imgur.com/pyHjBTe.png


Cheers!
Marco
Title: Re: Servo twitching - Bicopter
Post by: slipstick on Aug 23, 2019, 05:13 pm
Unfortunately the PCA9685 is powered from the 5V pin on the Arduino...which will be at least part of the problem. That pin can only supply a maximum of around 400mA and just one of the servos may need more than that. The two motors, which according to your schematic are also powered from there, will definitely need a lot more than that.

Is your regulator at bare LM2596 (in which case it's missing most of the components needed to make it work properly) or a module which uses an LM2596 (if so what module is it?). And what voltage is it supplying? You need at least 7.5V to use Vin.  It would be much more sensible to use a 5V regulator and connect it to the servos and Arduino 5V pin and not mess about with Vin at all.

Steve
Title: Re: Servo twitching - Bicopter
Post by: rossi86m on Aug 23, 2019, 05:24 pm
I am using a module. It is set to 5v
This is the module (https://www.amazon.com/Arduino-compatible-module-adjustable-regulator/dp/B01L6M8CKA)

You suggest to connect the servos directly to the LM2596 module instead of the pca9685?

Cheers!
Marco
Title: Re: Servo twitching - Bicopter
Post by: slipstick on Aug 23, 2019, 05:42 pm
No. I suggested connecting the output of the 5V module to the PCA9685 and to the 5V pin of the Arduino. Do not connect anything to the Arduino Vin pin.

But you will need more power for the 2204 motors. 5V and 3A is nowhere near enough.

Steve
Title: Re: Servo twitching - Bicopter
Post by: rossi86m on Aug 23, 2019, 05:44 pm
Ok a will check that connection

The ESCs of the motors are connected directly to the battery. I attached an image to double check if i understand it right

I will get back to you after trying that!

Thanks!
Marco
Title: Re: Servo twitching - Bicopter
Post by: jremington on Aug 23, 2019, 07:53 pm
Never power motors or servos from the 5V output of the Arduino.
Title: Re: Servo twitching - Bicopter
Post by: rossi86m on Aug 23, 2019, 08:20 pm
Ok I will change the connection to power the pca9586 from the vin pin


Thanks!!! i will let you know how it goes
Title: Re: Servo twitching - Bicopter
Post by: slipstick on Aug 23, 2019, 08:27 pm
Ok I will change the connection to power the pca9586 from the vin pin
Which part of "Do not connect anything to the Arduino Vin pin" was too difficult for you to understand?

That's what your last diagram showed. The PCA9586 is powered direct from the 5V regulator and the Arduino is also powered from there. That is correct.

Of course it doesn't help that your diagram is rubbish because it shows the motors powered from the PCA9586 and no direct connections to the battery. If you won't provide accurate information it may be impossible to help you.

Steve
Title: Re: Servo twitching - Bicopter
Post by: rossi86m on Aug 23, 2019, 08:43 pm
Of course it doesn't help that your diagram is rubbish because it shows the motors powered from the PCA9586 and no direct connections to the battery. If you won't provide accurate information it may be impossible to help you.

Steve
You are right regarding the diagram, I have just adjusted it.
Change how motors are power and the 5v issue

attached you will see the diagram that i will test

I appreciate you take the time to give me this advice

I will test this new diagram and let you know

Thanks!!
Marco
Title: Re: Servo twitching - Bicopter
Post by: jremington on Aug 23, 2019, 09:17 pm
Don't come back until you have learned why a diagram like this is complete, utterly useless nonsense.

(https://forum.arduino.cc/index.php?action=dlattach;topic=632732.0;attach=321643)
Title: Re: Servo twitching - Bicopter
Post by: rossi86m on Aug 23, 2019, 09:21 pm
The thing is that the pca in the diagram has only one pin the and the actual module has 3. I dont know how to put it there

I Apologice for my junior level

Title: Re: Servo twitching - Bicopter
Post by: jremington on Aug 23, 2019, 09:42 pm
If that diagram does not represent YOUR ACTUAL WIRING, make and post a CLEAR PENCIL DRAWING of your ACTUAL WIRING.

Why is this so hard to understand?
Title: Re: Servo twitching - Bicopter
Post by: rossi86m on Aug 23, 2019, 09:47 pm
I will do that.

Sorry for that
Title: Re: Servo twitching - Bicopter
Post by: MartinL on Aug 31, 2019, 11:25 pm
Hi Marco,

Perhaps the easiest way to power your bicopter is to use ESCs (Electronic Speed Controllers) with a +5V, 3A linear voltage regulator, know in the RC world as a BEC (Battery Eliminator Circuit).

In fixed wing RC aircraft the ESC's 3 pin (signal, +5V and GND) BEC connector is plugged directly into the RC receiver. This powers both the receiver itself and all of the plane's servos. A flight controller usually isn't necessary.

The principle for multi-rotors including the bicopter is the same, except that a flight controller is inserted between the RC receiver and ESC/servo outputs to provide flight stability.

Power the ESCs directly from your LiPo battery and use an ESC's +5V, 3A BEC output to power your servos. Just make sure that the servo's ground return path connects directly back to the ESCs via the BEC connector and not back through your Arduino flight controller. The Arduino's GND pin should also be connected to the BEC ground.

For example, the image shows my flight controller's power bus, that's similar to the KK2s. The first ESC's BEC (signal, +5V, GND) is connected to the top row for motor 1 and powers the flight controller. The subsequent ESCs BECs are connected to motor 2, 3, 4 etc... These are attached to a separate +5V rail and allows them to power any servos that might also be required. Note that the grounds are connected together to provide a single return point back to the ESCs without passing through the flight controller itself. The PWM signals that control the ESC and servos are generated directly by the microcontroller:

(https://forum.arduino.cc/index.php?action=dlattach;topic=632732.0;attach=322732)

Multi-rotor ESCs with BECs are becoming a bit of a rarity these days, as nowadays the voltage regulation is usually performed by a PDB (Power Distribution Board), plus the fact that most people fly smaller quads that don't require a servo (or two). However it's still possible to find them.