Pulling Latch pin on 16 led shift registers LOW results in controller resetting.

Pulling Latch pin LOW on the shift registers results in Atmega 328 controller resetting.

Several points: - I am using superbright LEDs 3.5v with no resistors. The LEDs produce a really bright light without being damaged. The brightness of the lights are a part of the project. - The base controller has been wired according to this practice (excluding capacitors) - There are 2 serially set up shift registers driving 16 leds. The issue occurs when more than 10 LEDs are enabled by the shift registers when the latch pin is pulled low. - The circuit is powered by a 5v 1A supply.

My guess is the momentary voltage spike is what is causing the issue. I have no way to troubleshoot it though.

Digital chips require a decoupling cap (01 uF) for each chip. In your case, you might want to add a 1 uF cap across +5V. Measure the 5V pin from arduino while latching.. Whats powering the arduino ( the 1A supply ? What pin is it connected to on arduino ? You shouldn't power leds without resistors.

raschemmel: Digital chips require a decoupling cap (01 uF) for each chip. In your case, you might want to add a 1 uF cap across +5V. Measure the 5V pin from arduino while latching.. Whats powering the arduino ( the 1A supply ? What pin is it connected to on arduino ? You shouldn't power leds without resistors.

Both the Atmega328 and the shift registers are powered from the same av 1A power supply. The documentation on Gammonds does show a 0.1uf cap between both GND and 5V as well as GND and AVCC, is that what you referred to as decoupling cap (01 uF)?

What arduino pin is the supply connected to? YES 0.1 uF Yoj may need a 470 uF Electrolytic cap across 5V & GND.

Show us a schematic; can be a picture of a hand drawn one if needed.

raschemmel: What arduino pin is the supply connected to? YES 0.1 uF Yoj may need a 470 uF Electrolytic cap across 5V & GND.

Pin 7, Pin 8, Pin 22 and Pin 20. Just like the documentation on Gammonds page. http://www.gammon.com.au/breadboard |500x287

Only thing I skipped are the capacitors so I think that might be what is causing the issue.

I added resistors to the 16 leds, they are a tad dimmer now but the controller no longer resets. Only issue is that I have a second set of 2 registers and 16 leds that I needed to connect which makes the issue return. I will try to attach the capacitors and see if the issue is solved with that second set attached.

Did you measuret the current drawn from the supply when you latch tbe registers? Do the leds light when you "latch" the registers ? Did yoh monitor the arduino 5V when you latch the registers ? Do you realize tge arduino only resets when the supply voltage drops below the threshold set by the ATmega328 powerfail circuit ?

Just installed the Caps like in the image, fixed all the issues.

When in doubt, FOLLOW INSTRUCTIONS !

("skipping steps" is strictly forbidden on the forum)

raschemmel: Did you measuret the current drawn from the supply when you latch tbe registers?

Haven't done that yet. Actually don't think my voltmeter can do that.

raschemmel: Did yoh monitor the arduino 5V when you latch the registers ?

Same reason as above.

raschemmel: Do the leds light when you "latch" the registers ?

Yes the registers work correctly.

raschemmel: Do you realize tge arduino only resets when the supply voltage drops below the threshold set by the ATmega328 powerfail circuit ?

The brownout detection I believe it's called. Just learned of the term an hour ago. Some forums said it could be lowered to 1.7 from 2.7 by setting the EXPANDED fuse to 0x06 instead of 0x05.

TobiasRipper: I added resistors to the 16 leds, they are a tad dimmer now but the controller no longer resets.

So you we're overloading your power supply. And no wonder your LEDs were super bright. Or did they have built-in resistors or circuitry?

TobiasRipper: Only issue is that I have a second set of 2 registers and 16 leds that I needed to connect which makes the issue return. I will try to attach the capacitors and see if the issue is solved with that second set attached.

Which value are the resistors? How did you come to that value? What is the spec (link would be useful) of the LEDs?

sterretje: So you we're overloading your power supply. And no wonder your LEDs were super bright. Or did they have built-in resistors or circuitry? Which value are the resistors? How did you come to that value? What is the spec (link would be useful) of the LEDs?

Unfortunately these are batch orders of leds with no serial markings on them but I usually buy 3.5v 20mA ones. Even 32 of those plus 4 shift registers and the micro-controllers should not amount to 1A of consumption.

The super-bright bit of the leds is a needed feature actually, 2.5v LEDS can't reach the desired brightness without being actually overdriven. So the fact that these are bright is what I was going for.

2k resistors, the LEDs are a tad dimmer, I'd say %20 but it makes the circuit work without the capacitors. Come to think of it. The capacitors did help but I still get an occasional reset when all 32 are lit (that's 16 with 2k resistors and 16 without)

Actually here's a question.

I have a piece of code the makes a debugging LED on pin 8 blink a pattern when the controller goes through it's "void setup()" stage. That's how I know that the controller has reset but here's a thing. Most of my variables are initialized in the setup or even before but the actual main loop does contains a few variables that are declared there instead of the setup of above it. Could it be that the variable in the main loop that starts with "int variableName" keep re-declaring itself and thus taking up new memory every cycle? It may be unrelated but just humor me.

You are just making stuff up as you go? (2k is the wrong value resistor) Google how to calculate thd value. R= (Vcc- Vf)/If = (5V-3.3V)/0.020A = 1.7V/0.020A = 85 ohms ( based on maximum 20mA current)

No. It's not the varaible because if it was it would reset with no leds connected

raschemmel: You are just making stuff up as you go? (2k is the wrong value resistor)

I'm learning stuff as I go. I didn't know there was a correct value for leds. So far I only deduced that the value of resistor needs to be picked to keep the led from burning from too much current which would also limit the brightness. Didn't know there's such as thing as a "correct" value, just figured only a value that would keep the led from damaging.

Also the reason I suspect variables clogging the memory is because now if I enable all 32 LEDs and then pull the latch to disable them, there's about a second or two delay before the controller resets.

Judging by how quickly this post got to a 100 views, I'd say I'm not the only one experiencing this issue.

I seriously think it's time for a schematic. With 2k resistors, you have about 1mA going through each LED (apply the formula given by raschemmel in a different way). With NO resistors on 16 LEDs and activating those, you're still overloading your power supply (resulting in resets) and you are in the process of blowing up your ICs and possibly your LEDs.

With regards to the variable; a simple 'int' will not cause issues. It's created on the stack when loop() is called and removed from the stack when loop() returns to the calling function. Only thing that can happen there is that it has a non-initialized value when it is created (if you do not specifically initialize it).

TobiasRipper: Judging by how quickly this post got to a 100 views, I'd say I'm not the only one experiencing this issue.

I doubt that very much. People see new threads and just have a look at them; not because they have the same problem. Just 100 people (minus the ones that participate in the thread at the moment) trying to help :D

sterretje: I seriously think it's time for a schematic. With 2k resistors, you have about 1mA going through each LED (apply the formula given by raschemmel in a different way). With NO resistors on 16 LEDs and activsating those, you're still overloading your power supply (resulting in resets) and you are in the process of blowing up your ICs and possibly your LEDs.

With regards to the variable; a simple 'int' will not cause issues. It's created on the stack when loop() is called and removed from the stack when loop() returns to the calling function. Only thing that can happen there is that it has a non-initialized value when it is created (if you do not specifically initialize it).

I'll try some 82ohm resistors instead as per the calculations provided by raschemmel on the previous page and see how it rolls.