Help with my first PCB design

The last couple days I've been working on my first PCB layout, and would like to get a second (or third) opinion about whether or not I've been doing alright. I created the schematic for my circuit in Eagle first, then went into the PCB layout and laid out the parts as I might like them, then used the auto-route tool to create the traces.

The circuit is a simple RGB LED driver that uses a stripped down Arduino to send PWM signals through a ULN2003A to control a 3W RGB LED (from SparkFun). I also thought it'd be neat to have three potentiometers, and they will be panel mount, off-board, so I just have three pads to solder to the wipers of the pots.

I tried to set up the AtMega328 by copying the circuit design of the Arduino Duemilanovae, which I've never done before, so let me know if this part needs work.

In particular, I'm not sure if I used the right kinds of solder pads - I was hoping to use them to connect external parts (RGB LED, potentiometers, power jack) to them board using #26 gauge wire.

You can download my files here:
http://cs.unk.edu/~webb/files/RGB-LED-driver-v10.sch
http://cs.unk.edu/~webb/files/RGB-LED-driver-v10.brd

Thanks!

Potentiometers need 3 connections - where are the other 2 (power & ground).
LEDs need 2 connections - have the pads for the 2 wires next to each other.

Use the Polygon function, draw a polygon around the perimeter of the board, then use the Rats Nest feature (looks like an X) to fill in the ground plane.
After you get it drawn right click & use Name to call it ground.
Do one for top & bottom layer.
Add a couple pads you can add external reset switch during testing.
Or pins to connect RS232/DB9 to go to RS232/USB adapter for serial IO/debugging.

You need to name the polygon 'GND' not 'ground' !

Also you have missed the supply decoupling capacitor, 100nF or so ceramic between 5V and GND close to both chips.

The +5V traces ought to be wider to decrease its stray inductance, 0.032 to 0.05" - same for GND unless using a ground plane.

The resistors look huge - why not use standard 0207/10 package? If you need more power dissipation then you need to boost the output from the 328 as it can't provide more than about 30mA.

Why the series resistors on the analogue inputs. These are not needed and will only contribute to the noise on the input.

I thought the ULN2003 was the driver for the LEDs?

Yes, GND and not ground. When done right you will see a + of traces across the holes that are connected to ground.

If the parts are really 3W, that's 600mA of current at 5V. Suggest you double up the ULN connections to have pairs of outputs sinking current for each LED.
May end up needing a heatsink on it as well.
Might be preferable to add 3 N-Channel Low Rds Logic Level Mosfets instead, they will dissipate next to nothing for power.
Such as NTD4960N from digikey.com $0.48 for thruhole.

@CrossRoads: The pots will have their +5V and GND lugs daisy-chained together, then connected directly to the power supply. This way, only the wipers needs to be run to the microcontroller. Also, this LED is mounted on a star, so its easier to run all the cathodes to one spot, and all the anodes to another: Triple Output High Power RGB LED - COM-15200 - SparkFun Electronics .

I thought ground planes were only important for RF or HV applications, not for small signal stuff like this? Or is it more about keeping manufactoring costs down?

@Grumpy_Mike: Those are there to prevent the case when the potentiometers are turned all the way to the 'zero' direction, causing near-zero resistance to occur. Adding the 1k resistor there ensures that there is always some resistance in line. I've had potentiometers start smoking without having a resistor in line with them before, so I'm trying to prevent that here :slight_smile:

@CrossRoads: Yes, ULN2003A is the driver for the LEDs. I should have explained the LED a little more, see the link to the SparkFun product page from earlier in this post. Its 3W total RGB, but 1W per channel. Each LED can pull up to 350mA. Those big resistors there (R1, R2, R3) are 2W power resistors.

@MarkT: I added a decoupling 100nF capacitor right next to the power jack connections on the bottom left. I'm not completely sure about how to use them though: do they need to be closer to the ATMega328 instead?

I have built this circuit on perfboard already and it works fine (without the custom Arduino), but I'm not so certain about my translation to PCB. In particular, are the components too close together, are the solder pads the right kind, etc.

I'm good then, sounds like there is a method behind the madness 8)
I would still double up the ULN2803 drivers, take some of the stress off the parts.
Connect the 100nF cap as close to the VCC pins as you can. It helps provide a little oomph to the power pins when there is a lot of switching going on.
Ground plane will help with cooling also, help dissipate heat via the device leads.
Have found it easy to add - only tricky part I find is closing the polygon when you get back to the originating corner. Is always a struggle for me, probably because I have to zoom out to be able to see the whole board. Yours is smaller and it was easier to place the polygon.

I've had potentiometers start smoking without having a resistor in line with them before, so I'm trying to prevent that here

The positioning of those resistors will not protect anything.

Those are there to prevent the case when the potentiometers are turned all the way to the 'zero' direction, causing near-zero resistance to occur.

If you connect the pots up to +5 and ground on the outside and the wipers to the analogue inputs this will not happen.
This sort of thing only happens if you connect the wiper to one end. You need to rethink what you are doing here.

Thanks guys!

I will move the decoupling capacitor closer to the VCC pin of the ATMega. The ULN2003A (if I remember correctly) doesn't have a VCC pin, but it does have a ground pin - still need a decoupling cap there?

@Grumpy_Mike - hey, I'm all for removing unnecessary parts, reduces the parts count after all! But I wonder what I was doing wrong before...on breadboard (more than once) I, or one of my students, would connect the outer lugs of a pot to +5V and GND respectively, then the wiper directly an analog input of an Arduino. After about 1-2 minutes of playing around with an active sketch, the pots started smoking! My electronics prof mentioned that its probably because of the case when the wiper is all the way to the 0 side, and thus there is no resistance in line, causing a massive flow of current, burning out the pot. However, he's an analog nut and hated it whenever I said anything about Arduinos or microcontrollers in general...so he may not have the whole picture.

What was the value of the pots used? Could they have been really low resistance value, and thus high current draw?

My electronics prof mentioned that its probably because of the case when the wiper is all the way to the 0 side,

The case should not be in contact with the wipers, that would implies that you had a variable resistor rather than a potential divider. In any case putting a 1K resistor in line with a high impedance input isn't going to cure anything no matter how miss wired it is.

@CrossRoads: Good question! They were surplus parts that I received second hand, and never really measured. I assumed they were <10k each.

@Grumpy_Mike: Sorry, I meant 'case' as in 'scenario' rather than 'enclosure'.

So to help me understand my error here, how about this: what happens when I connect a 10k linear potentiometer to my Arduino (outer lugs to +5V and GND, inner lug to Arduino) with no extra resistor. Now, when I moved the knob all the way to the 'zero' side I have 0 ohms resistance, wouldn't I have a huge amount of current then go into my Arduino?

I = V/R = 5V/0 = infinite current

But if a small resistor (like the 1k's I have in the schematic) were there, no matter what the pot is at, there will always been some resistance between the power supply and the Arduino, limiting current to a safe level.

Edit: by the way, do I have the ATMega328 set up correctly to function as an Arduino? I do not intend to program it in circuit, hence the lack of ICSP headers or circuitry. I instead plan on pulling the chip out and installing it onto a breadboard, where I can use another Arduino as an ISP to burn the bootloader / my sketch. Once I have the code installed on the chip, I will just drop it into my DIP socket.

I fully expect to be wrong here, I'm just trying to expand my understanding a little :slight_smile:

. Now, when I moved the knob all the way to the 'zero' side I have 0 ohms resistance, wouldn't I have a huge amount of current then go into my Arduino?

No you would not. The arduino input is not a low impedance to ground, it is very high, in the order of 1M. Therefore while there is no resistance between the slider and the 5V there is a lot of resistance from the arduino input to ground.

Neat! But what about the pot itself? If there is no other resistance and I'm connecting it to a 5VDC @ 1A power supply, will the pot itself experience problems as lots of current goes through it? For example, if I use 1/4W potentiometers, and the pot is set to 'zero', will the amount of power going through the pot overwhelm its power rating?

No because the pot is say 5K so the maximum it has going through it at 5V is 5 / 5000 = 1mA.

Think of it as one resistor with a tap, it is only when you connect the tap to a voltage or ground you have trouble with excess current in it.

The power dissipated by the pot depends on its resistance and the applied voltage.
P=V^2/R
Work backwards to find the min R needs to be
R=V^2/P
5*5/.25 =
with 5V, R= 100 ohm or higher.

Interesting, if I am understanding that correctly, there does need to be a resistor (maybe between +5V and one of the outer pot lugs) of about 100ohms, just to prevent the resistance across the pot from ever being 0. Correct?

No you are not understanding it correctly!!!

There is NO repeat NO repeat NO need for any external resistor with a pot.

put the 5v across the built in resistor in the pot and use the wiper to select a voltage between 0 and 5 volts

as long as you have a normal load (or no load) on the output + and - you won't short out the source 5v by moving the wiper.

Sounds good to me, I will remove the resistors from the pots and save myself some money :smiley:

How about the Arduino / ATMega328 set up in the schematic? Did I configure the chip so that it will work correctly (once it has been programmed with my Arduino sketch by an external ISP on breadboard)?