PCB Review Request - Digital Clock - Page 1
Forum section: electronics / projects

author: dreece2498
author_rank: Contributor
timestamp: December 28, 2022, 02:37:28 am
content: Recently made a 7 segment display with RTC using an Atmega32u4, and 4 7 segment common anode displays. Plan on boot-loading using a USBASP, programming with arduino. You can find my original reddit post here:https://www.reddit.com/r/PrintedCircuitBoard/comments/zwxjd2/pcb_review_request_7_segment_display_with_rtc/although I'm pretty sure my posts are being marked as spam because I had to reupload it a few times. I attached a pdf of my schematic, along with the PCB layout and 3D view from Ki CAD 6. The PCB is a two layer board, planning on using an Adafruit Raspberry pi power adaptor to power it through USB - C. Want to see feedback in terms of my routing skills, layout, and schematic. Looking to improve the layout in anyway I can before I order the board and hand assemble it. Any feedback is greatly appreciated.

author: I wanted a rude username
author_rank: Frequent Contributor
timestamp: December 28, 2022, 03:14:18 am
content: Given the signal speeds involved, you can send it to JLCPCB as is and it'll probably be fine. You took obvious care with the USB data lines ... the other buses are slower.I am suspicious of R25. What's the bus between the ATmega and the RTC? I2C? If so it should be pulled up correctly. Those RTCs often have other lines too, like for alarms ... good to connect those as well. In general, anything you're unsure of, connect it or break it out to test points or to footprints for 0 Ohm resistors. That's how you can maximise the odds of easily being able to salvage the board when you find problems like for example UART TX and RX not being crossed over.The ground plane on the bottom layer is broken up by all the traces. Try to keep it more connected. Simplistically, current will want to flow from the GND pins of the ATmega, 7-segment LEDs, etc. back to the USB port ... and it will try its damndest to do this as close as possible to the path the current originally took from the USB port to those devices' VCC pins. If you don't let it take a nice short path, you get EMI and other problems ... but again, mostly at higher frequencies. Robert Feranec has some good videos explaining this, as well as about a hundred short tip videos for PCB design ... highly recommended.Also if you intend to use solder paste I highly recommend you order a stencil with your PCBs to make assembly easier. It doesn't have to be a huge one in a frame ... order a small one without frame, it's not expensive and it's fine for a few boards.

author: ataradov
author_rank: Super Contributor
timestamp: December 28, 2022, 03:17:49 am
content: C25 technically violates USB spec. Device should not present more than 10 uF on the VBUS.TVS on the programming interface seems unnecessary to me.The layout is pretty messy, but looks functional. It could be way more compact too, but it depends on the form factor you want. If this is the size of the PCB you need anyway, there is no reason to cram stuff together.

author: I wanted a rude username
author_rank: Frequent Contributor
timestamp: December 28, 2022, 03:47:15 am
content: Oh hey, didn't notice the schematic. R25 is indeed a pullup, just routed weirdly ... should go directly to the trace from the ATmega, not via a branch off the RTC. (This is probably more aesthetic than practical, but to borrow an expression from aeronautics ... if it looks right, it flies right.) And yes, route that MFP.@ataradov: The pie filter on the input is also excessive, but soldering practice is good?You're right about the USB spec, and I always stick to 10 uF like a good boy too, but having more usually doesn't cause problems in practice unless the capacitance is so high as to temporarily brown out the bus.Going with a large PCB for the prototype ... maybe three or four times the target PCB surface area ... is a good idea. Lots of space for test points, 0 Ohms, solder bridges, etc.

author: dreece2498
author_rank: Contributor
timestamp: December 28, 2022, 03:50:29 am
content: The bus being used I2C, page 2 of the datasheet recommended pull up resistors for SDA, SCL, and the multi function pin (MFP) which can be used as an alarm, but I left unconnected (The zero ohm resistor isn't a bad idea though). I realize that the layout is rather crappy, I really didn't want to run so many traces underneath on the bottom copper but because of my layout and pin assignments its breaking up the ground plane. And I was actually just going to hand solder with flux and 0.3mm solder, I've used paste before but only when there's a pad in the middle of the IC I can't reach with a normal soldering iron.

author: dreece2498
author_rank: Contributor
timestamp: December 28, 2022, 03:56:09 am
content: That is true, I do realize that USB Spec states that you should not exceed 10uF, however even though the datasheet recommended 10uF for the Vbus line and 1uF for UCap, I was concerned with voltage derating. I always try to avoid using the minimum value for capacitance, but considering the low speed of this board I guess sticking with the recommended values would be better. As for the layout, what can I optimize to make the design less cluttered? I was trying to keep a small form factor considering everything but the segments are smd components.

author: dreece2498
author_rank: Contributor
timestamp: December 28, 2022, 04:00:43 am
content: The pi filter I put there because I was concerned about VBus being noisy, maybe a bit excessive but I wanted to make sure that I get 5V and 3.3V as clean as possible. From your post its seems like your suggestion is to increase the size of the board, that way I can make routing a lot cleaner and more practical. Is there anything off in terms of how I designed my schematic?

author: ataradov
author_rank: Super Contributor
timestamp: December 28, 2022, 04:06:52 am
content: Ground planes and all are good to keep in mind, but in this case it does not really matter.VBUS pin is used for monitoring, it does not need any capacitors at all. And UVCC needs to be powered from 5V even for 3.3 V designs.And UCAP should be 1 uF. Don't overthink the derating part. Just use the recommended values.The board size cab be reduced by 1/2 - 2/3 if you use both sides for components. The routing has a lot of small jumps between the layers where no jump is necessary if you just continue the trace on the same layer.Let's say VBUS is "noisy", so what? You are really overthinking and over-complicating this for no reason at all. Why do you need a super clean voltage rails to drive some LEDs?

author: dreece2498
author_rank: Contributor
timestamp: December 28, 2022, 04:21:23 am
content: The datasheet of the MCU says that a 10uF cap is highly recommended, but I guess like you said in this case it doesn't really matter. By putting some components on the back, I'm assuming you mean components such as R41-R45 and perhaps the PNP transistors that I used for the 7 segment display? As for Vbus, I just figured it was good design practice to incorporate filtering but again, for something this simple I guess its not needed.

author: I wanted a rude username
author_rank: Frequent Contributor
timestamp: December 28, 2022, 04:33:27 am
content: Well spotted about UVCC. Page 257 ofthe datasheet, Figure 21-4, Typical Bus Powered Application with 3V I/O.Routing improvements, for starters just take that 3.3 V trace that runs from the programming header to the RTC and other things. You can move that entirely or almost entirely to the top side. Also, look for opportunities to avoid crossing traces by using different MCU pins. You have all eight LED segments on one port, very nice ... maybe it's possible to reorder them a bit, like you already did by swapping E and F around, to make your routing easier.I recommend sticking to single-sided assembly, as it's easier toDFM. At the low end, where you're using two-layer boards, every cent counts. Making the design as efficient as possible to manufacture can be a rewarding challenge.How much you want to improve this design really depends on your self-development goals. It's a question of getting it to where you're happy to let it go ... but be prepared that even before you get the PCBs back you will already have improvements in mind.

author: ataradov
author_rank: Super Contributor
timestamp: December 28, 2022, 04:36:19 am
content: You will have plenty of capacitance due to other stuff attached to VBUS.I would place most of the stuff on the other side behind the indicators. Start with the battery. It looks like the holder would fit between the indicator pins and you just need to make sure that the plastic base is taller than the indicator pins.The voltage regulator also does not need to be this huge, some generic SOT-23 regulator would be plenty. I usually use MIC5504, but there are a lot of options.MCU might fit on the other side as well. It really depends on how things fit, it is hard to tell from just looking at it. Place all the big components and the small stuff can go where fits.It is a good practice to follow layout guidelines and other "free" things like that, but over-designing "just in case" is rarely a good idea.The board size mostly matters if this would be a real clock. It is strange to have a huge clock with a PCB sticking out. If this is just a random training project, then it does not really matter. But in that case why not move the battery on the front as well? There is plenty of space.

author: floobydust
author_rank: Super Contributor
timestamp: December 28, 2022, 04:39:58 am
content: TheMCP7940is kind of a piece of junk. Microchip can't make a decent RTC. Low cost but has asilicon erratawhich I think is clown level "Date incrementing at noon" or "Spurious alarm interrupts when matching on minutes" etc. This IC is 8 years old and not fixed?!I would instead consider the DS3231 which are very accurate, or the lower cost DS1307 seems to be popular but I have not used it and not so accurate.I dislike the digit driver design, the 10Ω resistors add some current feedback which means digits will vary in brightness depending on how many segments are lit.I would delete or 0Ω them. Switching transistor use, you want them saturated so ideally 10x the base drive but even 1mA is enough extra base current. So I would go smaller value for R30 etc. say ~2.2kΩ again to prevent the digit brightness from changing due to the transistor's voltage drop changing.I would maybe have a provision for a beeper, at least a pad from a MCU spare I/O pin in case you want an alarm.

author: dreece2498
author_rank: Contributor
timestamp: December 28, 2022, 04:53:29 am
content: I see, I think one of my biggest problems right now is design overkill. Though its good practice to not use the bare minimum of components voltage or current rating, I think I went too far to the other extreme. This is mainly a hobby project, I would eventually like to design and produce my own products one day but that is a long, long way off and I'm mainly trying to get the fundamentals down first, so I'm not too concerned about making a case for this or trying to sell it. I appreciate the feedback and I will definitely be making a lot of changes.

author: tooki
author_rank: Super Contributor
timestamp: December 28, 2022, 04:54:06 am
content: Quote from: dreece2498 on December 28, 2022, 03:56:09 amYou have lots and lots of unnecessary layer changes. Take a look at this crude edit (blue and red are new/replacement traces or layer change, dotted/slashed green is deletions)Also, it can often be sensible to use a ground plane and a power plane, rather than snaking power around on a trace.

author: dreece2498
author_rank: Contributor
timestamp: December 28, 2022, 04:55:45 am
content: All great tips thank you, will definitely be changing the RTC to the ones suggested, that and fixing up the PNP circuitry.

author: tooki
author_rank: Super Contributor
timestamp: December 28, 2022, 04:56:47 am
content: I second the recommendation of the DS3231SN (or DS3231M). I’ve used it in a few designs.

author: ataradov
author_rank: Super Contributor
timestamp: December 28, 2022, 04:58:51 am
content: Quote from: dreece2498 on December 28, 2022, 04:53:29 amThat's a good time to not over-design, but follow vendor recommendations. If you find out that something is lacking, then make appropriate adjustments for the real design.If you always over-design and never just do enough, your stuff will always be expensive and you will never learn how much you actually need for proper operation. I'm not suggesting complete removal of all the filtering and such, but simply following recommended values is enough in majority of cases.

author: tooki
author_rank: Super Contributor
timestamp: December 28, 2022, 04:59:20 am
content: Also, you might want to insert a colon in between the hours and minutes (or just use a 4-digit clock LED display).

author: floobydust
author_rank: Super Contributor
timestamp: December 28, 2022, 05:00:52 am
content: Quote from: dreece2498 on December 28, 2022, 04:53:29 amDon't forget to have fun with this project, it doesn't have to be perfect. Designs can always be better, improved more and they never get finished lol. Collect suggestions and at some point take pride in your work as being good enough. I think the basic design is pretty good and just needs some polish.

author: SiliconWizard
author_rank: Super Contributor
timestamp: December 28, 2022, 05:05:47 am
content: Quote from: I wanted a rude username on December 28, 2022, 03:47:15 amLarge capacitors create a large inrush current when you plug the device in. It's not good. It's not just on paper. It's an almost guaranteed recipe for getting issues especially on laptops that limit current un VBUS and tend to give "this device as malfunctioned" when you plug it in. Not pretty. I've seen that with several devices. Since then, I use some form of current limiting if I absolutely need more capacitance.The ferrite will act as a current limiter (if you put the bulk of the capacitance after it), but in practice those are pretty small inductance values and don't do much for limiting inrush current. You may need to take other appropriate measures.

author: timenutgoblin
author_rank: Regular Contributor
timestamp: December 28, 2022, 05:37:03 am
content: Quote from: tooki on December 28, 2022, 04:59:20 amMaybe just install one of the inner LED displays upside down so that the DPs (decimal points) can be programmed to toggle on and off in time with the seconds. However, having one of the LED displays upside down would complicate the multiplexing of the 4 digit clock display. The PCB layout would then need to be changed.On the other hand, maybe two LEDs would be (more) aesthetically pleasing and easier to implement with programming and PCB layout.

author: dreece2498
author_rank: Contributor
timestamp: December 28, 2022, 02:45:44 pm
content: What are some other appropriate measures I can take?

author: ataradov
author_rank: Super Contributor
timestamp: December 28, 2022, 05:52:53 pm
content: Measures for what? Your design is workable. There is nothing you need to add to it. There is a lot of stuff you can remove, but there is no harm in having extra footprints and just not populating the parts.But there is one more thing to consider here that follows from this. It is up to you how you want to approach this part of the design process, but usually in the real world you are limited by physical constraints. The size of this board is clearly not acceptable for a production clock. You can either spend time optimizing/minimizing the design right now and work towards the final board without having a prototype, or you can just order this board as is and work on minimizing it later.For a simple board like this there is no real difference, it is a matter of preference. For complicated designs it usually makes sense to work towards the final form factor as soon as possible.

author: mariush
author_rank: Super Contributor
timestamp: December 28, 2022, 06:57:28 pm
content: There's led driver ICs which can control the segments easier and give you option of programmatically changing the brightness of the segments.For example, IS31FL3236A has 36 channels, enough for your 4 x 8 segments + a couple blink dots :https://www.digikey.com/en/products/detail/lumissil-microsystems/IS31FL3236A-QFLS2-TR/7219610You could use a cheap PIC microcontroller that can work directly with its built in 16 mhz oscillator instead of spending more money on separate oscillator, and you'd only need i2c and spi / parallel to access the clock chip (some pic microcontrollers have that built in)