arduino on new PCB timing is not right...

Hey fellas, i made an arduino on a bread board following the tutorial on the site , after that i decided to etch out a pcb and
all seems well except it works a little bit slower then it did on the bread board , So i am guessing it has to do with how i connected my crystal or the capacitors to the crystal
if you noticed on the image the capacitors that come off the crystal are suppose to go to ground so i just have one long connection conecting both of them to some extra ground headers and all of those as well as the grounds on the Atmega chip are basically all routed the same way to the actual ground off of the 7805 ... So i uploaded the Blink led sketch and it does not blink once a second i would say about once ever 2 seconds , and because of this i also cannot upload a sketch directly to it because i get the out of sync error , which i had already found a way to time it right thanks to the forum ... and i know the design of the circuit may not be the prettiest thing out there but it is my first , but what the constructive criticism is welcomed . any ideas on what may be causing the slower clock speed.
traces all look good.

another thing, any tips on how to solder components with out having to tape them on, because for example the female headers where a pain in the butt because i cannot bend the leads outwards to hold it in place so i tried taping them on and was difficult to get them nice and straight once i flipped it upside down to solder... :confused:

also not the labels are just for reference, they are not on the actual pcb since i cannot do silk screening at home

heres a quick refrence of the pin out for the 328 if needed , i trippled checked and all is well as far as connections go

eddiea6987:
all seems well except it works a little bit slower then it did on the bread board , So i am guessing it has to do with how i connected my crystal or the capacitors to the crystal
if you noticed on the image the capacitors that come off the crystal are suppose to go to ground so i just have one long connection conecting both of them to some extra ground headers and all of those as well as the grounds on the Atmega chip are basically all routed the same way to the actual ground off of the 7805 ... So i uploaded the Blink led sketch and it does not blink once a second i would say about once ever 2 seconds ,

Where did you get the chip from? Is it brand new? Or did you took it from an Arduino board? Does it work on the Arduino board? Try the serial program in an Arduino board and report what you see.
The tracks don't look so big... plus, if you've connected this on a breadboard, the capacitance would probably be higher than here. :\

eddiea6987:
another thing, any tips on how to solder components with out having to tape them on, because for example the female headers where a pain in the butt because i cannot bend the leads outwards to hold it in place so i tried taping them on and was difficult to get them nice and straight once i flipped it upside down to solder... :confused:

Experience is key with these things... when assembling a board, start with the lowest components and work your way upwards. The sockets are normally the first ones to be soldered. You put the socket in it's place, flip the board, set it on a table, put some pressure to make sure the socket and board are lined up, solder one pin one each side this way. The socket will now remain in place and you can solder at will.
It is also a good idea to buy sockets from the same manufacturer to avoid having the board slightly crooked. However, this is splitting airs.

But again, in the end it comes down to practice and I'm sure plenty of people have their own tricks when it comes to solder.

not blink once a second i would say about once ever 2 seconds ,

Sounds like you're running on the internal 8Mhz oscillator and not the crystal.

any tips on how to solder components with out having to tape them on,

As bubulindo said, start with the lowest components.

Also you can hold the board and say a socket in place with one hand/finger, have a roll of solder on the bench with 2" of solder poking in the air (that's your third hand) and soldering iron in the other hand. Solder two pins then you're right. Doesn't work so well with small components like resistors because your finger get real hot :slight_smile:


Rob

all seems well except it works a little bit slower then it did on the bread board

Are you using the Microprocessor from the breadboard or a different one?

it does not blink once a second i would say about once ever 2 seconds

Do you have a scope or does your multimeter have a frequency function? It could be helpful to know what is the rate you are actually toggling (and if it is stable.)

another thing, any tips on how to solder components with out having to tape them on

For smaller components, I use painter's masking tape (the blue kind.) It leaves very little residue behind. I'm careful not let the tape touch leads (like on a resistor) to avoid burning the tape.

For larger things like the headers, I only solder in the first pin. Then I use my fingers (or pliers) on the "cold end." Re-apply heat to the first pin and adjust the header as desired. Once that joint sets, I solder the rest of the headers. In the past I've also plugged headers into a breadboard and soldered that way. If you decide to go that route, you definitely need to skip every other pin to keep heat from building up. Which is good advice anyway.

It really does sound like you have incorrect fuse bits, so you are running on the internal oscillator and therfore not using the crystal.

Are you using the Microprocessor from the breadboard or a different one?

yeah the same 328 from the breadboard, i am switching in and out of my pcb and the actual UNO to upload sketches

Do you have a scope or does your multimeter have a frequency function? It could be helpful to know what is the rate you are actually toggling (and if it is stable.)

Sounds like you're running on the internal 8Mhz oscillator and not the crystal.

that sounds very much like whats going on, im going to change the crystal and caps and if that doesnt work make a new pcb and if the same problem persist then it must be my design,

It really does sound like you have incorrect fuse bits, so you are running on the internal oscillator and therfore not using the crystal.

i think so, i will try to rebuild from scratch

The tracks don't look so big... plus, if you've connected this on a breadboard, the capacitance would probably be higher than here. :\

the tracks are 24mil and i used the exact same setup from the example, i figured it worked well on the breadboard then why change anything,

as far as the soldering tips thanks guys, you know what would be interesting, do you guys remember those toys from back in the day that where basically a couple hundred little metal rods that moved freely vertically and if you put your hand under it then you could see the shape of your hand formed by the rods on the other side, what if you made that but some how backwards, the bars actually are prone to stick up , maybe a small spring , and when you drop your pcb and component on top of it , it will push the component up and fill the empty spaces as well ... i dont know i guess you have to imagine it how i am to understand me hehe..

If you're able to upload code on an Uno board it's probably not the chip, but the board...

If I may, a little critique of your design,

I'm not seeing a .1uF bypass capacitor going from the VCC on your chip to GND. (edit: I just spotted it, it wouldn't be filtering/bypassing that far away from your VCC Pin, it's effectively not there doing it's job)

Also, ground trace should not daisy chain from one component to the next, especially if one of the components on there is a crystal. Noise from internal switching on the microcontroller will get introduced to your ground all over that trace and will raise the 'potential', basically you won't have a true ground to reference anymore. Also, it's one long electromagnetic antenna, picking up radio frequencies. This could potentially effect your timing.

If you were to redesign, I would recommend either learning about polygon ground pours or, at the very least, draw one huge fat ground trace up the middle of your board and have all components that need to reference off it connect straight to that, not each other.

Second, to advise on your problem, if you could kindly provide the following:

The settings you used for fuse bits ( or if it was a prebootloaded chip)
The speed of your crystal.
The part number of your crystal and values on your crystal capacitors might actually help as well.

I'd assume you're using the latest bootloader Uno, Decimilia...

What method (programmer) did you use to program your chip (if it wasn't pre programmed with bootloader) ? Can you go into:

AVR Studio>
Tools>
AVR Programming>
Fuses

to read them?

AVR Studio is a free tool available from Atmel if you don't already have it.

If you keep your current design, if you're using a 16Mhz Crystal you're going to need to replace it with a much more stable 8Mhz.

16Mhz Chyrstals aren't that stable, and the fuse bit arduino uses for them isn't optimized for noisy boards like yours. If you insisted on keeping 16Mhz (I would not recommend it) learn about the FULL SWING fuse bit settings available. You'd have to overdrive your crystal.

To get back to speed of crystal and values of your capacitors, if I had to wager, the stray capacitance of your long ground trace would bump up the capacitance values via stray capacitance on your crystal caps making things very unstable. An scope would be very helpful in this regard.

thats a very interesting and much appreciated post DSHAY , i did however change the capacitor which i guess must of been damaged during my soldering and it works now as well as the uploading sketch , the chip was already bootloaded i took it out of my Arduino, ive ordered some other blank chips which i plan to use USBtinyISP through the Arduino IDE ,
what really interested me was " polygon ground pours" which just sounds interesting.
i was pretty sure it was not best practice to connect components grounds to each other and i did it anyways, but your reassurance has now relieved me of any doubts ,
one question though , i do not have any .1uf capacitors going from vcc to gnd or any .1uf caps at all , but if i did why from Vcc to gnd??

note: i only have the 2 10uf caps before and after the regulator and 2 22pf caps from the crystal to ground.

Swapping out caps on your crystal and now it works doesn't necessarily mean your cap was broken (unless you have a really good meter and can measure 22pF accurately, even then stray capacitance in your circuit...)

It could be the capacitor's percentage tolerance (+/-20%) in addition to the stray capacitance of your ground trace added up to breaking a camel's back. I've seen this in the field doing repair work. This is common if there is stray capacitance on the traces or the crystal's capacitor values are ill suited for the Load Capacitance value of the crystal, or you have ceramics with extremely sloppy temperature coefficients.

Replacing the capacitor and now it works could mean you're safe, but barely and may still have instability down the road. I would possibly consider reducing your capacitor values to factor in stray capacitance. THe best possible method to find stable values is to buy a number of values say, from 10pF up to 30pF and test to see what the bottom and top of your ranges are and pick a value that is dead in the middle (the average of your bottom and top limit) Or, just try a lower value, say 16pF, and if it works, stick with that...

Or you could've had a cold solder joint on the cap. Or, maybe you did burn it out...

To get back to your bypass/filter issue... It is standard practice on all digital chips to filter/bypass VCC to Ground with a .1uF ceramic capacitor directly (as close as you can get the component to the VCC pin and the components Ground Pin. It is why they designed this chip with the VCC and Ground directly adjacent. You could finagle the leads of a through hole .1uF cap into the pads of your VCC and Ground. You really do need this one...

very interesting, i found this little page on bypassing with caps. I understand now . not fully but i get the idea

The problem looks like poor decoupling - there needs to be a ceramic decoupling capacitor right next to the supply pins of the 328, something like 0.1uF or 0.22uF. Without good decoupling all bets are off with complex digital circuits.

It looks like there is no ground-plane which will make things worse as decoupling relies on low-inductance paths from the chip to the decoupling capacitor. Make the ground and power traces much wider than signal traces to help with this.

Lack of decoupling is the single most common fault when something appears to work but not reliably, see:-
http://www.thebox.myzen.co.uk/Tutorial/De-coupling.html