My first pcb

Hello,

I've managed to design my very first pcb. It's a sensor board, with room for an atmega328 and 3 analog inputs, as well as a status LED and a 2x4 pin-header where is meant to go a nordic transceiver breakout module.

I was hoping some of you more experienced fellas would help me out and take a quick look at it, and point it out if you immediately spot any obvious mistakes. I've doubled-checked connections and it looks ok in a gerber-viewer as well.

The power goes in and runs to a 5v voltage regulator, and I put a capacitor to smooth ripples. Also there's a resistor to avoid resets. The 2x4 pin header is placed as it is because the transceiver breakout module will 'overlap' the board, so I put it to one side. The voltage regulator will thus be 'sandwiched' between board and transceiver hanging above it - a potential heat problem? I'd like to power the board with a 9v battery.

Appreciate your input - thanks a lot in advance.

/Morten

You need to post the schematic.

I'm not familiar with the program you're using here, but if possible you want to fill the board with a ground plane to take heat away from the regulator. At worst you can do it manually by just adding a lot of extra, thick traces. Also, that regulator needs capacitors (typically electrolytic) on its power in and power out lines; if you don't include them your power will be fruity. You can always leave the spaces unpopulated if you find that you don't require them -- but can't add a capacitor if you find out you need them and don't have a space available!

Most regulators should have caps on input and output, refer to the datasheet for specific recommendations. On the ATmega, pin 7 (Vcc) should connect to pin 20 (AVcc). The ATmega also needs at least one bypass cap (100nF) near one of the power pins, and another from AREF to ground.

A schematic would be helpful, though.

Hello Chagrin,

very helpful indeed,

Chagrin:
You need to post the schematic.

I'm posting a schematic here. The program I'm using - Fritzing - leaves a little bit to be desired in schematic view, in as much as one cannot decide the wire-colors and thickness in the schematic view (they appear as solid blacks when they're routed, but I like to leave the routing for the pcb view - the schematic-view will chance to reflect the routing I create there)

Chagrin:
I'm not familiar with the program you're using here, but if possible you want to fill the board with a ground plane to take heat away from the regulator. At worst you can do it manually by just adding a lot of extra, thick traces. Also, that regulator needs capacitors (typically electrolytic) on its power in and power out lines; if you don't include them your power will be fruity. You can always leave the spaces unpopulated if you find that you don't require them -- but can't add a capacitor if you find out you need them and don't have a space available!

I'd rather go safer than sorry and will certainly on your say add the capacitors and the board fill (the Fritzing software has an option for this, so very thankful for your pointing it out, had not thought of that).

Hello Jack,

thanks a bunch,

sorry if this is a stupid newbie question, in which case I can only hope it'll help some other hapless soul, when you say Vcc and AVcc should connect, is that then saying that these pins require a direct connection even though they're fed the same 5v from the regulator? Thanks in advance for clarifying this for me.

In terms of decoupling (bypass) capacitors, would it in your opinion be safe to say that 100nF is a safe 'norm' in dealing with low-voltage projects such as this one? I'm asking because I've come across a number of tutorials on similar projects with somewhat varying values, despite the same amount of power.

Appreciate your input, thanks again.

harleydk:
Hello Jack,

thanks a bunch,

[quote author=Jack Christensen link=topic=151426.msg1137361#msg1137361 date=1362077221]
Most regulators should have caps on input and output, refer to the datasheet for specific recommendations. On the ATmega, pin 7 (Vcc) should connect to pin 20 (AVcc).

sorry if this is a stupid newbie question, in which case I can only hope it'll help some other hapless soul, when you say Vcc and AVcc should connect, is that then saying that these pins require a direct connection even though they're fed the same 5v from the regulator? Thanks in advance for clarifying this for me.
[/quote]

Not at all. I didn't see on your board where pins 7 and 20 are connected at all. Maybe I'm missing it. Don't count on an internal connection, things may seem to work but will be flakey ... voice of experience :blush: I usually end up connecting pin 7 to 20 under the chip, it's the shortest route and quite often the power has to go elsewhere anyway. See the picture below. C8 and C9 are 100nF, C13 is a 10µF bypass for a MAX7219 above the MCU. (Have to say that Fritzing schematic is really terrible, harder to read than the board!)

[quote author=Jack Christensen link=topic=151426.msg1137361#msg1137361 date=1362077221]
The ATmega also needs at least one bypass cap (100nF) near one of the power pins, and another from AREF to ground.

In terms of decoupling (bypass) capacitors, would it in your opinion be safe to say that 100nF is a safe 'norm' in dealing with low-voltage projects such as this one? I'm asking because I've come across a number of tutorials on similar projects with somewhat varying values, despite the same amount of power.
[/quote]

Absent any specific recommendation in the datasheet, 100nF is a good rule of thumb.

board.png

AVcc, Aref, and the GND pin near them are applicable to the analog inputs (that GND pin is sometimes referred to as "AGND"). The Vcc and GND on the other side of the chip are applicable to the digital inputs. In an ideal design those analog and digital GND connections would only intermingle right at the power jack. All of your analog pins would only use their AGND and be kept separate from the GND used by the digital pins. There would be three separate capacitors between AVcc and AGND, Aref and the same AGND, and Vcc and its associated GND.

As an example for why all this is, when you're blinking your LED on pin 7 and it's jumping between 5V and 0V you're causing small voltage surges/drops that can be noticeable by the analog pins. Normally the analog pins will only see slow changes in voltage around them -- which is great for stable readings -- so you don't want to introduce additional noise from your blinking LED.

You really only do most of this stuff if you're really concerned about getting the most stable analog readings possible and for most projects it doesn't matter. The official Uno doesn't even follow these rules. But, you asked, so I did my best at explaining :slight_smile:

The datasheet also recommends the AVcc pin be supplied via an LC network and there is also the ADC Noise Reduction sleep mode which stops the CPU to further reduce EMI. These measures can be taken to improve ADC accuracy, but as Chagrin says, most applications do not require them.

Tremendous, I'm learning a heck of a lot here. I hadn't connected 7 and 20 directly, I was routing the same power to them but through a number of the other components... I'll take your clue and run with it, so thanks again.

Another thing I need to learn from you is in how you hook up your capacitors - am I reading your schematic correctly, in that C8 is only connected on one leg? Is this what you mean by saying ' You can always leave the spaces unpopulated', which I didn't really grasp?

I'll keep this in mind for future projects for sure.

Chagrin:
There would be three separate capacitors between AVcc and AGND, Aref and the same AGND, and Vcc and its associated GND.

I hear you, and will seperate the digital/analog connections accordingly. Even though I won't requirethe most exact of readings, it's probably best to get in the groove of things from the first go. Thanks for the explanation! 'Preciate it :slight_smile:

harleydk:
Another thing I need to learn from you is in how you hook up your capacitors - am I reading your schematic correctly, in that C8 is only connected on one leg? Is this what you mean by saying ' You can always leave the spaces unpopulated', which I didn't really grasp?

He has a ground plane which isn't visible. The side that appears to be unconnected is actually connected to GND in a flood fill.

With respect to "leaving spaces unpopulated" I'm referring to not adding the part in the final circuit. For example, if you just wanted to run your 328 at 8MHz using the internal oscillator then you'd leave the spaces for the crystal and capacitors "unpopulated".

Chagrin:

harleydk:
Another thing I need to learn from you is in how you hook up your capacitors - am I reading your schematic correctly, in that C8 is only connected on one leg? Is this what you mean by saying ' You can always leave the spaces unpopulated', which I didn't really grasp?

He has a ground plane which isn't visible. The side that appears to be unconnected is actually connected to GND in a flood fill.

With respect to "leaving spaces unpopulated" I'm referring to not adding the part in the final circuit. For example, if you just wanted to run your 328 at 8MHz using the internal oscillator then you'd leave the spaces for the crystal and capacitors "unpopulated".

Correct, C9, C10, C11 and several others are the same way, connected to the ground pour. Here are images of the top (red) and bottom (blue) copper that may clarify things a bit. This is a multi-purpose board and was designed with the idea that several components would be optionally installed, depending on the ultimate purpose of the board.

Chagrin:
He has a ground plane which isn't visible. The side that appears to be unconnected is actually connected to GND in a flood fill.
With respect to "leaving spaces unpopulated" I'm referring to not adding the part in the final circuit. For example, if you just wanted to run your 328 at 8MHz using the internal oscillator then you'd leave the spaces for the crystal and capacitors "unpopulated".

I see. Well this has been great you guys, I've learned a lot and will now redesign and re-study. Very helpful you have been, both. Have a great weekend!

You could probably remove most, if not all of the vias with some routing changes. Is there a reason why tracks are not routed under the 328p? For example, you could route the top left pin of the 2x4 header to 328p pin 4 by going under it. Also, changing the assignments of the 2x4 header pins to 328p pins would allow you to route more efficiently. That's only possible if you're in complete control of the code, of course. Moving the crystal a bit closer to the 328p would allow you to route the nearby track with two vias around the outside of it.

gutbag:
You could probably remove most, if not all of the vias with some routing changes. Is there a reason why tracks are not routed under the 328p? For example, you could route the top left pin of the 2x4 header to 328p pin 4 by going under it.

Hello gutbag, thanks for your input,

the reason I did not route under the 328p was that I was not sure this was a good idea - being a pcb beginner I was worried about having to solder the 328p legs close to the routed tracks. I see now that others don't have the same concern, so I'll go ahead and do it.

I should add that my plan is to put a socket where the MCU will go, so that I'm able to easily replace it with another one. Just like it's done with my Arduino Uno.

gutbag:
Also, changing the assignments of the 2x4 header pins to 328p pins would allow you to route more efficiently. That's only possible if you're in complete control of the code, of course. Moving the crystal a bit closer to the 328p would allow you to route the nearby track with two vias around the outside of it.

The 2x4 header pins are for an SPI interface to a transceiver on a breakout board, so I'm afraid I can't change the assignments :frowning: Now that I know that routing below the 328p should be of no concern, I will certainly move things around quite a bit :slight_smile:

Thanks again for your input!

harleydk:
I've managed to design my very first pcb. It's a sensor board, with room for an atmega328 and 3 analog inputs, as well as a status LED and a 2x4 pin-header where is meant to go a nordic transceiver breakout module.

Very interesting. The first dedicated board I have seen and, if I can be sure of the Nordics delivering the goods, I am looking at doing pretty much the same thing.

Quite apart from the extra cap etc., I wondered about avoiding some of the through-board transitions. UI assume the large rectangle at the top is a regulator and can be rotated, and the nearby terminal can be reversed.

I submit the diagram below as intellectual exercise...

I would be interested to see how you finish up with this.

Nick_Pyner:
Very interesting. The first dedicated board I have seen and, if I can be sure of the Nordics delivering the goods, I am looking at doing pretty much the same thing.
I submit the diagram below as i9ntellectual exercise...
I would be interested to see how you finish up with this.

Hello Nick, thanks for the inspiration & I'll be sure to post the re-done schematic here. It's not the first dedicated board I'm afraid - search google for 'maniacbug' and you'll see some great stuff built with the nordic chip. It will deliver, I've had succesful tests with so I'm happy to go with it and I'm sure you will be, too.

Hello again,

as promised here's the revised board, in the case someone would find it useful.

Routing below the MCU certainly made it much easier!

P.S. I reverted to through-hole components, because I wanted go easy on myself, this being the first board and all...

Are ground pins 8 and 22 connected? They should be.

Ahem cough they are now. Thanks.

In case anyone could find use for this, here's the link to the Fritzing file:
https://docs.google.com/file/d/0B8b-I3PiuN9lZ1FsdHU4VnNROG8/edit?usp=sharing