Go Down

Topic: My first pcb (Read 5 times) previous topic - next topic

harleydk

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
---
My hopefully helpful blog at technicalstuffhopefullyuseful.blogspot.com

Chagrin

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!

Jack Christensen

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.
MCP79411/12 RTC ... "One Million Ohms" ATtiny kit ... available at http://www.tindie.com/stores/JChristensen/

harleydk

Hello Chagrin,

very helpful indeed,


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)




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).
---
My hopefully helpful blog at technicalstuffhopefullyuseful.blogspot.com

harleydk

Hello Jack,

thanks a bunch,


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.


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.

Appreciate your input, thanks again.
---
My hopefully helpful blog at technicalstuffhopefullyuseful.blogspot.com

Jack Christensen

#5
Mar 01, 2013, 02:02 am Last Edit: Mar 01, 2013, 02:05 am by Jack Christensen Reason: 1

Hello Jack,

thanks a bunch,


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.


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 :smiley-red:  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

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.


Absent any specific recommendation in the datasheet, 100nF is a good rule of thumb.
MCP79411/12 RTC ... "One Million Ohms" ATtiny kit ... available at http://www.tindie.com/stores/JChristensen/

Chagrin

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 :)

Jack Christensen

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.
MCP79411/12 RTC ... "One Million Ohms" ATtiny kit ... available at http://www.tindie.com/stores/JChristensen/

harleydk

#8
Mar 01, 2013, 08:59 am Last Edit: Mar 01, 2013, 10:07 am by harleydk Reason: 1

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 :smiley-red:  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!)


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?


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.


I'll keep this in mind for future projects for sure.
---
My hopefully helpful blog at technicalstuffhopefullyuseful.blogspot.com

harleydk


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 :-)
---
My hopefully helpful blog at technicalstuffhopefullyuseful.blogspot.com

Chagrin


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".

Jack Christensen



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.
MCP79411/12 RTC ... "One Million Ohms" ATtiny kit ... available at http://www.tindie.com/stores/JChristensen/

harleydk


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!
---
My hopefully helpful blog at technicalstuffhopefullyuseful.blogspot.com

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. 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.

harleydk


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.


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 :-( Now that I know that routing below the 328p should be of no concern, I will certainly move things around quite a bit :-)

Thanks again for your input!
---
My hopefully helpful blog at technicalstuffhopefullyuseful.blogspot.com

Go Up