My first standalone project - chceck correctness please

SirNickity:
Your latest sketch is many times better in this regard. I found the originals difficult to follow, whereas this one is pretty good.

Absolutely!

SirNickity:

  • First, add a diode at the power input. This will protect your circuit in case the DC barrel connector's polarity is accidentally reversed.

There are always two options here. One is a series diode, and since there already seems to be a surplus of voltage, a silicon diode would seem sufficient. If voltage drop is more critical, a Schottky diode and alternatively, a shunt or "crowbar" diode of sufficient capacity to safely (at least from the viewpoint of this particular circuit, but appropriate with switchmode supplies) bring down the supply.

SirNickity:
Ditch C1 and C7 in favor of a single large 100µF cap at the power supply input. There's no good reason to put separate bulk caps at each regulator unless they're far apart.

Quite so.

SirNickity:
C2 is OK at 10µF, given the likely current demands on the 5V circuit, but I would use something like a 47µF instead just because you can.

I would suggest the opposite. 10µF should be more than sufficient; it is the regulator's task to supply current on sudden demand; these capacitors are only present to stabilise the regulator at frequencies beyond its response. More important is to ensure that the reference (ground) terminal has the lowest possible impedance to the ground and is as far as possible, a "star" point for supply and load. Using ground "spill" or "fill" as far as possible is likely to enhance this. Better to maximise - as you have said - the input capacitor.

SirNickity:
C8 should probably be something like 47µF to 100µF, since fans tend to be current hogs at times.

Ditto my comment above.

SirNickity:

  • In addition to bulk capacitance (the larger electrolytics) it's a good idea to use 0.1µF to 0.33µF ceramic caps on each side of the regulators. This prevents over/under-shoot oscillations.

But they should go to the star point, not just to the regulator reference pin - so the circuit diagram as posted is still a trifle misleading in this respect.

SirNickity:
Put a diode in reverse across the regulators (anode on pin 2, cathode on pin 1 -- or in schematic terms, like this: 1 --|<|-- 2). This ensures the input side is ALWAYS higher than the output side, which prevents backwards flow if power is removed from the input, while charged capacitors or other external voltage exist on the output side.

That is in fact, one reason the output capacitors should be kept small. If you can ensure the supply capacitor has sufficient reserve (and you have a series diode feeding it), it will be continuing to feed the circuit as the output voltage falls, and these diodes are unnecessary.

SirNickity:
You should put a 0.1µF ceramic cap between the high side (pin 1/2) of every switch and ground. This prevents "switch bounce", which is a spiky oscillation as the switch contacts intermittently begin (or stop) conducting during button presses. Unless you either use a cap, or sample the input pins multiple times and average the results, you'll likely trigger multiple "presses" every time your press a button, which is enormously frustrating.

Sorry, the capacitor does not prevent switch bounce, but does cause substantial transients (even worse than bounce!) and wear on the switch contacts (unless extra resistors are employed).

Debouncing should always be performed in software. The algorithm to do so a byte at a time (that is, eight switches) is quite straightforward (though I would have to recall it from some thirty-odd years ago).

SirNickity:
As you can tell, in circuit design, you use a lot of 0.1µF ceramic caps. I buy them 25 to 100 at a time for that reason. :slight_smile:

As one does.