Works on breadboard but not in PCB

Hi guys!

I’m working on a project for a friend. All it does is have a transistor hooked to pin 5 of the ATMega (via jumper wire) to fade a set of LED’s in a prescribed pattern. I hooked it all up in my breadboard with my USB Boarduino (from Adafruit) and got it working perfectly. From there I went and designed a PCB in Eagle and etched it. Now it doesn’t work. All the voltages and grounds are connected properly and all traces checked out good. There’s voltage going into the transistor but for whatever reason it seems the ATMega isn’t switching the transistor on and off. If anyone can help I’d appreciate it!

Schematic:

http://www.computersandcircuits.com/ima … ematic.jpg

Board layout:

http://www.computersandcircuits.com/ima … /board.jpg

Code:

int ledPin = 3;

void setup(){} 

void loop(){
  for(int fadeValue = 0 ; fadeValue <= 255; fadeValue +=25){
    analogWrite(ledPin, fadeValue);
    delay(15);
  }
  for(int fadeValue = 255 ; fadeValue >= 0; fadeValue -=25){
    analogWrite(ledPin, fadeValue);
    delay(15);
  }
  for(int fadeValue = 0 ; fadeValue <= 255; fadeValue +=25){
    analogWrite(ledPin, fadeValue);
    delay(15);
  }
  for(int fadeValue = 255 ; fadeValue >= 0; fadeValue -=5){
    analogWrite(ledPin, fadeValue);
    delay(25);
  }
  delay(750);
}

I’ve also done up the circuit in the breadboard as it’s laid out on the PCB with the same non-working results. If I put 5V directly to the pin on the transistor the LED lights up, so the chip isn’t running its code for some reason. Yet I put that same chip back into the Boarduino and it works fine. The code was changed to go along with the revised breadboard layout here, so the D3 in the code and PCB has been changed to 11 for this breadboard layout. Also the reset is hooked to %v via a 10k, just hooked it up after I snapped this pic. :evil:

http://www.computersandcircuits.com/ima … nal/bb.jpg

Do you see that yellow wire? Thats called an airwire. No trace was ever made. Next time I would advise using the autorouter. Just put a polygon in the tkeepout layer(I think), and the router will not make any traces in that layer, just on the bottom.Second: I suggest putting a ground plane on this thing. You will have to etch much less(if you etched it yourself) and the resistance for high currents will be much less (professional or homemade)

Sorry I didn’t clarify that that airwire was done on the PCB by means of a jumper (to keep it single-sided). It is hooked up as in the schematic on the breadboard in the last image though and still doe snot function. Voltage is getting to the chip and it’s grounded, and if I hook 5V to D3 the LED lights up so the transistor is OK.

I was about to say!

Ok. Lets set D3 to output and set it high. Then probe D3 to ground and see if you get 5v.

Using the USB Boarduino I get 4.8V (over USB). With the chip in the breadboard I’m only getting ~6mV. But on any other D pin I’m getting less than 1mV.

Try rewiring the transistor control to another PWM digital pin. Remember to reflect this in code also. You may have damaged that pin during soldering or something.

I’ve redone the transistor part of the circuit (LED and resistor on collector side, emitter to ground, base to resistor to pin). I can use the ATmega in the Boarduino and all works perfectly. I take that chip out of the Boarduino and put it standalone (with crystal, caps and 10k to ground) and it doesn’t work, not even the basic blink program (with 3 used instead of 13). I think now it’s an issue with the crystal and/or caps. Problem is I’ve got a new o-scope but I have no idea how to test a crystal with it. Any pointers?

Ok. Well usually with caps they short out. So check the resistance on the caps. Or if you have a capacitance meter, use that too. As for the o-scope tips: I don’t own one. Somehow I’ve gotten by all of these years… my budget just doesn’t allow. If you want to give yours away I would take it in a heartbeat. I would very carefully take the crystal of the boarduino and plug it into your circuit since we can confirm it works.

SXRguyinMA:
I think now it’s an issue with the crystal and/or caps. Problem is I’ve got a new o-scope but I have no idea how to test a crystal with it. Any pointers?

You need to check the datasheet to make sure you measure the correct side of the crystal (ie, the side connected to the OUTPUT of the inverting amplifier in the oscillator). Either that, or just test both sides until you see a squarewave…