Arduino Mega Light Control Board

I am in the process of making a full stage lighting system. it will include 2 homemade moving head lights.(4 servos+2 Lights) 12 on/off lights.(12 relays) 1 homemade "Moonflower" like light (16 leds+2 shift registers) one color changing light(RGB Leds) 2 laser spiro-graphs(6 dc motors 2 lasers).

i am trying to make a control board using the Arduino mega, i want to use a 4-wire resistive touch screen, some slider pots, some rotary pots, and some push buttons.

the outher day i connected 4 slide pots to the arduino and 4 servos, it worked fine for a minute then all of a sudden the servos went crazy and there pots didnt do anything.

this is the code i am using.

#include <Servo.h>

//servos
Servo MS1;
Servo MS2;
Servo MS3;
Servo MS4;

//pots
int PP1 = 0;
int PP2 = 1;
int PP3 = 4;
int PP4 = 5;
int PP5 = 6;
//Vals
int V1;
int V2;
int V3;
int V4;
int V5;

void setup()
{
  MS1.attach(2);
  MS2.attach(3);
  MS3.attach(4);
  MS4.attach(5);
}


void loop()
 {
 
 V1 = analogRead(PP1);            // reads the value of the potentiometer (value between 0 and 1023) 
 V1 = map(V1, 0, 1023, 0, 179);     // scale it to use it with the servo (value between 0 and 180) 
 MS3.write(V1);                  // sets the servo position according to the scaled value 
 V2 = analogRead(PP2);            // reads the value of the potentiometer (value between 0 and 1023) 
 V2 = map(V2, 0, 1023, 0, 179);     // scale it to use it with the servo (value between 0 and 180) 
 MS4.write(V2);  
 V3 = analogRead(PP3);            // reads the value of the potentiometer (value between 0 and 1023) 
 V3 = map(V3, 0, 1023, 0, 179);     // scale it to use it with the servo (value between 0 and 180) 
 MS3.write(V3);                  // sets the servo position according to the scaled value 
 V4 = analogRead(PP4);            // reads the value of the potentiometer (value between 0 and 1023) 
 V4 = map(V4, 0, 1023, 0, 179);     // scale it to use it with the servo (value between 0 and 180) 
 MS4.write(V4); 
 
}

any help would be appreciated

the outher day i connected 4 slide pots to the arduino and 4 servos, it worked fine for a minute then all of a sudden the servos went crazy and there pots didnt do anything.

Well first I would ask is how are you powering the four servos? If you are using the +5vdc from the Arduino shield connector then that is probably the cause. Use an external +5vdc at around 3 amps or more to power four servos, or use battey power regulated to +5vdc.

If you are using the +5vdc from the Arduino shield connector then that is probably the cause.

i am using that power point. but they are not big servos. i am using Hextronik HXT500.http://www.hobbycity.com/hobbycity/store/uh_viewItem.asp?idProduct=663

but i will try that. thanks

Determing actual current demand from servos is trick without actual measurement is hard to do. It depends on the specific servo model, mechanical load on the servos, how much travel at any instance and of course if all are moving at the same time or not. It really is a common problem when people try to power more then a single servo from the Arduino's +5vdc source. I'm pretty sure having a external regulated +5 volts with enough current capacity to power the servo will fix your problem.

Lefty

i just found out the problem. i had made a connector to plug into the arduino and a piece of solder connected the gnd pin to the aref pin.

nice project, i want to make something similar but smaller :smiley:
can i ask you what kind of LED are you using ?
i can't decide if it's better to go with lots of "common" led (9000-16000 mcd) or to use new-generation LED's like the on from luxeon or generally leds with rating power above 1W

can i ask you what kind of LED are you using ?

i am just using cheap leds off ebay right now.

also if anyone can help me with the code it would be nice.

i want to use a DS touch screen to control 1 moving head light,(2 servos)
three sliders are for 3 servos.
one slider to fade the rgb light on and off,
three pots to change the color of the rgb light.

thanks