Go Down

Topic: Power/Noise Issues while Controlling 2 MG995 Servos with Arduino Mega2560 (Read 553 times) previous topic - next topic

abb825

Hey guys,

Got a bit of a problem. I am trying to control two servos with a simple joystick and I am running into issues. I am trying to control 2 MG995 Servos using my Arduino Mega 2560. The joystick is a simple thumbstick with 5 pins (+5V, GND,X,Y,SWTCH).

When I wired the servos and joystick up, I didn't see much of anything,just buzzing. Then when I added a 100µF capacitor across a switch for one of the servos, it partially worked and then other servo worked completely. I know my code works great because if i hook up 2 HS-50 servos, I don't run into issues, I have complete control. Check out the pic of my fritz schematic to see how I have it wired.

Ultimately, I'm thinking it is a combination of issues, both power & noise. I am running everything from the board's power supply (which I know is a no-no) but I couldn't get a response when I used a 9v battery with a voltage divider as an external 4.5V power supply. For my voltage divider, i tried with 10k ohms for both my resistors and got no response.

I also tried adding in a low pass filter, R=220 ohms w/ C=100µF for an fc of about 7ish Hz, no success. In reference to the schematic, I also tried increasing the capacitance to 200µF and 50µF, but neither were successful, only 100µF really showed promise. I really think manipulating the capacitance might be key though.

I did hook up the circuit that is shown to a scope and i recorded the output. This image is also attached. Any help or guidance would be really appreciated!! 

If I can give you more information in order to properly respond to this post, please let me know!!

Thanks yall!

- Drew

vinceherman

I am running everything from the board's power supply (which I know is a no-no)
Correct.  Do not do that.  You get exactly the results you are describing.  Use a proper power supply.

Quote
but I couldn't get a response when I used a 9v battery with a voltage divider as an external 4.5V power supply.
A 9v smoke detector battery?  Also not a proper power supply.

Try 4x AA batteries to power the servos.  Use common ground.

abb825

A 9v smoke detector battery?  Also not a proper power supply.

Try 4x AA batteries to power the servos.  Use common ground.
That's why I tried creating a voltage divider: Vout = [R2/(R1+R2)]*Vin

With, my Vin as 9v and R1=R2=10kOhms, it should be 4.5 V, or roughly 3x AA batteries

It's just your garden variety 9V battery. Im sure you could use it in most smoke detectors.


vinceherman

That's why I tried creating a voltage divider: Vout = [R2/(R1+R2)]*Vin

With, my Vin as 9v and R1=R2=10kOhms, it should be 4.5 V, or roughly 3x AA batteries

It's just your garden variety 9V battery. Im sure you could use it in most smoke detectors.
Yes, you can use it in a smoke detector or a transistor radio.  Those applications pull a VERY small amount of current.
Your physical motors do not pull such a small current.  They pull a much larger amount of current and the 9v battery cannot provide that voltage at that current.  The voltage drops way down and your devices brown out and fail.


abb825

Yes, you can use it in a smoke detector or a transistor radio.  Those applications pull a VERY small amount of current.
Your physical motors do not pull such a small current.  They pull a much larger amount of current and the 9v battery cannot provide that voltage at that current.  The voltage drops way down and your devices brown out and fail.


Hi vince Herman,

thanks again for your response. maybe I should clarify. A 4.5V external power supply was created using a voltage divider from a 9v battery. this Vout of 4.5V ultimately provided no response so it was not used. again, the boards power supply is what the schematic indicates as well as what the scope output.

slipstick

If you don't use a separate power supply with a reasonably high current capability with powerful servos it's simple. They do not work.

The 5V out from the board won't work. 9V PP3-type batteries won't work. And a resistor voltage divider will NEVER work...as soon as the load draws any current the voltage drops close to zero.

4 x NiMH rechargeable AAs are good. They will usually provide more current than primary AAs.

Steve

TomGeorge

. A 4.5V external power supply was created using a voltage divider from a 9v battery. this Vout of 4.5V ultimately provided no response so it was not used. again, the boards power supply is what the schematic indicates as well as what the scope output.
As indicated earlier, a resistor potential divider will not work here because you are drawing current from the mid junction.
Potential dividers work if very little current is drawn from the series arrangement. 
Not for directly making a lower voltage power supply.


Tom.. :)
Everything runs on smoke, let the smoke out, it stops running....

abb825

Steve and Tom,

Thank you for your response. I went ahead and invested in 4x AA NiMH batteries and connector. I now have a 5V cell with a capacity of 2400 mAh as my external power supply.

I still have no movement from one of the servos. From what I read, the MG 995 has a running capacity of about 350 mA so I'm still a little baffled on why I don't have movement from the second servo -- the first one works great. I'm thinking this is where the noise issue is comin into play.

I then thought, 'Oh, must be noise'. So I created a low-pass filter with an Fc of about 6.3 kHz and still goose egg. Doing so was almost worse: I got no movement in either servo.

.....thoughts?.....

vinceherman

.....thoughts?.....
Yes.  Test each servo individually.
Unplug the servo that works.
Move the servo that was not working to that pin the first servo was on.
Run your sketch.
Does the servo respond?

slipstick

How exactly do you have the servos connected? Connecting high powered equipment via a breadboard is a bad idea. The battery +ve should connect directly to the servos +ve and then to the Arduino. Same with the battery -ve. A proper circuit diagram, even hand-drawn or a picture of the actual layout of your project would help.

But first...are you sure the second servo actually works? If you change the two servos over does the problem move to the other servo or is it always the same servo that doesn't move?

Steve

abb825

Guys,

Awesome responses so far. So I'm pretty dang postive the second servo works. When I have it hooked up to the boards power supply, and with a capacitor on the signal line, I get some response. This is the same arrangement from my fritz file in my first post. This is the same arrangement as the sketch attached to this post. I guess it could be a bunk piece of equipment but I don't think so.

When I tested the problematic servo on the first servo pin, I just hear a high frequency noise and low buzzing. No movement. Furthermore, the external power supply really does no good: I get no movement whatsoever when I have that hooked up. Again, this

As far as using a breadboard for high-powered equipment, why won't it work? It should theoretically, should it not? Maybe it's not preferred but it's what I've got right now.

TomGeorge

Hi,
Ops pic.

Why is the 100uF cap across sig to gnd?
It should be 5V to gnd.

Tom.. :)
Everything runs on smoke, let the smoke out, it stops running....

abb825

Hi Tom,

I read that elsewhere to but when I tried it, I got no response from either servo. With my configuration, I at least got full control of 1 servo and partial control of that servo

slipstick

According to that diagram there's no battery or power going into the system from anywhere. So I'd say it's not exactly a complete diagram. And running servos via the Arduino 5V pin is always a bad idea.

BTW breadboards often don't make very solid connections and breadboard tracks are only intended to carry low currents, typically < 100mA. People have burned out tracks by running servos and motors through them. Other than that they're just dandy.

But hey, we're just offering advice. You don't have to take it.

Steve


abb825

Thanks Steve. Trust me, I really appreciate y'alls advice! On my diagram, you're exactly right, I didn't draw my USB cable providing power to the Arduino Mega.

I see other people accomplish this task with simple breadboards which is why I hesitate to spend more money on equipment:

https://www.youtube.com/watch?v=WnKNEcDZwfM

https://www.youtube.com/watch?v=raTeZGsYZf0

Regards,
Andrew

Go Up