Go Down

Topic: Is my servo drawing too much power and causing my arduino to get stuck? (Read 1 time) previous topic - next topic

ByteSlinger

I have an MG995 servo which I'm controlling via an Arduino Nano.

I have two switches also attached to the arduino, as well as some LEDs.

One switch moves the servo between two positions, whilst the other turns the LEDs on and off.

When watching Serial Monitor, I can see that the switches are being read correctly, and the LED switch works fine. However, I've found that by using the servo more than two or three times, the buttons stop responding. The Serial Monitor, stops displaying a readout from the switches, sometimes mid-line and I lose any control.

Occasionally when this happens, if I re-select the baud rate in the monitor, it seems to trigger the arduino to begin working again but not always (and this isn't really a solution as the device is designed to be used away from the computer).

The whole thing is being powered by a 1a 5v USB block with direct power to the servo and to the arduino.

I've been trying everything to get this to work and I'm a bit lost. Does anybody have any advice?

Thanks

manor_royal

Does anybody have any advice?
Yep: post the sketch and a circuit diagram please.

But on December 19 you described similar symptoms, to wit a lack of response after a few moves. You also said proper power supply fixed that. This a new problem?
If this was a Civil Engineering forum would there be posts like "I need to build a bridge. Someone send me drawings."

ByteSlinger

Thanks for your quick reply.
On that initial issue I was experiencing a slightly different problem, where as, when the servo was set to high, it would move up, then instantly move down, and end up in a loop like that.
Now it just seems to randomly stop working.

Here's a circuit simulator with the code uploaded: https://circuits.io/circuits/3672428-helmet-code

Robin2

If you want help post a diagram of how everything is connected. Not a link to some simulator thingy.

Your servo should NOT be drawing power from the Arduino 5v pin.

...R
Two or three hours spent thinking and reading documentation solves most programming problems.

ByteSlinger

If you want help post a diagram of how everything is connected. Not a link to some simulator thingy.
Sorry, I thought that may be easier for people to look at.
Here's a diagram:



Your servo should NOT be drawing power from the Arduino 5v pin.
My servo isn't powered by the Arduino at all but is powered by the same source.

ByteSlinger

Ok, interestingly it's now got the old issue again where the servo just keeps looping when the switch is in the on position until eventually it stops listening to the switch at all.

ByteSlinger

Ok, I've actually managed to fix the problem with a work around but it's not ideal.
I've put a 10ms between each degree of movement which slows down the move but seems to prevent any issues.

I guess this would suggest that the issue is that it's underpowered?

If this is the case, what would you recommend? I've seen that the MG995 is meant to have 5-6V and I'm currently feeding the two with 5V. I guess 6 would therefore be the better option to go with, but not sure what would be a good very compact 6v source for this?

Robin2

I never understand why people take the trouble to produce diagrams that are difficult to read - even at full-screen size.

In any case, that diagram clearly shows the servo is powered from the Arduino 5v pin.

I do hope you have not been asking us to study the wrong diagram !

...R
Two or three hours spent thinking and reading documentation solves most programming problems.

jremington


ByteSlinger

I never understand why people take the trouble to produce diagrams that are difficult to read - even at full-screen size.

In any case, that diagram clearly shows the servo is powered from the Arduino 5v pin.

I do hope you have not been asking us to study the wrong diagram !

...R
It was the right diagram as it was automatically generated directly from this which you can see has the servo powered directly from the power supply. Apologies it didn't come through and thank you for trying to help.

Robin2

It was the right diagram as it was automatically generated
Don't trust automatic things without checking that they work properly.

When I see Fritzing diagrams my eyes go all blurry.

A simple pencil drawing could be done in a fraction of the time.

...R
Two or three hours spent thinking and reading documentation solves most programming problems.

detown

If that is the proper diagram you have your servo, led's and power input going to the 5V pin. Remove any connections you have going to that pin and connect them to VIN. The 5V pin is an output, not an input.
Actually you should be running the servo off a separate 6V supply, as this is what the servo calls for.

Go Up