SN74HC595PWR x4 - Only works when not powered. - Page 1
Forum section: electronics / general

author: CardCastleStudios
author_rank: Newbie
timestamp: August 15, 2020, 12:55:50 am
content: I recently put together a circuit with 4 SN74HC595PWR Shift Registers. Everything works on the circuit except for when I attach power to the VCC at +3.3v or +5.0v. However, 3.3v does a different error than 5.0v.+3.3v cycles the entire LED array alternating odds and evens while counting to 32 until all LEDs are ON and does not shut them off.+5.0v Cycles either LED 32 or LED 16 off and On.The only power that is coming into these chips is from the Latch, Data, and Clock pins from the Arduino.The code I am using works fine and just passes all 1s and all 0s through a bool [] named registers.void UpdateRegisters(){digitalWrite(latchPin, LOW);for (int i = numberRegisters - 1; i >= 0; i--){digitalWrite(clockPin, LOW);digitalWrite(dataPin, registers);digitalWrite(clockPin, HIGH);}digitalWrite(latchPin, HIGH);}Here is a video of the issue:https://youtu.be/4mkqfLIUPYk

author: Ian.M
author_rank: Super Contributor
timestamp: August 15, 2020, 01:08:21 am
content: My Crystal Ball melted down in the heatwave so I can't see what's on your bench or poke around on your hard drive.Schematic?As built photo?What model Arduino?What do you expect it to do when working properly, in detail?Also, the forum ate part of your code snippet. Please useCode Tagswhen posting code so the BBCODE interpreter doesn't mung it. It may well be preferable to archive your sketch and post the resulting zip file here as an attachment.

author: CardCastleStudios
author_rank: Newbie
timestamp: August 15, 2020, 01:12:00 am
content: Arduino Uno Board with an ATmega328-pu boot loaded using CoreMini. Video of the issue was added to the main post and all it is supposed to do is turn all LEDS on and all LEDs off every 2 seconds.Video of what is occurring if need be:https://youtu.be/4mkqfLIUPYk

author: Ian.M
author_rank: Super Contributor
timestamp: August 15, 2020, 01:55:21 am
content: So, now we know you are using a 5V Arduino so it isn't a logic level mismatch.You couldn't have less obvious way to draw four daisychained shift registers. I suppose I should be grateful you didn't separate out all the resistors!All the LEDs together must take a considerable current. I doubt the Arduino's 3.3V regulator will cope. As to why its not working at 5V, that could be ground bounce or maybe your code (which we haven't seen more than a corrupted snippet of) is buggy.

author: bson
author_rank: Unknown
timestamp: August 15, 2020, 02:13:42 am
content: Have you tried scoping the '595 clock and data to see what actually happens on the pins?

author: Dabbot
author_rank: Regular Contributor
timestamp: August 15, 2020, 03:01:01 am
content: Arduino has a built in function called shiftOut() for driving 595 and similar devices. Give it a try:https://www.arduino.cc/reference/en/language/functions/advanced-io/shiftout/

author: CardCastleStudios
author_rank: Newbie
timestamp: August 15, 2020, 04:17:32 am
content: I do not own a scope, with this I was looking at getting one if anyone has a suggestion or recommendationI'll try the shiftout(), and I hope it is the fix but I'd feel really bad for wasting everyone's time.

author: Ian.M
author_rank: Super Contributor
timestamp: August 15, 2020, 06:03:04 am
content: There's still lots of things we can suggest for you to check or try even without access to a scope.However an electronics technician without a half-way decent scope is operating almost completely in the dark, so its will involve a lot of guess-work and experimentation to prove/disprove what would have been obvious in a minute if you could have scoped it. There've been plenty of threads on acquiring your first scope and I'm not in touch with the state of the US scope market, so I'll leave it to others to point you towards them.Don't apologise for wasting our time - we all give it voluntarily because we'd rather be online here, than contemplating whatever idiocy or disaster the real world is currently offering. You are valuable content, and polite with it. The only way you could waste our time is by concealing information we need to help you, or by failing to follow up here when you have found the fault and implemented a solution.

author: TomS_
author_rank: Frequent Contributor
timestamp: August 20, 2020, 11:54:13 am
content: Quote from: Ian.M on August 15, 2020, 06:03:04 amMan, that statement is so painfully true. I definitely use electronics to escape the real world, its way too messed up.

author: TomS_
author_rank: Frequent Contributor
timestamp: August 20, 2020, 12:00:26 pm
content: Quote from: CardCastleStudios on August 15, 2020, 12:55:50 amYou should really wrap your code in the [ code ][ /code ] tags, because the forum is formatting away some elements of the code. Its the # on the toolbar while editing a message.

author: thinkfat
author_rank: Unknown
timestamp: August 20, 2020, 12:19:06 pm
content: You should post the complete code. I don't think it's doing what you think it does. The snippet you posted is definitely wrong (registers[ i ]?). What is "numberRegisters" set to, 4 or 32?Depending on your wiring, there might be a delay necessary after each transition of the clock pin.

author: Ian.M
author_rank: Super Contributor
timestamp: August 20, 2020, 01:06:29 pm
content: A reconstruction of the O.P's code snippet would be:Quote from: CardCastleStudiosI know where thewas that the forum BBCODE ate, by where the line changed from normal to italic text.However I really don't like it - ifregisters[]is aboolarray, there are plenty of ways to get stuffing it with data wrong and we haven't been shown that code.

author: TomS_
author_rank: Frequent Contributor
timestamp: August 21, 2020, 09:59:04 am
content: Quote from: thinkfat on August 20, 2020, 12:19:06 pmI think using DigitalWrite will be slow enough for even the worst circuitry.

author: capt bullshot
author_rank: Super Contributor
timestamp: August 21, 2020, 11:17:36 am
content: Can't be bothered to watch a video.Just guessing: HC595 and the like are quite susceptible to noise on the SCK and RCK inputs. Noise in such kind of circuit typically is a result of poor layout. So check your GND plane and decoupling capacitors first, second place some (100R ballpark) series resistors into these nets, post some photos of your layout / setup here, ...This isn't depending on the speed the bits are shifted out, it's depending on the signal rise/fall times. Too fast a rise/fall time might induce some nice GND bouncing, resulting e.g. in doubly shifted bit and whatnot. These modern HC595 are faster than one might think, no matter how slow your arduino tries to shift the bits.

author: Jeroen3
author_rank: Super Contributor
timestamp: August 21, 2020, 11:40:22 am
content: Quote from: Ian.M on August 15, 2020, 01:55:21 amThe 595 is powered with 3V, but 5V logic is applied to the control gates. I think this may wrong, it's not a mcu with FT pins. All graphs at chapter 8 also indicate Vcc as the top of the waveform.

author: newbrain
author_rank: Super Contributor
timestamp: August 21, 2020, 12:06:50 pm
content: Quote from: Jeroen3 on August 21, 2020, 11:40:22 amItiswrong.Chapter 7.3, Recommended operating conditions gives 0 to VCCas the input voltage range.

author: Ian.M
author_rank: Super Contributor
timestamp: August 21, 2020, 12:56:13 pm
content: AAgh!!!! I missed that! I agree that the 74HC595 inputs should *NEVER* be driven higher than a few hundred mV above its Vcc supply voltage, so had already discounted the powered at 3.3V test as inherently wrong. I was more thinking that at 5V, driven by a hypothetical 3.3V Arduino, the inputs might not reach a reliable logic '1' level, hence my comment. It shouldn't be misbehaving at 5V unless the code's bad or the wiring's a physical rats-nest.

author: Jeroen3
author_rank: Super Contributor
timestamp: August 21, 2020, 01:18:36 pm
content: But the thing is...TI says:QuoteSo I guess just keep lookint at the Input clamp current in the absolute maximum table.I suspect that if you add series resistors in the control lines of 4k7 to 1k it will work, but you may need to slow it down a bit if the digitalWrite isn't slow already.https://www.ti.com/lit/ds/symlink/sn74hc595.pdf