10

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.

Schematic 1

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

Schematic 2

The third schematic contains the display.

Schematic 3

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:

Schematic 1

Schematic 2

Schematic 3

André Wagner
  • 655
  • 4
  • 14
  • What is SPK1? Depending on what it is, it might be a bit too much to drive directly from the I/O pin of your micro. – Jason Aug 11 '12 at 21:25
  • @Jason It's a speaker. – André Wagner Aug 11 '12 at 21:28
  • 3
    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
  • Also I think you mean 10uF not 10mF. But it looks so nice! Like an 8 bit picture. What program? – geometrikal Aug 11 '12 at 21:31
  • 2
    @geometrikal Thanks, I didn't have any program installed so I just drew by hand. – André Wagner Aug 11 '12 at 21:32
  • Also denounce s3 with a cap from pc0 to vcc – geometrikal Aug 11 '12 at 21:34
  • @AndréWagner I understand that... I guess my question wasn't clear. Speakers can have an impedance from a few ohms to many kohms. The speaker is likely not to work as you have it. – Jason Aug 11 '12 at 21:36
  • @geometrikal Why? – André Wagner Aug 11 '12 at 21:37
  • 4
    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
  • 1
    @AndréWagner very impressive. Ps have you heard of eagle cad? It is free for small projects. But again I really like the aesthetics of your schematic... – geometrikal Aug 11 '12 at 21:38
  • 2
    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
  • @geometrikal Good to know! I was having problems with that (high to low transition) and was solving with software. – André Wagner Aug 11 '12 at 21:46
  • @Jason My speaker has "0.5W 8ohm" written in the back. Is that it? – André Wagner Aug 11 '12 at 22:12
  • 2
    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
  • 1
    It appears to me the Atmega is missing a decoupling capacitor on the 5V pin. – ARF Aug 11 '12 at 23:02
  • @ArikRaffaelFunke - So is the CD4051. – Connor Wolf Aug 12 '12 at 00:05
  • 1
    @AndréWagner Yes, you'll need to use something as a 'buffer' of sorts. I wouldn't expect you to get much if anything out of the speaker and you are likely to damage your micro. Take a look at this simple [circuit](http://www.crossroadsfencing.com/MOSFET_amp.jpg) I found with a quick google search. It's a simple amplifier based on a MOSFET. You can create a similar circuit using a BJT if you don't have a MOSFET on hand. – Jason Aug 12 '12 at 00:30
  • If you don't like hand-creating schematics, take a look at [this question](http://electronics.stackexchange.com/questions/1749/what-are-the-best-free-schematic-tools-out-there?rq=1) for some schematic drawing tools. – Tim Aug 13 '12 at 17:22

2 Answers2

10

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.

stevenvh
  • 145,145
  • 21
  • 455
  • 667
  • 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
  • 3
    @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
  • 2
    @André - Damaging. I calculated that you'd draw up to 140 mA, while the [datasheet](http://www.atmel.com/Images/doc8161.pdf) 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
4

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.
mF = milli-Farad = 10,000 microFarad.
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.
BUT LED status indicator draws about 3 mA . A PP3 9V 'transistor battery' had about 600 mAh capacity so battery life unloaded ~= 600/5 = 150 hours or about 1 week of 24/7 on but unloaded operation.
Modern LEDs can be VERY bright and under 1 mA should be enough.

Port pins PC1 - PC5 are OK as shown but MUST be programmed with pull up/downs if set as inputs or must be set as outputs.

R4 = 7 x 10k look MUCH too high unless it is a smart display in touch with a higher power for current provision.

Anon ...

Russell McMahon
  • 147,325
  • 18
  • 210
  • 386
  • "unless it is a smart display in touch with a higher power". Do these exist for 7-segment? I know they do for [matrix displays](http://www.avagotech.com/docs/AV02-0699EN). – stevenvh Aug 13 '12 at 17:18
  • Ah, sure they do! Like the expensive MAX7219. But those are usually serially interfaced, I think. – stevenvh Aug 13 '12 at 17:28
  • Olin was locked up and now is missing. Come back Olin we miss you. – RoyC May 01 '19 at 17:03