1
\$\begingroup\$

Just designed my first "real" PCB that I plan to send out for manufacture in the next day or so. I've milled out a few on a 3018 CNC. I wanted to do this one that way as well, but realized it would have been a bear to make DIY and mostly THT wasn't the direction to go. So, this is my first mostly SMD PCB with standalone ATMEGA328P-PU on a PCB at least. I used Diptrace initially, but then switched over to EasyEDA since I plan to send it to JLCPCB for the best cost and all their components from LCSC have the included the PCB footprint. (Side note: I wasn't looking forward to switching at first, but the component selection with included pattern was a real treat with EasyEDA compared to Diptrace).

Purpose:

This should actuate servos to control water flow to "zones" based on the feedback from the sensors of soil wetness.

I am a complete novice to this, but I think that the design is close. I learn by doing and iterations, so here goes. I figured you guys love this stuff and it is second nature to you, so I am all ears for any general feedback, criticism, and design improvements in general that I will take to my future PCB design endeavors and use this one.

The PCB Layout:

the components on the right will be exposed from the enclosure for user feedback, and the JST XH connectors are for the sensors. There is a DC 5.5 x 2.1 plug for a 12V 1A DC adaptor in top left. Key 1 is a "test" button that I plan to use to prime this thing. SW1 is the power switch. The U components connect to sensors for feedback that will be evaluated in the code. The H headers are connected to servos that respond in accordance with the settings provided by R1, R2, R3. H4 is ICSP header for programming. P1 is the motor. I increased the mil trace to 15 mils for the power and ground lines. U2 is the 5V regulator.

Edits: Added ground plane, moved decoupling capacitors for the MCU closer to their point-to-point, added some decoupling capacitors to the adapter feed. Increased trace widths to 24 mils (same as via diameter). Removed interior mounting holes that were too close (shouldn't be needed).

enter image description here

Specific Questions / Schematics:

enter image description here

Mid Schematic

Osc / MCU / ICSP

Test / Reset Pullup

  1. Is 4 and 5 for SW1 like chassis grounds / PCB grounds? I can just leave them unconnected right?
  2. Do you see U2 having any issues with regulating the 12V 1A supply for the 5V Reg that is provided downstream to all the other applicable components? In breadboard testing, amperage never really exceeded 500mA, but since the supply could provided 1A, I chose a "larger" package regulator. MC7805BDTRKG - Datasheet
  3. Oscillation, Stabilization, and ICSP look correct?
  4. The test button will pull PD7 (Test Net Port) to ground when depressed right and 3, 1 can remain unconnected?

Thanks in advance!

THT Layout: enter image description here

\$\endgroup\$
6
  • 1
    \$\begingroup\$ Your decoupling capacitors are supposed to be close to the power pins of the respective chip they're decoupling, connected with short traces, making the loop as small as possible. Use a ground plane on the bottom to help with this. Some bulk decoupling at the power connector to compensate for the long adapter lead is probably a good idea. Use wider traces or polygons where possible such as on the power traces, you're paying for the copper anyway, use it. \$\endgroup\$ Oct 21, 2020 at 17:38
  • \$\begingroup\$ @Unimportant Duly noted on the decoupling capacitors being nearer to the point of the MCU. I'll redesign to make them even shorter and I'll have to research how to create/use a ground plane in EasyEDA to incorporate. You think a 22uF ceramic cap should be good to put after the adapter, before the regulator and motor? \$\endgroup\$ Oct 21, 2020 at 18:00
  • \$\begingroup\$ Depends on how much (startup) current that motor draws. But bulk decoupling is for low frequencies and can thus be electrolytic, allowing far greater capacitance if required. \$\endgroup\$ Oct 21, 2020 at 18:06
  • \$\begingroup\$ Makes sense. Thanks. \$\endgroup\$ Oct 21, 2020 at 18:10
  • \$\begingroup\$ Generally broad design review questions aren't a good fit here. It might be a good idea to spend more time looking at typical production boards to show how yours differs with regards to the mentioned bypass caps, planes... also those internal mounting holes(?) seem problematically close to components. There's really no need for such small traces as you are using... sure, a decent fab can do it, but why? \$\endgroup\$ Oct 21, 2020 at 18:50

2 Answers 2

1
\$\begingroup\$

enter image description here

#1-#8 beware of the autorouter routing traces really close to pads or at awkward angles, if the pcb fab is cheap and the soldermask is a little off, the track that is close to the pad could be uncovered and you get solder bridges. It costs nothing to space your SMDs (#5) a bit more, or push some traces around.

#8 without heat sinking, this 7805 won't be able to dissipate the power you intend. If the 1A load is frequent, I'd use a switching converter for efficiency and convenience of not having to bother with a heat sink. In fact it would probably be much simpler to power the whole thing with a 5V wall wart.

#9 The vertical barrel connector could make plugging connector #10 awkward.

If the three headers on the right go to analog inputs, then they need at least some filter caps. Possibly ESD protection.

When putting mounting holes, use pads instead of holes and make the pad a little bit larger than the size of the head of the screw you'll put in. That way you'll easily see if the screw head collides with something. If you use plastic standoffs that only take space on bottom layer, still a good idea to define a keepout zone to prevent a SMD from ending up in the wrong place.

I don't see any caps on the xtal.

GND routing uses the same thin traces for pots (presumably analog) and servos, could add noise to analog signal.

Image resolution is too low and bottom layer is not readable.

Placement of decoupling caps is no good, again beware of autorouter, it will route GND and VCC all over the place and say "done!" and then you get long inductive traces and therefore problems. The purpose of a decoupling cap is to reduce supply impedance at HF, and long inductive traces do the opposite. If you have a ground plane on the back, connect your decoupling caps to it with vias.

An extra 10 ground vias would remove lots of traces from toplayer, maying routing easier.

...and don't be afraid to put an electrolytic cap like 100µF on the power input... it costs 10 cents...

\$\endgroup\$
9
  • \$\begingroup\$ Thank you. 10-4 on #1 and #8. I increased the auto router clearance to 10mils and on the rerun it doesn't even run by that pad anymore, the traces now have larger gaps in between all the pads and traces. #8, the voltage needed by the pump is 12V, that's why I did the regulator. It's being switched by the NPN. It's not frequent, but you're suggesting running a 5V wall DC adapter with a buck converter? I like that idea. I'll evaluate with costs, but i wasn't sure if that SMD 7805 would be an issue. Love the tip on pads/holes. Reworking that as well. \$\endgroup\$ Oct 22, 2020 at 1:09
  • \$\begingroup\$ The XTAL has a built in cap, it's a "resonator". I understood them not to be needed with this type? Help me out with your recommendation with the GND routing, doesn't the copper pour help that? I can just increase the specific size of those traces (say double)? Is that what you're suggesting? I understand what you're saying on the ground plane, let me see how to modify that beyond the auto-router, thank you. \$\endgroup\$ Oct 22, 2020 at 1:12
  • \$\begingroup\$ Well if the pump runs on 12V then you need the 12V supply. How much current does it use? Will the BC817 be enough? If you don't want to put a heatsink on 7805 you can replace it with a canned dc-dc module \$\endgroup\$
    – bobflux
    Oct 22, 2020 at 8:11
  • \$\begingroup\$ It uses around 400mA at start up, and 250mA continuous operation. Goes up to around 500mA when a servo is engaged with running operation. Thanks for the tip on the switching regulator, I'll look into those. I think you're right, the BC817 may be undersized, the max collector current is 500mA. I'll look at a larger one of those as well, thank you. \$\endgroup\$ Oct 22, 2020 at 13:44
  • 1
    \$\begingroup\$ I've smelled more magic smoke than you can imagine .... it's how I've been imbued with new electrical design knowledge because of it :). I've got a tiny heat sink on there now. As mentioned above, I moved away from SMD. I'm sure something I'll want to do will necessitate it in the future, but right now it seems like more of a hassle / more expensive for the DIY guy. Correction: 2.4W ... meant watts. \$\endgroup\$ Oct 24, 2020 at 14:07
0
\$\begingroup\$
  1. Your traces are running much too close to pads or other traces in many instances. Almost touching. It's not going to work. You must leave at least 8 mil for clearance between traces and other copper elements. Generally use the same width for the traces and for the clearance between them.
  2. I'm afraid you vias are not 24 mils on the picture. They look much smaller. It's good to have vias 20 mils or more even thought smaller via size are allowed. Mostly because it's cheaper and more universal.
  3. Remove useless zigzags. See bottom of the picture.
  4. Trace must be designed symetrically from every side of SMD components or from both side for two pins SMD components, else the component will rotate during soldering. Think of traces as force vectors pulling the component to their side. These force vectors must oppose each other equally. For example C5 will rotate counter clock wise.
  5. Use only one drilling hole diameter for THT component (the largest) to simplify production and cost. Same with vias and mounting holes.

About U2: It should be chosen according to the circuit consumption in amperes, not the current the source can provide. This type of regulator also feature an excess current protection and other good things. It's a good idea to chose a regulator more powerful than you need. But it's even better to draw some copper areas acting like a heatsink to dissipate heat. See an example of such copper area heatsing on page 22 of the datasheet. Note that it can be larger and take any shape.

\$\endgroup\$
13
  • \$\begingroup\$ #1, yeah, reworked that, 10 mil clearance now. #2 it says via diameter is 24 mils and via drill diameter is 12? #3 Got it. #4, never would have considered. Thank you. #5 Makes sense, on my CNC I just have it mill the holes, but official PCB production would be different. Make sense. I will look for understanding, Bob suggested the buck converter which may be a good option as well. \$\endgroup\$ Oct 22, 2020 at 1:18
  • \$\begingroup\$ You will save money by using drill hole diameter at least 20 mil (0.5mm). But you can ask advice from PCB assembly producer. What routing bit are you using on your CNC machine?. \$\endgroup\$
    – Fredled
    Oct 22, 2020 at 22:24
  • \$\begingroup\$ The MC7805 will be enough if current consumption is on the order of 100 or 200 mA permanently and a few spikes to 500mA or more for a few seconds (not minutes) here and there. If it uses 500mA for long durations or risks to, it's safer to use a step down converter and you will save energy. About 2 or 3 Watts. \$\endgroup\$
    – Fredled
    Oct 22, 2020 at 22:33
  • 1
    \$\begingroup\$ Also, I'm not an electrical guy per se, but the 3018 CNC is a worthwhile investment and I would recommend it to anyone that makes electronics, even if for prototyping before getting PCBs made with a real manufacturer. In one 70 x 100mm board, I can cut 6 boards for a product I make and sell. It it replaces like 7 components in a smaller form factor, costs less by about half, and reduces assembly time by 2/3rd the time. Worth it. BTW, the .78mm bit plunges into the PCB no problem. Not sure if your concern was actually electrically related or mechanical concerns. \$\endgroup\$ Oct 24, 2020 at 13:45
  • 1
    \$\begingroup\$ Awesome, well good luck! \$\endgroup\$ Oct 25, 2020 at 18:36

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.