Problem with servo shaking

I'm currently trying to use two 9g micro servos with a 16 X 32 LED screen.

When operating with the LED screen the servos shake badly, in a simple program without the screen they operate fine.

Ive tried installing a second power supply just to supply the two servos ( 5V 3 amp supply)

How should I overcome this problem.

Give us your program (in code tags, </> icon). So we can see how you are driving it.

Weedpharma

Heres a copy of my program I have been able to determine its matrix.begin(); which is causing me the grief but i need that for use on the led display.

Thanks for your help

#include <Servo.h>
#include <RGBmatrixPanel.h>
#include <Adafruit_GFX.h>

#define F2(progmem_ptr) (const __FlashStringHelper *)progmem_ptr
#define CLK 11
#define LAT A3
#define OE 9
#define A A0
#define B A1
#define C A2
RGBmatrixPanel matrix(A, B, C, CLK, LAT, OE, false);

Servo vert, hori; // create servo object to control a servo
int poshori = 100, posvert = 9, laser = 52, up = 7, down = 6, left = 5, right = 4, fire = 2, select = 3;

void setup() {

matrix.begin();
Serial.begin(57600);
digitalWrite(laser, HIGH);
matrix.setTextWrap(false); // Allow text to run off right edge
matrix.setTextSize(2);
pinMode(laser, OUTPUT); // attaches laser to pin 10
pinMode(up, INPUT_PULLUP); // attaches input to pin 7
pinMode(down, INPUT_PULLUP); // attaches input to pin 6
pinMode(left, INPUT_PULLUP); // attaches input to pin 5
pinMode(right, INPUT_PULLUP); // attaches input to pin 4
vert.write(0);
hori.write(0);
hori.attach(13); // attaches the servo on pin 12 for vertical movement
vert.attach(12); // attaches the servo on pin 12 for vertical movement

}

void loop() {
// Up Push button
if (digitalRead(up) == LOW)
{
posvert -= 2; // in steps of 1 degrees
vert.write(posvert); // tell servo to go to position in variable 'posvert'
delay(250); // Delay to stop bouncing of input
}

// Down Push button
if (digitalRead(down) == LOW)
{
posvert += 2; // in steps of 1 degrees
vert.write(posvert); // tell servo to go to position in variable 'posvert'
delay(250); // Delay to stop bouncing of input
}

// Left Push Button
if (digitalRead(left) == LOW)
{
poshori += 2; // in steps of 1 degrees
hori.write(poshori); // tell servo to go to position in variable 'poshori'
delay(250); // Delay to stop bouncing of input
}

// Right Push Button
if (digitalRead(right) == LOW)
{
poshori -= 2; // in steps of 1 degrees
hori.write(poshori); // tell servo to go to position in variable 'poshori'
delay(250);
}
}

  hori.attach(13);  // attaches the servo on pin 12 for vertical movement

When you put useless comments in your code, you MUST make the useless comments accurate.

We can not see how your servo is powered.

Hi,

Can you please post a copy of your circuit, in CAD or a picture of a hand drawn circuit in jpg, png?

Tom.... :slight_smile:

(deleted)

spycatcher2k:
You did connect the grounds when you installed the new power supply?

that was my initial question as well..

Yeah I commoned the grounds between the two supplies.

The servo sub routine is there any way to change what timer runs with the pulse output.

As it runs fine without the screen in the program.

ServoTimer2 lib perhaps?