0

I’ve created a 5x5 multiplexed LED display that’s behaving very strangely. It appears to have something to do with the data signal from the micro controller to the first shift register which appears affected by the length of wire, but in a counter-intuitive way - the longer the wire, the better it works.

What I mean is that the display works fine when the micro controller is sitting on a breadboard and connected to the rest of the circuit via wires (image 5 in the gallery below), but not when connected directly via the header pins/socket (second to last image) - in that state the LEDs are stuck in random on/off states. Interestingly, the display also comes to life in the directly connected configuration when I measure the voltage between the data pin and ground.

Yes, I have decoupling capacitors (although they may of course be connected wrong).

Components: Trinket M0 2 shift registers (74HC595) 1 Accelerometer (ADXL345)

Project images here (not in proper order unfortunately, but with relevant captions): https://i.stack.imgur.com/oWHIq.jpg

Code: https://justpaste.it/7lywq

Because of the strange behaviour I thought there might be something wrong with the header pins on the MC and the header socket in combination, but after replacing the header pins and one of the sockets, there was no change. It could be that the second header socket, which I haven’t tried to replace, is faulty, and for some reason a better connection is had with wires as opposed to header pins.

I received some help on reddit where they suggested adding bulk capacitors, but this didn’t help (too few/placed wrong?). Images of project after adding them: https://i.stack.imgur.com/9E17w.jpg

As mentioned, if I measure voltage between the pin which sends out the data bits to the first shift register (number 1 on the MC) and GND, the display comes to life.

Does this strange behaviour make sense to anybody? What is the voltmeter doing to the pin which causes it to work? Is it sinking current? Pulling the pin to ground? Increasing resistance? I’ve tried connecting the pin to GND via various resistor values up to 1Mohm, but the display still doesn’t work. Also, merely touching the pin with metal causes a change in which random LEDs turn on/off.

What is so frustrating is that my troubleshooting is muddied by the fact that the display works fine - as long as I have it on a breadboard connected via wires, so loose connections and other such issues are (IMO) very unlikely.

EDIT - SOLVED

Toffa
  • 11
  • 3
  • Try putting a 470Ω resistor in _series_ with the first shift register. You are probably getting signal reflections which vary by length of wire. – JYelton Aug 13 '19 at 14:41
  • Cool, do you mean I should place the resistor between the mc's 5V and the first shift register's VCC, or between the mc's data pin and the shift register's data pin? – Toffa Aug 13 '19 at 14:53
  • 1
    Any chance to see the schematic? – Dmitry Grigoryev Aug 13 '19 at 15:47
  • Some more info: the display worked when the mc was attached, before I had connected the accelerometer to 3.3V and connected two pull-ups to it and the mc. It's connected to the same ground as the 5V circuit going to the shift registers/LEDs. Could there be an issue there? – Toffa Aug 13 '19 at 15:48
  • Oh damn, just noticed that I have four decoupling capacitors of the same value. So I'm going to keep 100nF as the bulk capacitors, and 10nF closer to the ICs and see if that helps. In the meantime, here are the "schematics" (https://imgur.com/a/chTWzj6). The resistors and capacitors are placeholders, so the values aren't correct, but their positioning is. There's no component in this program that matches my MC so it's represented by a faint rectangle. – Toffa Aug 13 '19 at 17:29
  • @JYelton I placed the resistor in series coming out from the data pin, going to the first shift register's serial in, but that didn't help. Perhaps you meant closer to the shift register and on the VCC? – Toffa Aug 14 '19 at 10:42
  • As per my last comment I replaced the decoupling capacitors by the ics to the more appropriate smaller value (10x smaller). Didn't help unfortunately. :/ Here's what it looks like (https://imgur.com/a/wdHQ1OT). Had to solder them to wires to reach across the chip, which doesn't look good but I hope it's doing its job and the problem is elsewhere. – Toffa Aug 14 '19 at 10:44
  • @JYelton Also, if signal reflections are the problem, shouldn't I see problems by varying the length of wires? Because I tried two more wired-via-breadboard configurations - one where I doubled the length of wires from the breadboard, and another where I added just a couple of cm to them, but both work perfectly (see the jumble of wires here: https://imgur.com/a/znCL1rb). – Toffa Aug 14 '19 at 11:21
  • It appeared you were having more success with longer wire, which I took to suggest that as the impedance went up it was better-matched to the load (shift register). There are a few cases where adding a series resistor can help (see https://electronics.stackexchange.com/q/7709/2028). Perhaps your case is a bit different. I'm not fully sure what to recommend, hence why I commented instead of answered. – JYelton Aug 14 '19 at 15:05
  • Perhaps the real problem is might be something like not putting the data out *before* the clock. What you've done with the capacitor is more random than anything that should work. – Chris Stratton Aug 22 '19 at 11:40

1 Answers1

0

I attempted to replicate what the voltmeter was doing to the signal based upon the help received here. I tried connecting the signal pin with ground via 1M resistor, then 10M ohm, then 10M ohm plus a capacitor (which should've been approximating the voltmeter's effect), but none worked.

Removing the resistors and placing the 100nF capacitor as close as possible between the two signals did the trick. Strangely, however, holding the cap with my fingers and pressing it on the connections worked, but after soldering it on it didn't. Tried it three times to no avail. The difference in connection location was just millimeters, so it was very strange. However one difference between the manual testing and soldering the cap onto the board was the length of wires on the cap. Leaving it full length and soldering it on works. So seems like those extra couple of cm of wire and a well-placed cap was what was missing!

Although I've understood that in general one shouldn't be placing caps on signal lines, so that's why I didn't try this earlier. Weird that it works, but I'm very glad!

wonky placement of cap, but it works

Toffa
  • 11
  • 3