74HC165 End of Chain Wonky-Wonky

Hi everyone! I got a strange one here I can't seem to figure out.

Setup:

  • I have 5x 74hc165 shift registers in series, the same as any other diagram you see on the net. Its really a basic setup.

  • yes 0.1µf caps on each IC

  • 4 of these chips are on a single board, and the 5th one lives on a remote board with an 18" ribbon cable (its a self-contained switch panel.)

  • Everything works GREAT when they are powered off the 5v power shunted out of my ESP8266 NODEMCU VIN pin while it is plugged into USB cable into my PC and sitting on my desk, no glitches or any other oddities.

  • But since the power source where this is going to live is 12v, USB won't be available so I have a 5v power supply to power everything instead. This goes directly to the board, and into the 5v pin on the ESP8266, and all ICs are powered in parallel to this.

The Problem:

  • When running from the external power supply, the first 4 shift registers work just fine, as does everything else on the board that was unmentioned.

  • The 5th shift register on the remote board goes completely batsh!t crazy. Random button presses are sometimes registered, rare but happens.

  • The first 7 buttons on the last chip stop working (#32-38)

  • Only the VERY LAST button (#39 logically) on that chip works.... When pressed it registers presses from ALL BUTTONS on that chip, #32-39.

Things I've tried and didn't solve problem:

  • Checked all voltages on remote board, all checks out, but no oscilloscope here, wish I had one.

  • Replaced the 74hc165 (duh!) with one of the known working ones on the other board.... problem stays with the remote board.

  • Replaced ribbon cable... just because.

  • I was running a HX1314 regulator, and later switched to LM1805 for concerns of the HX being noisy... same problem.

  • Swapped caps on my power supply, added high and low filters.

  • I also tried multiple, cleaner 12v sources to no avail.

  • Unplug 5v external supply, and shove in USB cable... all problems go away.

It seems the remote chip is puking all bits into its last input. Perhaps the clock signal isn't getting there, or signal has become dirty... just a guess.... or maybe latching (LOAD!) too frequently?

What gets be is I've run much longer wires to remote chips and never had such an issue.

Anyone have any potential suggestions or things to try for this one?

Thanks in advance, I'm pulling out the last of the hair I have left!

Please show:

  • A schematic diagram of the setup
  • Photos of how it's wired
1 Like

And code please

2 Likes

The ESP is 3.3volt-logic, so you should power them from 3.3volt.

How long is that ribbon cable, and did you use a ground or supply wire between each data/clock line.
Leo..

Thanks Leo!

The ESP8266 supports up to 10v VIN, it has its own regulator to bring it internally to 3.3v.

Also, all the input pins also are 5v tolerant, and that comes from the founder of Espressif. This is one of the reasons I use these units... no level shifters or other logic necessary. They've never failed me and always worked well in this respect... there are many I've released to wild and still use with this combo, and in this home that have never failed. I love them, as do my customers.

Yes all boards do have a ground in the ribbon cable, as well as a strap to chassis.

The length of the ribbon cable is 18", as said in original post.

The fact the USB cable seems to power the controller, and everything else out of that 5V pin just fine (it's not my code as some might be suggesting LOL!) This is a really peculiar HARDWARE situation.

That last 74hc165 just goes to crap when its on an external power supply. Its a head-scratcher!

And so it will remain unless you give insight into the hardware aspect.

As to the ESP's alleged 5V tolerance - maybe we shouldn't do that discussion all over again. If you search this forum, you'll see it's been beaten to death and the conclusion remains that it's optimistic to rely on it in this specific case, and in general mixing 5V and 3V3 logic levels is just not a good idea.

Yeah yeah... hasn't it though?

It's not the problem this time at least... I tried 3.3v external supply (and the ESP8266 internal to power the chips) and I still get the same nonsense.

I just for grins unplugged my USB cable from PC and plugged it into an iPhone charger... it does different stuff.. leave it to Apple to be different. But a Samsung Android charger behaved the same as my external power supply.

This is all reproducible.

After going through my box of phone chargers, I finally found ONE so far that works great. It doesn't have any different specs than any other 5W charger @ 5v/1A.

This is some power anomaly.

I did that already, its the same basic 74hc165 schematic you get anywhere else. Everything is powered in 5V parallel. Absolutely nothing special here, no extras, no bells, no whistles, no divergences. I checked, and re-checked, I haven't made a mistake.... AND IT ACTUALLY WORKS! But just acts strangely with different (but big enough) power supplies....and only on that one remote chip!

I feel I need something extra here someplace, better filtering caps for dirty power perhaps, maybe even just a 100Ω resistor in the CLOCK line. I've practiced that before for 74hc595 that had problems at longer lengths, but never experienced anything like that on this short of a run.

Both still missing.

1 Like

Both not the problem.

Hi, @aquabuzzard

What makes you say that?
Some images of your project would also help.
You may have an earth-loop?

Can you please post a copy of your circuit, a picture of a hand drawn circuit in jpg, png?
Hand drawn and photographed is perfectly acceptable.

Have you tried a 10uF capacitor across the power pins of the troublesome 165?

Good that you have 0.1uF fitted at every 165, I hope as close to the power pins as possible.

Thanks.. Tom.. :smiley: :+1: :coffee: :australia:

The answer is, everything works as anticipated with a power supply that makes it happy.

Not likely, everything shares same grounds (and in multiples, classic VW owners will understand where I'm coming from) and all have the same 5V in. I don't see any reason there should be any build up potential between anything. Again, just a power supply swap (to the one it likes!) makes it happy.

Good call! Thanks Tom! I was just pulling the board to give that a shot. I also thought to myself, I should have socket'd these caps! Haha!

I'm also going to add the 100Ω resistor in the CLOCK line at the microcontroller after this. But one step at a time. Would like to know which one makes it happy, maybe one, maybe other, maybe both!

That depends on the physical size of the 3.3volt regulator on board you're using. It dissipates 10V - 3.3V * 0.1A = 0.67W, which is borderline for an SOT223, but not ok for an SOT-23 package. As for the logic levels, I wish you good luck with using parts outside their specifications. Trying things until "it makes you happy" doesn't make you a good engineer.
Leo..

Hi, @aquabuzzard

As you don't have the luxury of a scope, you cannot see or measure any power supply noise or regulation problems that could occur at the end of the supply rails, The 10uF will help any regulation problems at the IC.

Tom.. :smiley: :+1: :coffee: :australia:

Good, we're not putting that much in. Only 5v going in. The regulator on the ESP board has 1A spec. It could easily power 5x 74hc165 @ 3.3v.... Despite being tested, we're not going to be using it for that, so that's was never the argument.

A lot of things are used for their alternative or even negative side-effects, rather than their absolute purposes. If it doesn't burn up prematurely, and operates as the assembly is designed, AND LASTS the intended period... then I'd suggest the designer might know what they are doing. Glitches often become features.

If the folks that experimented, and worked hard to came up with the designs for these things listened to people giving that advice, we'd never have any of these things. Stay within the lines... pffft. I hear ya, but no.

:kissing_closed_eyes:

Thanks Leo!

Yeah man, I've been doing this for long enough I should have gotten a scope 30-something years ago. I should just bite the bullet, they're not too expensive anymore.

Unfortunately the 10µf cap didn't get it, I really hoped that would!

But the 100Ω resistor in the LOAD line improved behavior dramatically. Now all power supplies have consistent behavior....

No longer does the last button tickle all the inputs on this chip, now it only registers itself when pressed. Gotta sort out the rest....

But now I gotta go play mommy.... my chickens are hatching. Gotta make sure they all come out safely.

Thanks Tom!

So how did you wire the ribbon...
A ground in between signal wires could reduce cross-talk.
Are you using SPI for those shift registers, and at what frequency.
Long wires carrying high high frequency signals should be terminated.
Leo..

1 Like

But you said:

....which means you expect it to be a hardware issue. Yet, you refuse to provide the most essential information in troubleshooting a hardware issue.

Note that all the helpful guiding questions @Wawa has been asking would have been answered by posting two pictures.

1 Like

Perhaps a logic analyzer would give some insight: Amazon.com

I think I dld alright here.
DATA - VIN - CLK - GND - CE - LATCH/LOAD

Good question, but no SPI, just shiftIn for these 165s

Relatively speaking, would you consider 18" to be long? I think not, but perhaps in a noisy enviroment without adequate shielding. Currently just running on my desk, close to monitors, near my PC. Noisy enough, I suppose, but shouldn't affect it.

Thanks Leo!

Thanks for giving us some relevant info.
I guess shiftIn, with a lower frequency, is more forgiving than 4Mhz SPI.

That points to a supply or ground loop issue.
What is connected to that 5th 74HC165.
The requested pictures could help.
Leo..