# Schematic critique

I designed my first electronics project and I'd be thankful if you could give me any feedback on it.

I'm specially looking for any beginner mistakes, anything wrong or inefficient with my circuit, and on the way I built the schematic.

The project is a kitchen timer controlled by a Arduino. It has three timers that can run at the same time and it beeps when it reaches zero. It is powered from the wall, but when it's disconnected a battery must assume, without rebooting the timer.

The first schematic is the power supply. If connected to the wall, it should not use power from the battery, but it must switch to the battery if disconnected.

The second schematic contains the microcontroller and the switches and buttons used to control the timer.

The third schematic contains the display.

I understand that evaluating a schematic is a lot to ask, so I'm really thankful for any feedback.

EDIT

I'm very grateful to everyone who took their time to comment on my schematic. I don't have any engineer friends around so your feedback is highly valuable.

I tried to make the changes according to what you suggested. I haven't tried it on the breadboard yet, so I'm not sure if everything will work. I still need to make a few tests to find out the best value for R5.

Here's the updated schematic:

• 220 ohm for the LEDs is a little low. The value should depend on the voltage and the forward voltage of the led. Let's assume you are using a typical led - forward voltage 0.7v and current 10mA. For the 12v led, using V = IR, resistor should be (12v - 0.7v)/10mA = 1130 ohm... So a 1.2K resistor there. Same for the 5v led, maybe a 470 ohm resistor. Make these values a little smaller if you want brighter. – geometrikal Aug 11 '12 at 21:29
• @geometrikal Thanks, I didn't have any program installed so I just drew by hand. – André Wagner Aug 11 '12 at 21:32
• The Atmega reset line is active low so it should be tied to Vcc not to ground. I love the 8 bit feel, it looks great. – s3c Aug 11 '12 at 21:38
• Debounce will make a smooth low to high transition when the switch is pressed. Is S4 a three pole switch? You don't need the bottom resistor of r3, no need to pull down if it's not connected to the mcu – geometrikal Aug 11 '12 at 21:41
• Software debouncing is an entirely valid solution and quite common; provided the cycles/memory to do it would be otherwise unused, it has zero unit cost once developed. – Chris Stratton Aug 11 '12 at 22:15

Kudos for using a refdes (reference designator) for (most) components. Especially if you want to discuss a schematic they're needed for decent communication.

The power supply

• you use the refdes "L1" and "L2" for the LEDs. Don't. "L" is the standard designator for inductors. Use "LD" or "LED" or, as I do, "D" for diode.
• the value of R1 is too low. It will give the LED 45 mA which is too much for an indicator LED. Increase the value to 560 Ω and you'll have a safe 18 mA; they're usually rated at 20 mA. Check the datasheet. By the way, do you really need that LED? It will always consume power.
• C1 and C2 are indicated as "10 mF", where I presume they should be "10 µF", that's a factor 1000 difference. They'll most likely be electrolytic capacitors, which are polarized. Use a symbol which indicates the polarization and clearly indicates which is the positive side. Also for electrolytics it's good practice to mention the voltage in the schematic as well. C1 should be at least 20 V, C2 10 V.
• Place a 100 nF parallel to C1 and C2
• draw C2 closer to the regulator's output than the LED. Electrically it makes no difference, but that's how you should place them on the PCB. The 100 nF should be closest to the output.

The microcontroller

• the ATmega328 doesn't have a VREF pin. That should probably be Vcc. Add a 100 nF decoupling capacitor between Vcc and ground, as close as possible to the pins. Always decouple an IC's power supply.
• Reset is connected to ground. That's OK if you use the internal reset circuitry, but don't forget to program the the RSTDISBL bit to "1".
• you can't drive a speaker directly from an I/O pin. You'll need a transistor there.
• you can save a resistor if you use the internal pull-up of PC0 and connect the switch to ground. R4 won't be needed then. Remember that the logic will be inverted.
• same for PB2 to PB5 and switches S2 and S4: internal pull-ups and switches to ground instead of +5 V.
• switches S2 and S4 are confusing. You have 2 contacts on the lower side, and 5 on the high side. Are they supposed to be change-over contacts? If so, you won't need that: one input will always be complementary to the other, so you'll only need one. In any case the lowest of the pull-down resistors serves no function.
• I would use more descriptive names for the nets on Port D, like "Digit1", "Digit2", etc.

The display

• Again, decouple the power supply with a 100 nF capacitor.
• the resistor values for R4 are way too high. Swap them for 150 Ω types.
• the 5 R5 resistors can be dropped. They serve no function.
• the microcontroller can't drive the display common cathodes directly: with all the LEDs on you'll have 7 $\times$ 20 mA = 140 mA, that's much more than an I/O can sink. You'll need 5 NPN transistors here, or a transistor array like the ULN2803.

Conclusion
This is a long list, but I think you did a fine job, considering it's your first project. I've seen much worse schematics. Success!

edit Re the update of the question
Your circuit around Q1 and D3 is not quite OK: the battery will feed the LED, but not the rest of the circuit. I'm not sure the LED as battery indicator is a good idea: especially with battery power you have to be economical, and not waste power on a LED.

How about this: keep the diodes like in your first version, but control the LED from the microcontroller. Use one of the free pins to detect the presence of the 12 V through a 5 V zener diode and a series resistor. You can then blink the LED when you're running on battery power. A short flash once every second is much more economical.

• Thank you very much for taking the time to evaluate the schematic. One initial question: you speak of decoupling the microcontroller and, later, the display. I'm assuming that all the +5V inputs are connected to the +5V output on the power supply. Isn't the power already decoupled? Why would I need to decouple again? – André Wagner Aug 12 '12 at 16:16
• @André - Good question. Especially digital ICs may draw short current peaks when many transistors switch simultaneously. The rise time may be very high (= high frequency), and the inductance of the PCB traces may be a high resistance towards the power supply's capacitor. So you want an extra energy buffer (that's what a decoupling cap is) nearby the power pins. Take "nearby" literally: 1 mm is better than 5 mm. An extra is that the current spikes don't travel over the board, where they could cause EMI. Always provide decoupling for all ICs. It's the law! :-) – stevenvh Aug 12 '12 at 16:24
• Another question: about your last comment, that I'd need some transistors to lead the LEDs. I built the circuit in the breadboard without the transistors (connecting the MC directly in the LEDs) and it was bright enough for my needs. (I'm using 220R resistors) Can I leave it like that or am I at risk of damaging the microcontroller? – André Wagner Aug 13 '12 at 11:58
• @André - Damaging. I calculated that you'd draw up to 140 mA, while the datasheet says 40 mA is absolute maximum. Page 313. Read the notice: "Stresses beyond those listed under “Absolute Maximum Ratings” may cause permanent damage to the device." And last line: "Exposure to absolute maximum rating conditions for extended periods may affect device reliability." Better use transistors. – stevenvh Aug 13 '12 at 13:41
• Ok! Then I guess I'll put some transistors there! Thank you for the info. – André Wagner Aug 13 '12 at 13:46

I'll throw a few quick thoughts in here and may add to them later.
The list from others in comments would do well as a combined answer.

Somebody should lock Olin up until you address some of the points raised :-).

C! & C2 are shown as 10 mF each.
If you mean 10 microFarad (as seems likely) then this is more usually written 10 uF.
You MAY have written this as uF and it has been changed by font substitution to 10 mF (as sometimes happens) but this must be checked for.

You are using one resistor name for a group of resistors. eg R4 = 7 x 10k.
That is easily understood but makes it impossible to easily refer to an individual resistor or similar, and is unsuitable for automating for layout purposes (as which component is R4 is uncertain.

The ability to read designations easily and unambiguously is a major design aim of a schematic.
The different visual appearance of labels in different places does not seem to have a purpose (but may have) and some are hard on the eye.
eg A B C D connecting to DA DB DC DD are white in black squares. Hard to read.
White on grey inside component bodies is equally hard to read and unnecessary.
Grey on grey is worse.

At present this diagram is a functional instructor but is impossible to use for constrcution or troubleshooting without other reference material (or an eidetic memory).
Addition of pin numbers would greatly improve the range of uses that the diagram can have.

All the electrons will run out of C1 :-).
Not really, of course, but align its leads vertically as per C2.
There is nothing wrong with aligning capacitors horizontally where it suits the application but normal usage when showing a capacitor from a horizontal line to ground (such as before and after voltage regulator U1) is as per C2.

Similarly the horizontal arrangement of R2 is less common and "dooesns't look nice". This was done to save space, but eg moving U1 up so its input was fed horizontally by D1 and moving the text above U1 would allow the same space to be used but L2 & R2 to both be vertical.

SPK1 connection looks a bit strange - intention is clear.

In a number of places readability would be improved by the use of a horizontal connection to ground, or of a local ground symbol rather than a long wire to ground.
eg pin LE of U3,

Regulator may be Toshiba TA4805.
Unloaded quiescent current is 0.85 mA typical and 1.7 mA worst case.