Pages: [1]   Go Down
Author Topic: is there a difference in programming arduino 16mhz or built in 8mhz  (Read 807 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 20
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

i have a project that i am working on (simple 3W RGB LED mood light driven with a ULN2003 darlington transistor array). i have the source code in my uno board. the question i have is the uno has a 16 mhz  crystal for the clock signal. without the crystal it run at 8mhz internally. is there anything in programming that has to change to work the circuit. i am wanting to take out the atmega 328 chip and use it without the arduino uno board. all advise is appreciate. i have searched over the internet and forum but cant find the answer im looking for.
Logged

SF Bay Area (USA)
Offline Offline
Tesla Member
***
Karma: 124
Posts: 6634
Strongly opinionated, but not official!
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

If you do not tell the Arduino IDE that you are using a board with an 8MHz clock, it will build your sketch with the assumption that it will run at 16MHz, so that calls to functions like delay() will take twice as long as you expect.

The chip will not just run at 8Mhz when you take it out of the Arduino board and it no longer has a crystal attached.  You have to TELL the chip to use the internal clock by reprogramming the fuse bits to the appropriate values.  This will require some sort of chip programmer device like a USBTiny or a second arduino running ArduinoISP.
Logged

Left Coast, CA (USA)
Offline Offline
Brattain Member
*****
Karma: 361
Posts: 17259
Measurement changes behavior
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

i have a project that i am working on (simple 3W RGB LED mood light driven with a ULN2003 darlington transistor array). i have the source code in my uno board. the question i have is the uno has a 16 mhz  crystal for the clock signal. without the crystal it run at 8mhz internally. is there anything in programming that has to change to work the circuit. i am wanting to take out the atmega 328 chip and use it without the arduino uno board. all advise is appreciate. i have searched over the internet and forum but cant find the answer im looking for.

What you wish to do is possible but there are chip internal fuse settings changes  needed to converting from external 16Mhz to internal 8Mhz.  It's much easier to just get a 16Mhz three terminal resonator to use in your standalone operation. That will save you a lot of fustration, trust me. You just ground the center pin and wire the outside pins to pins 9 and 10 of the 328 chip, no padding caps required. This will allow you to move the 328 chip back and forth between your arduino board and your standalone setup.

http://www.sparkfun.com/products/9420

Lefty

Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 20
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

thanks that's exactly what im looking for. the resonator is the answer. makes sense. im assuming the extra pin on the resonator is for the caps builtin vs. the crystal and caps.  so after i upload my sketch on the uno board then i remove the chip, add a 16mhz resonator and +5VDC power supply and finish adding the ULN2003 and RGB LED. right?
Logged

Left Coast, CA (USA)
Offline Offline
Brattain Member
*****
Karma: 361
Posts: 17259
Measurement changes behavior
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

thanks that's exactly what im looking for. the resonator is the answer. makes sense. im assuming the extra pin on the resonator is for the caps builtin vs. the crystal and caps.

Correct  

so after i upload my sketch on the uno board then i remove the chip, add a 16mhz resonator and +5VDC power supply and finish adding the ULN2003 and RGB LED. right?

Well most recommend a 10k pull-up resistor for the reset pin (chip pin 1). And possibly a 10k ohm pull-up on arduino pin 0 (chip pin 2) to prevent the bootloader from responding to noise inputs on the rec pin. Also a couple of .1mfd bypass caps between the two Vcc pins (chip pins 7 & 20) and the ground pins ( 8 & 22) are highly recommended, mounted close to the chip. Having a manual reset switch is an option you might consider or not.

Lefty
Logged

Pages: [1]   Go Up
Jump to: