EEVblog Electronics Community Forum

Electronics => Beginners => Topic started by: paw on July 18, 2015, 11:01:44 pm

Title: Question: Common beginner's mistakes in PCB design (NOT for manufacturing)
Post by: paw on July 18, 2015, 11:01:44 pm
I'm at the point when I feel human/expert input is necessary for me to improve my ways & understand my mistakes better. I do learn in the process and I find it very rewarding but there is plenty of things I don't even realise I don't know (yet). So I would like to ask for pointers. I'm not expecting too much. On another forum someone suggested I find another hobby after seeing this pcb. But I don't think I will so...

Background:

This is a remote temp/humidity/light (pressure later) sensor board talking to the home server over the NRF24.

The goals are:
- multi month operation from CR2032 or 1xAA. Currently going for CR2032.
- indoor & outdoor (will be shaded and covered from atmospheric conditions)

There are:
- DHT11 for humidity (want to get rid of it as it's extremely slow but have a bunch of these so...)
- TMP302x (in place of DS18B20 which again was extremely slow)
- BPW34 photodiode for light measurement (although it's too sensitive right now will consider photoresistor etc)
- MCP1640 boost converter (I'm very impressed with it) providing 3.3V supply
- Atmega328p @ 8MHz external

Question:

I'm attaching one of my very first boards (this particular version has just been updated and has not materialised/been tested yet although couple versions of it were tested in the field).

Given that this is (will remain for now) a single sided PCB (home made) what are the:

1. Primary and unforgivable (you'd be lucky if it even worked) kind of mistakes I made?
2. What are the main improvements? The responsible things like decoupling, avoiding ground loops/single current return paths etc.
3. The switching frequency of the boost converter is 550kHz should I worry?

Ideally I wouldn't like to focus on my goals as I believe them to be sane.

Again I would be very grateful for any comments & suggestions.

Kind regards!

P.S. I'm not building a product. I'm learning electronics 101!


Edit:
Not to confuse anyone the two peripheral ICs are indeed powered from the micro as they draw couple of mA only.
Title: Re: Question: Common beginner's mistakes in PCB design (NOT for manufacturing)
Post by: Ian.M on July 18, 2015, 11:14:38 pm
On single sided boards with MCUs or other fast logic, wire links are vastly preferable to 'spagetti' power or ground tracks.

Home made PCBs etched with anything except air regenerated cupric chloride cost you more, the more copper you remove by wearing out your etchant.  Leave as much as possible of the board filled with copper connected to the ground track, save money and improve signal integrity.
Title: Re: Question: Common beginner's mistakes in PCB design (NOT for manufacturing)
Post by: tggzzz on July 18, 2015, 11:21:49 pm
Schematic / circuit diagram?

It should be easy to make a photodiode circuit less sensitive.

You mention mA, months and CR2032. You might like to check they are all compatible, and to very seriously power down most the circuit for most of the time.
Title: Re: Question: Common beginner's mistakes in PCB design (NOT for manufacturing)
Post by: tautech on July 18, 2015, 11:23:56 pm
Welcome to the forum.

Clearances.
Layout of components for achievable soldering/rework. Think of order of population, always passives first when hand soldering.
330R, rotate 90 and move away from IC, that sort of stuff.  ;)
Power traces should be wider.
Label GND and VCC.

Print it on paper for physical checks.
Be prepared to spend real time on it, days even, you'll learn lots.  :-+

Search for more ideas and advice in these boards:
https://www.eevblog.com/forum/projects/ (https://www.eevblog.com/forum/projects/)
https://www.eevblog.com/forum/eda/ (https://www.eevblog.com/forum/eda/)


Title: Re: Question: Common beginner's mistakes in PCB design (NOT for manufacturing)
Post by: picandmix on July 18, 2015, 11:24:09 pm
Rather than the bulky DHT sensor  plus the TMP have you considered the Sensirion combined temp and hum sensors SHT11/15   and SHT71/75 which have a much lower current, greater accuracy and small footprint ?
Title: Re: Question: Common beginner's mistakes in PCB design (NOT for manufacturing)
Post by: con-f-use on July 18, 2015, 11:37:53 pm
What Ian said plus:

- Make power tracks bigger and tracks that run between pads smaller (nothing worse, than sorting tracks under an IC during soldering - you'll never find the error)
- Decoupling is very important with spaghetti layouts, seems you've got that down
- Try for your labels not to be in the way, and have a common direction with labels
- Don't have 90 degree T-junctions (e.g. in the lower right corner), better:
(http://www.electro-tech-online.com/attachments/t-junction-gif.44455/)
Title: Re: Question: Common beginner's mistakes in PCB design (NOT for manufacturing)
Post by: Andy Watson on July 19, 2015, 12:01:57 am
Don't assume it's going to work! Make provision for test points that you can easily probe - especially when using surface mount components. And include a ground connection point where you can easily attach the ground lead (crocodile clip) of your measuring equipment.
Title: Re: Question: Common beginner's mistakes in PCB design (NOT for manufacturing)
Post by: chickenHeadKnob on July 19, 2015, 12:12:14 am
I am not a person to give advice as I am not I an experienced PCB designer, however this is the internets so I can pretend,  ;D

Some macro scale considerations, mounting holes!. Beginners always forget this! why!
Put connectors  all on one board edge or on two opposite edges (flow through design) depending on circuit. not hodge-podge random distribution.
check clearance  on the atmega pads, might want to increase it.
Title: Re: Question: Common beginner's mistakes in PCB design (NOT for manufacturing)
Post by: zapta on July 19, 2015, 12:50:37 am
Print the net list and verify it carefully pad by pad. Mark on the schematic the nets you covered, look for missing or extra connections.
Title: Re: Question: Common beginner's mistakes in PCB design (NOT for manufacturing)
Post by: Ian.M on July 19, 2015, 01:08:46 am
+1 for mounting holes.

Arranging connectors nicely may make the spagetti layout problem much worse on single sided boards. Sometimes you have to compromise.

There is an intermediate step for DIY boards between single sided and full double sided.   Its single sided layout + continuous ground plane on the top side.   Spray one side of a double sided PCB blank with lacquer to protect it against the etchant, process the other side normally, then after drilling the board, use a Vero spot face cutter or similar to relieve the ground plane copper round any holes that don't need a ground connection.  Solder ground pins both sides or solder a cutoff of wire through the board if you need a via to ground for a SMD part.   It avoids all the alignment issues of a DIY conventional double sided board while permitting a ground plane adequate for VHF signals and fast MCUs. Obviously it is preferable to use mostly SMD parts so you don't have to relieve the ground plane on too many signal holes.  The only major disadvantage is you cant use bare wire jumpers.
Title: Re: Question: Common beginner's mistakes in PCB design (NOT for manufacturing)
Post by: paw on July 19, 2015, 01:24:02 am
Thank you all very much.

tggzzz:
Currently this runs at 8sec sleep (6uA) and 2sec full blast (8mA). Which gives about 4:1. It is going to run at 15 min (900000ms) sleep and 100ms awake which gives 9000:1 ratio. If it only improves by a factor of 100 I will be happy with the battery life. Most of the things drawing power are already powered by the micro (and only for minimum time required for readout). Worst case scenario I'll move to single AA.

tautech: Thank you!

picandmix: I've seen some of these and more but it seems humidity is always expensive or slow. In case of Sensirion it's the former at up to 2x the cost of all the other components combined.

con-f-use: Is this because they cause reflections? That T junction you showed. If it's the right way then why. Just a keyword please I'll look it up and read up.

Andy Watson: Thank you.

chickenHeadKnob: Those pesky beginners! I genuinely did forget the mounting holes which I do need. Connections are where my limited brain can route them to. I definitely appreciate the reasoning for them being placed together and possibly forming standard connectors too. I wondered about the pad sizes as they seem bigger than the pins and could be smaller and even though I haven't had bridges even without solder mask I'll see if I could reduce their size. I'm going to challenge myself with a batch of qfn atmegas (in the post) though before I go and do tqfp device from scratch in Eagle (only did sot23-6 so far and really looking forward to possibly doing atmega :) ).

Ian.M: Just what I thought. If not for the NRF24 (8pin) header I would have just gotten rid of all TH parts and did that. But since I actually am only now left with very few (actually less than on the design I posted) I will try your suggestion. The one downside is that I don't have double-sided presensitised boards. I do have double sided copper clad boards and Positiv 20 spray but I found that using presensitised boards cuts down the time (no drying) and increases the yield no redo due to specs of dust etc. I may get some double-sided presensitised boards though and move to double sided permanently. I would do that before ordering first board form the fab at some point anyway so perhaps now is the time. The wires running on my PCB gives me shivers (just as some of my silly mistakes make give some of you shivers).

Thank you all for a warm welcome and honest suggestions.
Title: Re: Question: Common beginner's mistakes in PCB design (NOT for manufacturing)
Post by: c4757p on July 19, 2015, 01:49:34 am
con-f-use: Is this because they cause reflections? That T junction you showed. If it's the right way then why. Just a keyword please I'll look it up and read up.

That chamfered T might have better high frequency properties, but when I say "high" frequency I mean high. The usual reason it's done is that it supposedly increases manufacturing yield (keyword: "acid trap"), but this does not appear to be a major concern except at very high production quantities where that tiny fraction of a percent yield becomes tangible... I have yet to do this on a PCB, and I have yet to have a problem from not doing it.
Title: Re: Question: Common beginner's mistakes in PCB design (NOT for manufacturing)
Post by: kc3ase on July 19, 2015, 01:52:12 am
Okay now I have access!  :-DD
I see some things in what I think is your EAGLE design. And I'll post them next.
Title: Re: Question: Common beginner's mistakes in PCB design (NOT for manufacturing)
Post by: kc3ase on July 19, 2015, 02:08:28 am
1) When your PCB is done measure your current to get you battery drain current. You can calculate this with some of Dave's other videos or ask how to get mAh.
2) The forth (what I think is a cap) on the bottom doesn't appear connected to anything on the left side. Use EAGLE's DRC and ERC they work very well.
3) The ATMEGA8 pad layout doesn't appear to be correct to me. The separation between pins in your image for the bypass cap on the left side appears blended and shorted.
4) The multiple traces from the battery negative should be a big pour in the PCB. Use a poly in EAGLE to connect this.
5) Even if you aren't doing a silk screen don't let the images overlap.
6) You have two different pad types on the anode and cathode of a diode.
7) The 100 uF main bypass is probably overkill.
8) I'm not sure why there is a pad and through hole just above the main IC.
9) The silkscreen should always contain the part numbers, R1, C1, etc. Even if you won't use a silkscreen. This is also necessary for design reviews and just to get in practice for it later. And then use the EAGLE renumber board feature to set the numbers after laying out the board on the X - Y axis.
10) The copper circle under the ATMEGA8 seems unnecessary.

Recommendations:
1) Use a two layer PCB. Even if done at home. Positive resist PCBs are cheap to buy and the small fish tank plastic etching kits with Sodium etchant work really well. I have used Ever-Muse boards I'm not sure if they are still made under this name. It's easy to line up the photo images even double sided and there are probably tons of videos.



Title: Re: Question: Common beginner's mistakes in PCB design (NOT for manufacturing)
Post by: T3sl4co1l on July 19, 2015, 04:54:02 am
Pour ground around everything, and stitch it as much as possible.  Especially if you're doing single sided.  Use jumpers liberally!

Tim
Title: Re: Question: Common beginner's mistakes in PCB design (NOT for manufacturing)
Post by: con-f-use on July 19, 2015, 08:50:57 am
con-f-use: Is this because they cause reflections? That T junction you showed. If it's the right way then why. Just a keyword please I'll look it up and read up.

It's just icing on the cake not 100% necessary. The keywords here are under etching and corrosion. It's the same reason you shouldn'd have 90 deg turns but rather 45 (as you do). The 90 deg angles are the first to go when your copper corrodes and the first do be etched away if your etchant is too warm, too strong or you leave the board in it too long. Also it looks nicer ;-)

There is an intermediate step for DIY boards between single sided and full double sided.   Its single sided layout + continuous ground plane on the other side.
I was going to suggest that, then I forgot. It's really easy too do and makes a lot of the spaghetti traces go away. If you have through hole stuff with this kind of "ghetto ground plane" and are worried about one leg making contact with the ground plane, get a track cutter (http://www.rapidonline.com/tools-equipment/stripboard-cutter-34-0600). They go for two or three dollar on ebay. You drill holes as usual, flip the board to the ground plane side and use the track cutter to remove a bit of copper around the holes that you are worried about.
Title: Re: Question: Common beginner's mistakes in PCB design (NOT for manufacturing)
Post by: Dago on July 19, 2015, 08:51:39 am
With a quick calculation assuming a 200 mAh CR2032 (assuminging you can drain it fully, which is most likely not quite true), 100 ms wake time and a draw of 8 mA 96 times a day (every 15 minutes) the battery will last slightly over 390 days. So accounting for other factors like sleep mode consumption and not perfect efficiency I'd assume a single CR2032 will last 6-8 months or so.

Remember to have a capacitor in parallel with the CR2032, they tend to have very high impedance and can only supply maybe tens of milliamps before the voltage really goes down.
Title: Re: Question: Common beginner's mistakes in PCB design (NOT for manufacturing)
Post by: con-f-use on July 19, 2015, 09:04:51 am
7) The 100 uF main bypass is probably overkill.
9) The silkscreen should always contain the part numbers, R1, C1, etc. Even if you won't use a silkscreen. This is also necessary for design reviews and just to get in practice for it later. And then use the EAGLE renumber board feature to set the numbers after laying out the board on the X - Y axis.
10) The copper circle under the ATMEGA8 seems unnecessary.

10 or even 1uF should be sufficient in most desings. Any more will cause too much inrush, which can be a problem especially with home-made USB devices. But since this  using a coin cell for power with has a large internal resistance, 100uF might not be that bad. However remember, that larger valued capacitors as a rule of thumb have higher leakage currents. And good silk screen with component names and values helps you when populating your board, even if you don't but it on the final board. Especially when you revisit a design in a year and have no idea about the layout anymore. The copper circle is for knowing the orientation.
Title: Re: Question: Common beginner's mistakes in PCB design (NOT for manufacturing)
Post by: paw on July 19, 2015, 11:06:57 am
Since the 100uF draws attention let me explain. This is a decoupling cap for the nRF24l01+. That board basically does not work properly until 100uF is placed there. I am talking about the whole market of these boards not my particular batch.

kc3ase:
1. Sure, the numbers I provided come from this but yes there of course is more i.e. boost's draw etc.
2. It only appears so. I do use DRC and ERC. It is connected if you follow the path the on the other side of the micro.
3. I'm not certain what to say. I don't see that.
4. Changing my single sided ways so this won't be a problem much more
5. Will work on my silkscreen
6. I guess this is how you indicate cathode/anode. It's not my component but I thought it was ok. So it's not and should be done in silk screen?
7. 100uF is a necessary bypass for the radio.
8. I think you may be referring to a single pin header connected to the reset pin pulled hight by a 10k.
9. Will work on my silkscreen
10. Poor man's silk screen thingy as con-f-use correctly inferred.
Title: Re: Question: Common beginner's mistakes in PCB design (NOT for manufacturing)
Post by: AndyC_772 on July 19, 2015, 12:45:05 pm
You've routed your GND net as a trace instead of using a solid plane. To a good first approximation, this is *always* a mistake.

Please, save yourself a whole world of grief, and use a double sided PCB, with GND on the back and components on the top. Debugging boards which don't work because of poor grounding is a slow, painful exercise. It's very hard to diagnose grounding problems unless you have the proper equipment and a great deal of experience, and in any case, they're also hard to fix with any kind of retro-fitted kludges. It's not even a good learning exercise to try.

Whenever I route a PCB, the rule-of-thumb I follow is that if a power or ground trace is longer than the component pad to which it connects, then it's worth trying to shorten it.

There's quite a good discussion on power supply noise, planes, decoupling and vias here (https://www.eevblog.com/forum/beginners/how-much-noise-on-power-rail-is-normal/).
Title: Re: Question: Common beginner's mistakes in PCB design (NOT for manufacturing)
Post by: kc3ase on July 20, 2015, 04:59:21 pm
2) The forth (what I think is a cap) on the bottom doesn't appear connected to anything on the left side. Use EAGLE's DRC and ERC they work very well.
ANS: 2. It only appears so. I do use DRC and ERC. It is connected if you follow the path the on the other side of the micro.

I looked again, I  don't see it connected to anything.


3) The ATMEGA8 pad layout doesn't appear to be correct to me. The separation between pins in your image for the bypass cap on the left side appears blended and shorted.
ANS: 3. I'm not certain what to say. I don't see that.

The distance between your pins on the Y axis appears incorrect. The gaps between the top pins are different as they go down the rows. The capacitor connected on the left side seems shorted across because of the pin connections under the main chip.

4) The multiple traces from the battery negative should be a big pour in the PCB. Use a poly in EAGLE to connect this.
ANS: 4. Changing my single sided ways so this won't be a problem much more

5) Even if you aren't doing a silk screen don't let the images overlap.
ANS: 5. Will work on my silkscreen

6) You have two different pad types on the anode and cathode of a diode.
ANS: 6. I guess this is how you indicate cathode/anode. It's not my component but I thought it was ok. So it's not and should be done in silk screen?

7) The 100 uF main bypass is probably overkill.
ANS: 7. 100uF is a necessary bypass for the radio.

8) I'm not sure why there is a pad and through hole just above the main IC.
ANS: 8. I think you may be referring to a single pin header connected to the reset pin pulled hight by a 10k.

9) The silkscreen should always contain the part numbers, R1, C1, etc. Even if you won't use a silkscreen. This is also necessary for design reviews and just to get in practice for it later. And then use the EAGLE renumber board feature to set the numbers after laying out the board on the X - Y axis.
ANS: 9. Will work on my silkscreen

10) The copper circle under the ATMEGA8 seems unnecessary.
ANS: 10. Poor man's silk screen thingy as con-f-use correctly inferred.


In the future please try to quote back responses with your answers like I have shown. It makes it easier for people reading this to always have the result response on the current posting.
Title: Re: Question: Common beginner's mistakes in PCB design (NOT for manufacturing)
Post by: codeboy2k on July 20, 2015, 08:21:14 pm
When routing power, I like to lay down sections (or individual IC's) segmented by 0-ohm resistors.  That way If I have any problems with the board, i.e. (excessive current draw or unknown source of noise) I can simply de-solder a 0-ohm resistor and power off a complete section (or individual IC) for analysis.

The 0-ohm pad also makes a good place to measure current going into that section (or IC)

If you get a chance to re-spin the board then you can remove these once you're satisfied they are not needed anymore, or you can just leave them in, as they don't cost much anyways. Whether or not to do that depends on how cost-sensitive you are.

Title: Re: Question: Common beginner's mistakes in PCB design (NOT for manufacturing)
Post by: McBryce on July 20, 2015, 08:51:58 pm
The ATMega Footprint looks like it was made for some sort of high power QFP chip, something with double pins and a disipation surface on the bottom. The hole under the IC was probably a via to take the heat to the other side. The left and right centre pins definitely look shorted.

@kc3ase: Can you upload a picture highlighting the cap you say isn't connected? I've been staring at the picture too long and I can't see it.

McBryce.
Title: Re: Question: Common beginner's mistakes in PCB design (NOT for manufacturing)
Post by: paw on July 20, 2015, 08:58:52 pm
2) The forth (what I think is a cap) on the bottom doesn't appear connected to anything on the left side. Use EAGLE's DRC and ERC they work very well.
ANS: 2. It only appears so. I do use DRC and ERC. It is connected if you follow the path the on the other side of the micro.

I looked again, I  don't see it connected to anything.


3) The ATMEGA8 pad layout doesn't appear to be correct to me. The separation between pins in your image for the bypass cap on the left side appears blended and shorted.
ANS: 3. I'm not certain what to say. I don't see that.

The distance between your pins on the Y axis appears incorrect. The gaps between the top pins are different as they go down the rows. The capacitor connected on the left side seems shorted across because of the pin connections under the main chip.

4) The multiple traces from the battery negative should be a big pour in the PCB. Use a poly in EAGLE to connect this.
ANS: 4. Changing my single sided ways so this won't be a problem much more

5) Even if you aren't doing a silk screen don't let the images overlap.
ANS: 5. Will work on my silkscreen

6) You have two different pad types on the anode and cathode of a diode.
ANS: 6. I guess this is how you indicate cathode/anode. It's not my component but I thought it was ok. So it's not and should be done in silk screen?

7) The 100 uF main bypass is probably overkill.
ANS: 7. 100uF is a necessary bypass for the radio.

8) I'm not sure why there is a pad and through hole just above the main IC.
ANS: 8. I think you may be referring to a single pin header connected to the reset pin pulled hight by a 10k.

9) The silkscreen should always contain the part numbers, R1, C1, etc. Even if you won't use a silkscreen. This is also necessary for design reviews and just to get in practice for it later. And then use the EAGLE renumber board feature to set the numbers after laying out the board on the X - Y axis.
ANS: 9. Will work on my silkscreen

10) The copper circle under the ATMEGA8 seems unnecessary.
ANS: 10. Poor man's silk screen thingy as con-f-use correctly inferred.


In the future please try to quote back responses with your answers like I have shown. It makes it easier for people reading this to always have the result response on the current posting.

I'm sorry I don't know what you mean about the distance of the pads. Not sure what to say.

Which cap do you think is shorted? C2? C6? None of them is. I'm confused. Sorry. Please explain if you still think something is shorted.
Title: Re: Question: Common beginner's mistakes in PCB design (NOT for manufacturing)
Post by: McBryce on July 20, 2015, 09:02:43 pm
Ok, now the ATMega pads look fine. The pictures in your original post have possibly been over compressed. Take a look at the screenshots, the pads join there.

McBryce.
Title: Re: Question: Common beginner's mistakes in PCB design (NOT for manufacturing)
Post by: paw on July 21, 2015, 07:17:16 am
Oh I see it now. Yes this is an artefact of image resizing. My fault I didn't notice. It is not there :) sorry
Title: Re: Question: Common beginner's mistakes in PCB design (NOT for manufacturing)
Post by: KJDS on July 21, 2015, 07:49:05 am
The most common layout mistakes I've seen is trusting a library footprint, followed closely by poor grounding and decoupling.
Title: Re: Question: Common beginner's mistakes in PCB design (NOT for manufacturing)
Post by: kc3ase on July 21, 2015, 03:25:22 pm
I have circled the suspected area in yellow. Is this a cap? Is an antenna supposed to go here? Trace doesn't appear connected. Oh, maybe this is supposed to be a header but it's not marked with an X as a connector?

Also under the orange circle R6 I generally try not to put traces. Flux and solder can bleed under and ruin your day. Especially if you are doing it by hand.
Title: Re: Question: Common beginner's mistakes in PCB design (NOT for manufacturing)
Post by: poorchava on July 21, 2015, 07:46:03 pm
If you don't wanna etch a double sided board, just use a double sided laminate and use the other side as solid ground plane. Wherever you need GND in the circuit just drill to the other side.

Btw, Elecrow, ITEAD, Seeed and such will make 10pcs of 50mm x 50mm boards with nice DRC rules and 100% electrical test or $9.9 + ~$4 shipping to Poland :). The only downside is 2-3 weeks of waiting (unless you wanna fork out $30 for DHL, in which case you'll get your boards in 10days from order maximum)

Title: Re: Question: Common beginner's mistakes in PCB design (NOT for manufacturing)
Post by: con-f-use on July 21, 2015, 09:01:29 pm
Also under the orange circle R6 I generally try not to put traces.
Nah, it's fine for an 0805. People do it all the time and never have problems. It's really unavoidable for single sided board.
Title: Re: Question: Common beginner's mistakes in PCB design (NOT for manufacturing)
Post by: tautech on July 21, 2015, 09:11:02 pm
Also under the orange circle R6 I generally try not to put traces.
Nah, it's fine for an 0805. People do it all the time and never have problems. It's really unavoidable for single sided board.
+1
Clearances can get tight, but you have the option to edit pad sizes to create additional space for traces under components.