circuit dying or acting bizarre

hello,

i just learned fritzing so here is a poor attempt to show you the circuit i am working with. i hope you get the idea:

http://www.jeremycouillard.com/circuit.jpg (it's actually an atmega 328p but the pin config is the same)

the relays are not the ones i have but they are an spst relay that is turning the motors on and off and a dpdt relay that is reversing the polarity. the spst is 5v, powered by the arduino with a nominal current of 20mA. there is a diode across the coils. the dpdt is 12v and controlled through a tip120 transistor (with a diode). everything is powered through a 12v 1.7amp wall wort.

the leds are 12v, huge things and also are being powered separately and controlled through tip120s. the leds have a forward voltage of 3.5.

the code, pasted below, is very very simple. just starts the motors in one polarity, stops them, blinks some lights, then starts them again in a different polarity.
The problem is as follows: The program starts up and everything runs fine for about 2-3 cycles and then it either 1) just stops or 2) the relays and lights start turning on and off in a continuous loop...about 2 seconds on, two off. it is very strange....i've never had a circuit do something that wasn't in the code. Is there anything in my circuit that is suspect? any help/guidance would be so so appreciated!!!

void setup() {
  pinMode(13, OUTPUT);
  pinMode(12, OUTPUT);
  pinMode(11, OUTPUT);
  pinMode(10, OUTPUT);
  pinMode(5, OUTPUT);
  digitalWrite(13, LOW);
  digitalWrite(13,LOW);
  delay(5500);
}

void loop() {

  
  digitalWrite(13, HIGH);
  digitalWrite(12, HIGH);
  delay(35000);
  digitalWrite(13, LOW);
  digitalWrite(12, LOW);

  //light show needs to be 11 seconds exactly
  //22 loops
////////////////////////////////////////////////
  for (int i = 0; i<22;i++){
    digitalWrite (11, HIGH);
    delay(100);
    digitalWrite(10, HIGH);
    delay(100);
    digitalWrite(5, HIGH);
    delay(100);
    digitalWrite(11, LOW);
    delay(100);
    digitalWrite(10, LOW);
    delay(100);
    digitalWrite(5, LOW);
  }
///////////////////////////////////////////////

  //delay(11000);

  digitalWrite(13, LOW);
  digitalWrite(12, HIGH);
  delay(36000);
  digitalWrite(13,LOW);
  digitalWrite(12,LOW);
  delay(2000);



}

Well I can't really follow the drawing in great details, a real schematic drawing would be so much better. But the symptom you are having could just be that your loads are drawing too much current for your wall wart voltage source. Can you somehow measure the total current being drawn from you wall wart using a digital multimeter in current measurement function?

Lefty

man...i so with i knew how to do both those things but unfortunately i don't know how to get amperage readings off my multimeter and i'm still trying to learn the schematic part in fritzing. might take another couple days. i was thinking this was an amperage issue also. i can hopefully find another wall wart with more amperage. but 1.7 already seems like more than enough to run 6 LEDs, some transistors, 2 relays and an IC, no?

also now i am noticing it's mostly the timing that is off. this program i wrote is a very time specific thing (timed to be in sync to a video) and currently the circuit has been running for awhile but the timing is changing a lot. could this mean something is off with the crystal?

treebykooba:
man...i so with i knew how to do both those things but unfortunately i don't know how to get amperage readings off my multimeter and i'm still trying to learn the schematic part in fritzing. might take another couple days. i was thinking this was an amperage issue also. i can hopefully find another wall wart with more amperage. but 1.7 already seems like more than enough to run 6 LEDs, some transistors, 2 relays and an IC, no?

also now i am noticing it's mostly the timing that is off. this program i wrote is a very time specific thing (timed to be in sync to a video) and currently the circuit has been running for awhile but the timing is changing a lot. could this mean something is off with the crystal?

Not likely in my opinion.

Where are the decoupling capacitors? You can't expect anything to work if you don't decouple all your supplies properly.

the 7805 has two capacitors on it and that's the only power to the IC. also the atmega has the capacitors on the crystal pins. is that sufficient? the 12v that goes to the motors and LED power wouldn't need to be decoupled, correct? or should i put a big capacitor on the motors? i've looked at grumpy mikes de-coupling page but it's really hard for me to understand everything totally i think....what is a choke or inductor? just a resistor? what size resistor would you know to use? would i do something like he shows at the bottom of his tutorial? De-coupling

do you think decoupling or more amperage is the main problem? i will try both anyway once i wrap my head around how to decouple this circuit....

thanks so much for all the replies!

What about Google? or Grumpy Mikes tutorial? Apparently you are just poor enough to not to afford to pay attention. From your questions you clearly didn't pay much attention to reading all of it. oOr researching what you don't understand. It isn't difficult just "Open another browser window and either Google (Usually TMI) or Wiki it and if necessary follow the references at the bottom to the related information, Might take a 'Meduim" reader 1/2 hour or so...I do it nearly every day and I am an "older" man. I know how to do it. BUT IT wasn't that I didn't ask or wasn't told, I Did, and was. But I had to do it myself to get an understanding of what worked for me, including the READING... But Me isn't You and belikes You'll do the same as I... sooner or later. Or keep asking the same questions.
Einstein had an opinion of that...

Bob

treebykooba:
man...i so with i knew how to do both those things but unfortunately i don't know how to get amperage readings off my multimeter and i'm still trying to learn the schematic part in fritzing. might take another couple days. i was thinking this was an amperage issue also. i can hopefully find another wall wart with more amperage. but 1.7 already seems like more than enough to run 6 LEDs, some transistors, 2 relays and an IC, no?

Sure. The problem would be the motors. Motors can draw a lot of current if they're loaded up.

A simple test would be to disconnect the motors, see if it still happens. If it doesn't then lack of amps is the main suspect.

i really am trying to understand this decoupling thing. i've read and reread grumpy mike's tutorial. i don't have any inductors laying around to try out but do you think it'd be enough to decouple a couple motors with a .1uf and a 47uf capacitor?

am i doing this correctly? it feels wrong:


is that motor decoupled? i'm just putting a couple caps in its path on the way to power?

thanks so much for the replies. i ordered a 5A psu so hopefully that will help also.