Review my design

Hello All, I am trying to build my own arduino board for a project... I have the PCB built and testing it, but for some reason I think I have something wrong at a very basic level. While the sketches seem to work, they work VERY slow, I.E. each function takes about 2sec to process. I installed my sketch on a "factory" arduino nano, and it works PERFECT, no issues at all. so i know its something with my layout or parts selection. Please review the below and let me know if I did something wrong. I also attached a BOM for your review. I look forward to your response.

BOM
PART VALUE DIGIKEY DESC
C1 0.1uF 478-5096-ND CAP CER .10UF 50V X8R 10% RAD
C2 10uF P828-ND CAP ALUM 10UF 50V 20% RADIAL
C3 0.1uF 478-5096-ND CAP CER .10UF 50V X8R 10% RAD
C4 22uF 445-2869-ND CAP CER 22UF 6.3V Y5V RAD
C5 22uF 445-2869-ND CAP CER 22UF 6.3V Y5V RAD
R1 10k
U2 MC7805 MC7805CT-BPMS-ND IC REG LDO 5V 1.5A TO220

Thanks,
Chris
Y1 16Mhz X433-ND CRYSTAL 16.000 MHZ SER 49US

Arduino.bmp (385 KB)

While the sketches seem to work, they work VERY slow, I.E. each function takes about 2sec to process

Did you change the fuse settings so the ATmega168 uses an external crystal?

No..... Let me research how to do this!

Ok the fuse settings look confusing as can be... im a novice... Is it possible to use the internal clock? and if so what changes would I need to make to my layout? simply remove the crystal? Do I still need the caps connected to those pins?

Alright I have a AVRISP mkII that I am going to use to program these chips now. Do I simply need to set the fuse settings to:

Low: 0xFF
High: 0xDD
Ext: 0x00

Even if I am not using the boot loader?

Warm Regards,
Chris

windhamrules:
Is it possible to use the internal clock?

Yes.

The processor's internal oscillator is ±10% from the factory. It can be tuned (by you) to be at least ±1%.

The biggest problem from the loose timing is with serial communications. Past about ±4.5% you will have problems.

and if so what changes would I need to make to my layout? simply remove the crystal?

Yes.

Do I still need the caps connected to those pins?

No.

windhamrules:
Alright I have a AVRISP mkII that I am going to use to program these chips now. Do I simply need to set the fuse settings to:

Low: 0xFF
High: 0xDD
Ext: 0x00

Even if I am not using the boot loader?

Let's find out...
http://www.engbedded.com/fusecalc/

No. The clock is External Crystal with those settings.

To use the internal oscillator I suggest these (conservative) settings...

Int. RC Osc. 8 MHz; Start-up time PWRDWN/RESET: 6 CK/14 CK + 65 ms; [CKSEL=0010 SUT=10]; default value
Brown-out detection level at VCC=4.3 V; [BODLEVEL=100]
Preserve EEPROM memory through the Chip Erase cycle; [EESAVE=0]
Serial program downloading (SPI) enabled; [SPIEN=0]
Boot Flash section size=1024 words Boot start address=$1C00; [BOOTSZ=00] ; default value

Low = 0xE2
High = 0xD4
Extended = 0xF9

Thanks so much for you help on this, Im trying again today... so far I seem to have 'eaten up' two atmega168's with my attempts to get the fuse settings right... seems once you program them wrong they just dont want to work after HAHAHAH :slight_smile: Lessons being learned :slight_smile: But I appreciate the help and will try this out shortly... just have to desolder the proc from my board and solder in a new one.... I knew I should have bought more of the PCB's im using

That was the issue! Once i removed the crystal and caps and set the fuse settings as you state, the sketch ran flawlessly. Thanks so much for your help with this Coding! Now that I at least know the whole circuit is good, I can start playing around with getting the crystal to work... doesnt seem like it should be too hard, but for some reason im having trouble with it LOL. Thanks again for your help!

Even if the fuses are set up properly for the crystal oscillator, the crystal loading caps, C4 and C5 are ~1000 times too large, they should be 22pF, not 22uF. Digi-Key indeed says that part no. 445-2869-ND is 22uF, although the picture sure looks like it could be a 22pF cap.

And actually, the crystal load capacitance (not the load capacitors) for that particular crystal should be 20pF. The load capacitors should therefore be around 30pF. See the formula on the top of page 9 in this Microchip application note.