Servos and Arduino, same external supply

Hi everyone!
Hope this is the right section of the Forum, this is my first post ever.
My name is Gabriele and I’m new to this world. I hope that somebody may help me with an issue that I’ve been facing for more than a week with my ArduinoMega2560.

I’d like to create a structure that, with a solar panel, chases the sun. I’ve already done some coding and it works with 2 small servos (sg90), the usb supply and some photoresistors.

My intention is to supply both Arduino and the servos (probably bigger ones, such as the mg995) with my solar panels only. To start with it (the solar panel is another part because they don’t provide a stable voltage/current, but I’ve bought a proper buck converter that works fine) I’m trying to use the external supply (that is the stable, 9V and 1A provided in the kit, the one that you can attach to the wall and that uses the jack entrance).

I’ve tried to connect the same, common supply to Arduino and to two mg995 servos (whose max supplies are 6,6 Vs, but 7V also works well, and the load-free current are 0.17A) but it doesn’t work. The external supply, as said, is 9V-1A and I’ve used my solid-state converter to reduce the V down to 7V. I’ve connected in parallel this supply to both Arduino and the servos. I’ve also connected the gnd of Arduino to the gnd of the Servos. This doesn’t work. If, instead, I only leave one servo connected to only one pin it works fine. As soon as I connect, instead, the second servo the motors go crazy and do whatever they want, they block, they jitter or they follow random behaviours. The code is rather simple, it’s just a sweep (from 10 to 170 degrees for the two servos, one after the other one, using the Servo.h library).

If, instead, I connect the external power supply (same as before, with 7V) to the servo only, the Arduino via usb to my laptop and the gnds of Arduino and servos together it all works fine.

I started a month ago working with Arduino. Do you have any ideas to fix the problem? Is it something related to the gnd or, maybe, to the V that is not stable enough? I’ve tested everything wih my multitester and all (Vs and Is) seem to work fine. Is it something related to spurious signals/noise that the servos send to the Arduino board while using the same supply and that cause the pwm signals to not work properly? Is it something related, maybe, to the fact that I’m using two servos together? Is it something related to the code?

Any help will be really appreciated. Let me know if any other clarification is needed. Thanks in advance to everyone.

Thank you so much in advance!


/* Sweep
This example code is in the public domain.

modified 8 Nov 2013
by Scott Fitzgerald


#include <Servo.h>

Servo myservo;
Servo myservo1;
int pos = 10;
int pos1 = 10;// variable to store the servo position

void setup() {

void loop() {
for (pos = 10; pos <= 170; pos += 1) {
// in steps of 1 degree
for (pos = 170; pos >= 10; pos -= 1) {
for (pos1 = 10; pos1 <= 170; pos1 += 1) {
// in steps of 1 degree
for (pos1 = 170; pos1 >= 10; pos1 -= 1) {

A schematic would be worth the effort about now.
Even if hand drawn.

It would also give you a chance to double check your circuit too !

Could you also take a few moments to Learn How To Use The Forum.
It will help you get the best out of the forum in the future.
Other general help and troubleshooting advice can be found here.

The power supply is really underpowered. An MG995 can take up to 1.5A (its stall current) whenever it starts moving. The 0.17A no-load current is fairly irrelevant.

There also seem to be some problems when trying to control particularly larger servos with a 3.3V signal when they were originally designed for a 5V signal. This may be nothing to do with your problem but it could be worth trying some sort of level shifting on the control signals.



Other post DUPLICATE deleted

I gave you links to help you so please take the next 48 hours to use them.