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://imgur.com/a/w1Gr4fj

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://imgur.com/a/uD8TlVY

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.


  • \$\begingroup\$ Try putting a 470Ω resistor in series with the first shift register. You are probably getting signal reflections which vary by length of wire. \$\endgroup\$ – JYelton Aug 13 '19 at 14:41
  • \$\begingroup\$ 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? \$\endgroup\$ – Toffa Aug 13 '19 at 14:53
  • 1
    \$\begingroup\$ Any chance to see the schematic? \$\endgroup\$ – Dmitry Grigoryev Aug 13 '19 at 15:47
  • \$\begingroup\$ 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? \$\endgroup\$ – Toffa Aug 13 '19 at 15:48
  • \$\begingroup\$ 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" (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. \$\endgroup\$ – Toffa Aug 13 '19 at 17:29

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

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.