Weird problem with 595 shift registers

Hi I am new to Arduino (or any other computer programming for that matter) and have built a project to read the oil temp on a Porsche oil temp sensor and display on a LED 4 digit 7 segment display with 4 74hc595 shift registers. I have written a program and it works, but is spuratic, unless I put my finger on the clock wire to the shift registers. Or when the jumper wires were full length I could just put my finger near the clock wire and it would work fine. I tried wrapping the wire in aluminum foil thinking some RF interference was causing the problem, but no difference . then I shortened the wires as short as possible thinking the wire length was slowing the data transmission, didn’t fix it, except now I have to physically touch the clock wire for the data to transmit properly. I have tried another Arduino Nano and does the same thing, I have ordered another display but it takes two weeks to get it. I have resoldiered all the connections and done all I can think of, maybe a problem with my sketch, I’m not well versed in this stuff at all. and am a bit surprised I got it to work at all. If anyone has any detailed advise I would certainly appreciate it.

Best regards Skip

PorSCHE_3.ino (8.23 KB)

Porschetech3:
... now I have to physically touch the clock wire for the data to transmit properly.

Can you post a diagram of your circuit and a picture of your setup, that might help spot the problem.

Yours,
TonyWilk

It sounds like you are not having any ground connection between the 595’s and the Arduino.

595’s is idiot proof - i’ve never managed to fuck anything up, regardless of implementation. As long as the connections are done correct, it’s a complete no-brainer.

// Per.

Zapro:
It sounds like you are not having any ground connection between the 595's and the Arduino.

595's is idiot proof - i've never managed to fuck anything up, regardless of implementation. As long as the connections are done correct, it's a complete no-brainer.

// Per.

I've seen many issues using 595s. It is easy to have problems with the clocking due to things like ground bounce from improper wiring, or noise from improper decoupling, and really easy to have noise or glitches on the clock signals when cascading multiple 595s together depending on how the clock and enable signals are used.

I agree with TonyWilk that seeing a schematic and the actual wiring might help spot something.

--- bill

Make sure the '595s have 0.1uF caps on their VCC pins too. And No other caps an any control lines.

I have ordered the caps, and will try that, thank you. Here is the schematic for the display as it comes. And a picture of my wiring as is at this time I have rewired several times and had the Arduino mounted on the back of the display with very short wires at one time.It actually works better with the long wires and the arduino farther from the display.

Here is a pic of the set up running on USB power.simple hookup to display, 5v power, gnd, data , latch , clock…Other wires are signal in on A0, 5v ref with 8k voltage divider resister., gnd for sensor

Porschetech3:
Here is a pic of the set up running on USB power.simple hookup to display, 5v power, gnd, data , latch , clock..Other wires are signal in on A0, 5v ref with 8k voltage divider resister., gnd for sensor

It might be (as bperrybap mentioned) that the clk line is bouncing
and this picture from the tronixlabs website seems to show that the board has no decoupling capacitors at all:

Adding some decoupling as mentioned earlier will be a good idea.

You can try adding a 100ohm resistor in series from the Arduino pin which drives the CLK line to the CLK wire. This is sometimes a fix since it 'slows down' the clk and stops it bouncing about as much.

Yours,
TonyWilk

Ground bounce is not the same as the clock signal glitching.
Ground bounce can cause clock glitching, but you can have clock glitching without ground bounce.

Another question is how are you powering the the device when it is in the vehicle?

In the vehicle it is powered by 12v on the Vin pin and gnd to ground. Also when in the vehicle I will not be using the 5v ref ( with 8k ohm resister for voltage divider) or sensor ground from Arduino, since the cars DME circuit already has this, only taping the sensor circuit to pin A0. It is back on the laptop now while I'm trying to sort this out.

TonyWilk:
It might be (as bperrybap mentioned) that the clk line is bouncing
and this picture from the tronixlabs website seems to show that the board has no decoupling capacitors at all:

Adding some decoupling as mentioned earlier will be a good idea.

You can try adding a 100ohm resistor in series from the Arduino pin which drives the CLK line to the CLK wire. This is sometimes a fix since it 'slows down' the clk and stops it bouncing about as much.

Yours,
TonyWilk

I tried the 100 ohm resister in the clock line and didn't fix it, thanks for the suggestion though. I'm determined to solve this as I'm close to having the project like I want it. I have the caps ordered.

Wow. From the photo and the schematic I'm assuming there are no caps at all.
Adding some caps should fix things.
Here is an old thread on the topic: http://forum.arduino.cc/index.php?topic=187385.0

On your PCB, I'd be tempted to lay the cap right on top of the 595 and carefully solder the legs to pins 16 and 8. (power and ground).
looks like you could even use the holes in the PCB for pin 16 on all the chips and pin 8 on three of the chips.
Or looks like you could use the post that connects to pin 13 which is grounded for your ground connection for the caps.
You'll have to clear off plating on the holes a bit for the solder.
Of if you are careful you could solder the cap wires directly to the chip pins.

--- bill

bperrybap:
Wow. From the photo and the schematic I’m assuming there are no caps at all.
Adding some caps should fix things.
Here is an old thread on the topic: http://forum.arduino.cc/index.php?topic=187385.0

On your PCB, I’d be tempted to lay the cap right on top of the 595 and carefully solder the legs to pins 16 and 8. (power and ground).
looks like you could even use the holes in the PCB for pin 16 on all the chips and pin 8 on three of the chips.
Or looks like you could use the post that connects to pin 13 which is grounded for your ground connection for the caps.
You’ll have to clear off plating on the holes a bit for the solder.
Of if you are careful you could solder the cap wires directly to the chip pins.

— bill

Thanks, I have some caps ordered, should get them in a couple days. The soldering looks like a challenge to these old eyes, but I’ll manage it…lol Thanks again.

Ok need more suggestions, I have installed the 0.1uf caps on pin 16 and 13 of the 595's and still same problem. Whatever it is I am doing by placing my finger on the clock wire I need to duplicate, it runs so good while I am touching that wire.

I am amazed that it would work without caps.
Even with caps on the i.c. power pins you still have a risky arrangement. Especially in an electrically noisy automobile.

Note that a cheap TM1638 or MAX7219 module would give you an intelligent 4-8 digit display.
With the ability to alter the brightness too.

As a kludge you could just put a low pass filter on the CLK line e.g. 100R + 10nF. (RC=1us)
Likewise, you could apply treacle to every signal line. I suppose you could use longer time constants.

You could also place 10k resistors across the input pins. I would guess that the display goes absolutely haywire when you remove the input cable.

David.

david_prentice:
I am amazed that it would work without caps.
Even with caps on the i.c. power pins you still have a risky arrangement. Especially in an electrically noisy automobile.

Note that a cheap TM1638 or MAX7219 module would give you an intelligent 4-8 digit display.
With the ability to alter the brightness too.

As a kludge you could just put a low pass filter on the CLK line e.g. 100R + 10nF. (RC=1us)
Likewise, you could apply treacle to every signal line. I suppose you could use longer time constants.

You could also place 10k resistors across the input pins. I would guess that the display goes absolutely haywire when you remove the input cable.

David.

I chose this display mainly for the enclosure, being easy to install and blend in the dash. No other displays had any enclosures that I could find.

I don't have any 10nf capacitors, the kit I bought had 500 caps from 0.1uf to 10uf, will have to order 10nf caps.

When you say put 10k resistors across inputs, exactly which inputs are you reffering to?

Pull SDI, SCL to GND with 10k. Pull LCK to VCC with 10k.
This will mean that your display box is in a known state without any super-high impedance pins exposed to electrical interference.

You can probably put 100nF directly on the LCK line. It is effectively a /CS Chip Select as far as SPI is concerned.
I suspect that the pullup and pulldowns will reduce the susceptibility to interference.

Adding a 1us time constant to SCL can be done with either 100R, 10nF or 10R, 100nF.

I have not looked at your software code. Hardware SPI can be clocked at 125kHz to 8MHz.
Bit-banged SPI can be as slow as you like.

Quite honestly, sound electrical connections from the Arduino output to the display input will mean everything is at low impedance. Unlikely to pick up electrical noise.
Ready made Dupont crimped wires are pretty reliable. Hand made crimping less so. Especially if you have used them on wrong size males.

David.

Edit. Just looked at your INO. You are using shiftOut() and digitalWrite() instead of hardware SPI.
You will be unlikely to manage 100kHz. You could afford a low-pass time constant of up to 5us

Porschetech3:
Ok need more suggestions, I have installed the 0.1uf caps on pin 16 and 13 of the 595's and still same problem. Whatever it is I am doing by placing my finger on the clock wire I need to duplicate, it runs so good while I am touching that wire.

Do you mean you have connected 0.1uf from pin 16 to pin 8 (gnd) and another one from pin 13 to gnd ?

Could you post a picture of the board as it is now with your caps added... just to check, thanks.

Yours,
TonyWilk

TonyWilk:
Do you mean you have connected 0.1uf from pin 16 to pin 8 (gnd) and another one from pin 13 to gnd ?

From the schematic pin 13 is connected to DGND and the GND header pins are connected to DGND.
While they don't show pins 16 and pins 8 of the 595s (power and gnd) I'm assuming that DGND is the main ground for the PCB.

I assume that pin 13 was used vs pin 8 as there is post from the LED that makes it easier to use for a ground at least one of the chips. (the other 3 have a hole in the PCB that could be used for a closer connection to the ground at pin 8).

--- bill

bperrybap:
From the schematic pin 13 is connected to DGND and the GND header pins are connected to DGND.

Yeh, I see, ok. Would be nice if the other side of that PCB was a ground plane, but I wouldn't bet on it :slight_smile:

The OP's description of 'touching the wire makes it work' makes me wonder if it's a 1/2-fried output.

Mods as per david_prentice post should sort it one way or the other.

Yours,
TonyWilk