I am asking for help with filtering input voltage for attiny2313. The schematics of the problematic board is here:

schematic pdf

The circuit is powered by a MEAN WELL RD-125A power supply 5+12V.
There are 3 of these boards in the device each controlling one 12V 7 segment LED display.
This board is receiving data from a RPi and decoding it into a 7 segment output. The transistors are switching 12V 90mA each supplied by another output of the same power supply.

The problem we are experiencing is that random segments blink randomly when any other appliance for example a lamp is switched on/off while plugged in the same extension cord as the power supply. This is a problem for us because the device also has a relay and switches it's own 230V piezo siren causing the same blinking issue.

I think the problem is caused by poor input voltage filtering for the microcontroller. Unfortunately this is my first mcu project and I am kind of a noob. :D
I updated the schematic to this:

schematic png

adding one more 1nF capacitor and an inductor into the power side of the attiny, I found similar arrangements in various datasheets.

Is this going to work? Are the values adequate?
Before you ask I know the LED resistors seem large, the LEDs use very little current, they all light up very well. :D

PCB Layouts: This is the version that is currently having problems: Current PCB

I have updated it to include the inductor and extra capacitor like this (this is not yet tested though): Updated PCB

The device also has separate board to which the mcu controller boards are connected: enter image description here enter image description here
The RPI connects to this board with the 40pin header which is split into 3 smaller connectors for 3 of the mcu controller boards. This board also has a USB connector at the top which provides power to the RPi. All boards are connected to the same power supply and share the same ground through the Molex power connectors.

The weirdness you see around pins is because these boards are hand made and hand drilled and the extra copper helps with imprecise drilling.

The internal construction of the clock looks like this: enter image description here
The two resistors on the heat sink up there are there because the Mean well power supply needs a minimal current draw. Mean well has two versions of the power supply with the same name. The new version does not need minimal current draw, the old version does need it. Unfortunately they only have the new datasheet on their website while shops still have the old version in stock.

The small board in the middle is the splitter which takes the RPI 40 pin connector and splits it into the individual mcu display controller boards. It also has the orange relay.
The siren is connected to the relay according to the layout above.

We tried shielding and grounding the signal cable which did not help. enter image description here Thanks to the comments below we found that simply connecting the signal cable even with the other end not connected to anything causes the led blinking. The cable apparently works as an antenna and picks up enough interference to influence the inputs of the attiny. We wrapped the entire cable in copper tape and grounded it to the same ground which is connected to the RPi ground and all other ground pins. That did not stop the blinking. But it confirmed that power filtering is not the problem so we decided to use the software solution by requiring the input to keep the input value for a certain amount of time before showing it on the display.

If you need to know more information about the boards or PCB layouts feel free to ask.

  • 3
    \$\begingroup\$ The connector to RPi does not have ground. Do Rpi and this board have common ground in some way, and how do they share it? \$\endgroup\$
    – Justme
    Apr 26, 2021 at 17:33
  • \$\begingroup\$ Could you some pictures of the physical design of the project? I want to see if/how the mcu is shielded against the high power electronics (relays, lamps), how far they are, the capacitors, how clean the pcb is etc. For filtering input power, use the smaller possible capacitors in combination with the largest value possible (i always use 10uF 0402[inches] smd caps close to each vcc pin of the mcu) \$\endgroup\$ Apr 27, 2021 at 7:28
  • \$\begingroup\$ Thanks for your replies. I updated my post with more pictures and details. The ground is shared between all boards via the Molex power cables which connect everything to the ground of the power supply. The Rpi is connected using a USB plug which is also powered and grounded by the same power supply. \$\endgroup\$
    – Athwale
    Apr 27, 2021 at 9:59
  • \$\begingroup\$ I can not use SMD parts, the whole device is hand made and hand soldered. I would have posted a photo of the clock but I can not because my reputation is below 10. \$\endgroup\$
    – Athwale
    Apr 27, 2021 at 10:03
  • \$\begingroup\$ The lamp which we were able to use to reproduce the problem was connected to the same extension cord outside of the clock. Which means parallel to the power supply. I will post updated photos of the clock later today. \$\endgroup\$
    – Athwale
    Apr 27, 2021 at 10:12

1 Answer 1


It's almost certainly a lack of ground along the signal path. The power conditioning looks great.

Try cutting some track and wiring up a ground to run on every signal cable. This will reduce inductive coupling a bit, and is just good practice. You have the spare wires.
You could also make an aluminium foil shield for the whole case, connected to signal ground and mains earth. (5 sides of the case would be enough).

But the simplest fix is in software. As the LEDs are "only" for humans to see, they don't need to update very fast. Add some glitch tolerance to the ATTINY firmware, that it only changes output state if the input has been present for 20 ms or so.
Longer for the siren.
I usually do this with an 8 bit counter - read the pin 10000 x per second. Increment if it's high, decrement if it's low, but do not wrap. Then consider values < 127 to be 0 and >=127 to be high. That way a short transient won't change the display state.

  • \$\begingroup\$ I will get back here once I am able to test the suggestions. Thanks. \$\endgroup\$
    – Athwale
    Apr 28, 2021 at 11:06
  • \$\begingroup\$ I finally tried your suggestions (see above for results). Interestingly shielding the cable did not help. But that could be also because I did not do it correctly. In the end we used the software solution which seems to work well. But I would be grateful if you could explain to me how to ground it correctly. We wrapped the whole cable in conductive copper tape and grounded it to the PSU ground. This same ground is connected to the GPIO ground pins an all other ground pins across all the boards. Why did it not help? Disconnecting the cable stops the blinking so the problem is the cable. \$\endgroup\$
    – Athwale
    May 10, 2021 at 15:38
  • \$\begingroup\$ It's not specifically the shielding but the presence of a continuous ground path parallel to the signal wires. Assuming that ground is the same everywhere, because it's technically connected, isn't good enough. But there are many ways to shield and protect a circuit - ground planes, separating grounds, shielded cables, line drivers and differential lines, and yours doesn't have them, so interference is likely. Glad the software solution works, no need to capture microsecond glitches anyway. \$\endgroup\$
    – tomnexus
    May 10, 2021 at 16:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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