Please contribute PCB layout pointers

Go To Last Post
51 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi Folks,

I'm working on my first PCB design for etching. I have read a bunch of threads here as well as write-ups elsewhere.

This board will control an LCD display using a 5-way switch (up, down, left, right, and center click).

I've read that one should first run the traces for power and ground. I have done that and would appreciate any pointers on my work. I was considering using the autorouter for the signals.

Thanks!

Attachment(s): 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

To start with I would consider a different component placement. Placing the Mega near your connector gives you short direct traces.

Also I would use 100nF capacitors across Vi to GND and Vo to GND as near as possible on your 7805.

In general keep traces as short as possible, specific traces that contain higher frequencies or fast digital logic.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

get the voltage regulator out of that place with the capacitors. Get the programming header to the other side of the chip.
Try again many times until you find the near best solution.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

You have wrong schematic: no connection for AVCC, AGND and AREF.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Add a pull-up resistor to RESET line, unless you want to deal with random resets all the time... ;)

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Do you know the current draw of the system? The 78L05 may not be sufficient?

I don't know what package you did this in, but your bus is not named and it should be. It doesn't look like your device (S1) is connected correctly?

Why 32kHz? Do you need a RTC?

Don't auto-route such a small design. You can, but such a small design is a great place to learn to route by hand.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Ok, a lot of good comments here, thanks!

I will try moving the ISP and LCD connectors for a different layout.

The current draw of the system should remain under the 100ma that the 78L05 can put out.

Yes, I'm using the 32.768kHz crystal as a RTC. I'm running the system clock on the internal oscillator and using the TOSC pins for the RTC ticks.

S1 is hooked up correctly. It is a 5-way switch that has up, down, left, right, and center click, with a common ground. I don't know why the bus is not labelled. I'm using Eagle CAD and this is my first attempt at using the bus feature. Advice would be appreciated.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

To label a bus on eagle give it a label in the following way:

BUSNAME:wire1,wire2,wire3,...,wirex

The BUSNAME can be any valid Eagle lable name
The wire1...wirex are lables of the signals this bus is containing. Then when You use the bus wiring tool You will get a popup to select a signal.

edit: One more notice. Get Yourself a decent Atmel library from Eagle download site. The one You are using looks like carp.

edit: Just checked - sorry - my ATMEGA8 looks exactly as carp as Yours ;)

edit: COnsider using a 4 bit interface for Your LCD. It might be harder to program but it is definately easier to route on PCB.

edit: Oh sh*... it seems to be a 4 bit interface. Please, put labels on teh wires

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Here's another attempt at it using the advise from earlier in this thread. I routed everything manually. Comments?

I haven't figured out how to label the bus yet. I'll post another schematic when I do.

Attachment(s): 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Never use odd angles on your tracks! only horizontal, vertical and diagonal lines! (making maximum turning angle 45 degrees). It's just a LOT neater.

Flip the 7805 output capacitor 90 degrees.

And then it should be OK. Just as long as your PCB making technique can cope with the track widths and clearances.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Your programming connector looks "wrapped around the axle". Maybe turn it 180 degrees. You've almost got it all on one layer! Good job!

Go electric!
Happy electric car owner / builder

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I doubt that my PCB making method can cope with these tolerances, but I've got to start somewhere so I'm fine with failure.... I'll at least learn something from it.

I see what you mean about "wrapped around the axle" I'll turn that around and should simplify things quite a bit.

Thanks for the comments from both of you.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi All

I have recently recived a PCB with SMD that have been soldered by hand,and i want to to check if two points are connecting togeather. SO i thought best to use a voltmeter and check the resistance between to points, and if they are connecting it will give me some feedback. But i am getting a "-" negtive figure reading, what does this mean?

Regards

DJ

Thanks

Regards

DJ

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

How has this anything to do with this given topic? :D

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Anyway, back on to topic:

I figured out how to use the labels in Eagle and have updated my schematic. I added the pull up resistor to the reset line, did I do it correctly?

I have swapped a few pins going to the LCD connector. This makes the pcb layout easier and can be compensated for easily in the programming. Would it be more appropriate to use a bus for the schematic so the lines aren't such a mess?

All comments and advice is appreciated!

Attachment(s): 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

barney_1 wrote:

The current draw of the system should remain under the 100ma that the 78L05 can put out.

But what is your input voltage. While you may not be drawing more current than the part can put out, you may be generating too much heat for teh part in that package to handle. For example, if your input voltage is 12V and your drawing 100ma, that means your voltage regulator has to dissipate 700mW of power (aka heat). That is quite a bit of heat, for a tiny little component like that.

Writing code is like having sex.... make one little mistake, and you're supporting it for life.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

glitch wrote:
barney_1 wrote:

The current draw of the system should remain under the 100ma that the 78L05 can put out.

But what is your input voltage. While you may not be drawing more current than the part can put out, you may be generating too much heat for teh part in that package to handle. For example, if your input voltage is 12V and your drawing 100ma, that means your voltage regulator has to dissipate 700mW of power (aka heat). That is quite a bit of heat, for a tiny little component like that.

I was planning on using a 9-volt battery as the power source. I just need to have 5v regulated for this system so I'm open to any other options. This was just easiest because of the availability of the batteries and the fact that I already have the 78L05.

What do you think?

Edit: I'm looking at buck regulators right now after reading this thread:
https://www.avrfreaks.net/index.p...

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

certainly a switcher would be more efficient, thus your battery will last longer. The linear is much easier to implement. Nothing wrong with what you have... you just have to make sure that you consider how hot the regulator will get... I would recommend a heatskink when using a linear regulator.

If this is a one-off project, and cost doesn't really matter... PowerTrends (TI) makes a switcher that is a drop-in replacement for 7805 linear (TO-220 package w small heatsink)... it runs about $20 though. (PT78HT205V) Overkill for your project... but very quick/easy to implement.

Writing code is like having sex.... make one little mistake, and you're supporting it for life.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

To tell you the truth, this is just an arbitrary project for me to test the waters of at home PCB etching. That being said, I'm always happy to learn a better way to do things.

I'm looking at the LM2574N-005G right now:
http://www.mouser.com/Search/Pro...

Looks like what I'm looking for. It's a switching regulator with a voltage input range from 7V-40V that costs $1.86. It would be nice if the Vin went a bit lower so it would utilize more of 9V battery but oh well.

What do you think of this device?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

LM2574, Input 4.75v-40v, output 5v, in PDIP-8 package, 1.67$CDN each... ;)

http://search.digikey.com/script...

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

UNiXWHoRe wrote:
LM2574, Input 4.75v-40v, output 5v, in PDIP-8 package, 1.67$CDN each... ;)

http://search.digikey.com/script...

Yep, that's the part that I'm looking at. If you read the datasheet closely you'll see that the 4.75 Vin is only for 3.3V out. For 5V out you must have at least 7V in.

I've sourced the rest of the parts needed (2 caps, 1 inductor, and a diode). I'm revising the pcb layout now.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Here's the newest revision:

Attachment(s): 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Note that at low power draws, switching regulators are not as efficient as they are at high loads. At really light loads, you end up not being *any* more efficient! With 9V in, a 7805 will be 5/9=56% efficient. Given the relatively low difference in voltages and only 100mA, I wouldn't be surprised if the switcher didn't get above 70% efficiency, even with good externals. Increasing your efficiency by just 10% or 15% isn't a terribly large gain, so I'd just use a TO220-package regulator.

Besides that, since it's a 52kHz switcher, your caps and inductors will be significant in size, you could just as well use the TO220 regulator, and use that extra space for more battery, giving you an overall increase in capacity.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

You still neglected to connect AGND and AVcc. Don't do this, you are risking to kill
your ATmega8. At the minimum, your port C will be rendered unusable because that port's
IO stages are powered by AVcc.

Jörg Wunsch

Please don't send me PMs, use email if you want to approach me personally.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Listen to Jörg! - even though it'll be a pain to layout the tracks to connect Gnd->AGnd and Vcc->AVcc.
Unfortunately It's going to muck-up the nice autobahn of tracks running through the mega8 :(

I use the laser printing & ironing method for making PCBs. I use inkjet photo paper. I find that the gap between copper is the critical factor because the fuser tends to spread slightly during the transfer. I like to keep my tracks generally a minimum of .02" apart (a 0.016" track between standard .1" pads works fine). Your layout seems perfectly do-able. It might be worth printing some test patterns with different track widths, gaps and pad sizes for future reference.

I've just started using SMT zero ohm resistors (1206 size) for jumping over tracks. You might find this helps. (now if only I could find a way of getting eagle to understand them properly!)

Nigel Batten
www.batsocks.co.uk

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Well, with a real photo process, you can get much smaller. I don't have
troubles with 200 µm resolution (or even 150 µm) using a laser printer
(printed on transparencies) and standard pre-coated PCB material. The
biggest issue then is that you can't do soldermask coating at home, so
there's always the risk of solder bridges.

Laser printer images don't offer a good contrast though, so the exposure
time is critical. Also, large areas filled with toner tend to be fairly
inhomogenous, so lately I switched to hatched areas instead of just filled
areas. Laser printer toner has a tendency to "flow" towards the edges of
a structure, thus the hatch pattern gets much more contrast than a solid
filled area.

Jörg Wunsch

Please don't send me PMs, use email if you want to approach me personally.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Use a 5V LDO regulator with four AA cells - they will last a lot longer than a 9V battery and you won't need a heatsink.

I get very good results (under 8 mil tracks if necessary) with the photo-etch process using an inkjet printer for the transparencies.

Leon

Leon Heller G1HSM

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

dl8dtl wrote:
You still neglected to connect AGND and AVcc. Don't do this, you are risking to kill
your ATmega8. At the minimum, your port C will be rendered unusable because that port's
IO stages are powered by AVcc.

Hey, there it is plain as day in the datasheet:

Quote:
AVCC is the supply voltage pin for the A/D Converter, Port C (3..0), and ADC (7..6). It should be
externally connected to VCC, even if the ADC is not used. If the ADC is used, it should be con-
nected to VCC through a low-pass filter. Note that Port C (5..4) use digital supply voltage, VCC.

Thanks for pointing that out for me Jörg (sorry you had to say it twice). I completely missed that part of the the datasheet and it would definitely have caused me problems!

I've revised the schematic and the board to reflect this. Surprisingly, after I had routed the +5 signal on the schematic Eagle didn't put an unrouted signal from the AVcc to the +5 rail. It even causes an error when I run this track using the "wire" tool. Anyone else had this problem before?

Attachment(s): 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

You need to use the 'Net' tool, to connect pins, not the 'wire' tool.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

fleemy wrote:
You need to use the 'Net' tool, to connect pins, not the 'wire' tool.

Yes, I did use the net tool to connect the AVcc pin on the schematic. The problem occurred in the board layout as a new "unrouted" signal did not appear between that pin and the +5 rail. In other words, the board was not expecting to need a trace between AVcc and +5.

Any idea why this happened?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

because you have missed the AVR's pin in the schematic :D
look at it very closely (the AVCC pin) and you can see the signal under it. This probably doesn't make connection. Use the view function (eye) to check the connections. pins and nets must be both highlighted.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Barney, if you'd care to post the .sch and .brd file (you'll probably have to zip it) I'd be pleased to have a go at a layout...

Neil

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

as I have a long drive ahead tomorrow I too would like to try my hand on this if you don't mind :D

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

You're right, the AVcc pin was not connected to the net. I deleted and redrew that net at least 5 times thinking that was the problem..... grrr.

Anyway, I'd love to see your take on the board layout. Feel free to change the pinouts if you need to. Just be advised that:
1. I'd like the button leads to be on the same port. Pick any pin for any connection (except GND) as it can be adjusted for in the software.
2. I'd like the LCD connections to be on the same port. This means it has to remain on PORTD since no other port has enough I/O pins for it (PORTB 6-7 need to be the crystal).
3. I'd like to be able to use ISP without disconnecting anything.

Question: I didn't realize this thread would become so involved. Is this something that I should post in the projects and move the thread to the Academy?

Attachment(s): 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Are your vias square for a reason?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

barney_1 wrote:

S1 is hooked up correctly. It is a 5-way switch that has up, down, left, right, and center click, with a common ground. I don't know why the bus is not labelled. I'm using Eagle CAD and this is my first attempt at using the bus feature. Advice would be appreciated.

Sorry about that, I didn't expand the picture, so on my screen it looks like only two pins are connected....opps.

Oc.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

ocnek wrote:
Are your vias square for a reason?

That's how they came out when I switched from Bottom to Top layer while laying the trace. Would it be better if they were round? I'm making these boards at home and I don't have rivets so I plan just solder a jumper wire rather than use a 2-sided board making process.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Round vias are standard, but for a DIY board they should be fine.

I've only done surface mount (single side) DIY boards...the whole process I found is quite fun.

Do you have a high speed carbide bit/dremel to drill the holes? They make life a littler easer then normal as they don't usually tear the copper.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Here's my take, Barney: same board size as yours but I've made a couple of changes:

- added a couple of capacitors for the crystal. I don't know if they're required for your cap, so check the spec sheet. If you decided that 32k isn't a fast enough clock to work with, and want a faster clock, you *will* need them; around 22p each seems pretty bombproof.

- ensured that the ICs are both oriented the same way, as are the polarised caps; this is good practice because not only does it look prettier (er, I mean, more professional) but when you come to build it you won't have any issues about which one goes which way up.

- moved all components to an 0.025 grid, where possible using 0.1 centres. Again, it's tidier, simplifies spacing between lines, and looks more professional.

- I've used a ground plane; if you take it away, you'll need to connect the earths. I prefer to use at least one, and on double sided boards, two ground/power planes.

- the isolation between the plane and the traces is 12 thou - this should be plenty even on a home-brew board (and it will save you etchant, too!). On a board to be made professionally, I'd reduce it even further, to perhaps 10 or even 8 thou - it can find more routes that way.

- sadly, I couldn't get rid of the last link. I think it's impossible because topologically the power and ground have a twist in them.

I'd advise you to have a look at the layout for the switch. It looks as if some of the pads may be slightly misaligned.

Neil

Attachment(s): 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Looks great!

The 32.768KHz crystal is used for the RTC, and do not need any capacitors as far as I know. He's using the internal oscillator as clock source.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Wow, nice work Neil!

I'm not familiar with ground planes, I guess something I need to read up on. What tool do you use in Eagle for that?

The pads on the switch should be correct. The middle tow (pad2 and pad 5) are .45mm off of center. I made this part using the datasheet for the switch which is part number SKQUCA switch.

Regarding C3, that is a filtering cap for the Mega8. Shouldn't it be right next to the Vcc/Gnd pins?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Eagle makes ground planes easy - use 'polygon' to draw it and 'isolate' to define the spacing between the traces and the track, and rename the polygon to 'gnd' or 'vcc' as necessary. Note that the size of the traces that join the plane to the component pins are defined to be the same width as the line you use to draw the polygon.

C3 is only 0.2" away from the power pins... I wouldn't expect that to be a problem.

Neil

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

barnacle wrote:
C3 is only 0.2" away from the power pins... I wouldn't expect that to be a problem.

It is .2" away from AVcc but Vcc is on the other side of the chip, quite a long distance away on the +5 rail. Isn't that the more important of the two voltage pins?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Yeah, I'm used to a double side board where the traces are close to the power rails... I've just had a play and there's no problem either moving the existing C3 to the other side of the AVR, or indeed adding a second C.

The capacitor across the Vcc pin is to prevent noise from the processor switching getting on to the rail; the one across the Avcc is to stop noise getting *in* to the ADCs; which is most important depends to a large extent on your purposes.

Neil

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Ok, getting close to a design I think is worth trying to etch. I have swapped out a few components:

Switched to a 16pin (8x2) header for the LCD. I also added a transistor and resistor to control the backlight (if applicable).

I also switched the temperature sensor to a different IC. This one uses an I2C bus so I moved the switch over to PortB. It shares the MOSI and MISO pins but I don't think this will cause a problem..... any comments on these connections?

The new IC is tssop8 package so I guess I'll give surface mount soldering a try. The part is "flipped" and will be on the underside of the board (where the copper is).

Attachment(s): 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I don't know if I would use the ground plane on a home built PCB (IMO). You've increased the chance of a short to ground on all adjacent traces. It also makes soldering a pain in the but. You will always be on the lookout for solder bridges.

Ground planes are not wrong, but on a small PCB like yours, is not generally required. Maybe some of the home built PCB pros can chime in on this.

The layout is looking good though. :)

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I like ground planes on homebuilt boards, saves on the etchant:) Just have enough clearance for the ground plane and you should be fine.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

groundplane is a good thing. But I would add 330 ohm resistors on the mosi, miso, sck lines so that the programming signals get to the AVR cleanly, but other devices on the SPI bus talk to the AVR through the resistors. I have found there resistors necessary.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Does the backlight need a current limit resistor or is it built into the LCD (assuming pin 15/16 are for the backlight)?

Yes, a ground plane is a good thing, but this is not a ground plane, it's a signal layer. Ground flood is good and normal practice as well, but on such a simplistic design, it's not necessary. Again, a home made PCB could (if the space between trace and pour is not adequate AND the whole transfer / etch procedure doesn't go as planned) cause a lot of errors. But on the other hand, as some have pointed out, could save on etching time... This is just my opinion :)

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Do you mean resistors between the switch and the MOSI/MISO pins so that the path from pins to programmer has less resistance?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

yes. This is needed because the circuit must not interfere with the programming cycle.