Using the 8MHz Internal Clock and the XTAL Pins as I/O...

ATmega devices are supplied from new with their internal 8MHz clock selected and a "Divide by 8" fuse set so, the actual running frequency of the device is 1MHz. The ATmega328P used in the Arduino Uno for example uses a 16MHz external crystal to control the device's clock and has different fuses set to make this happen.

Pros and Cons of using an 8MHz internal clock:


  1. No external crystal or capacitors
  2. You gain 2 additional input/output pins (PB6 & PB7)
  3. Suitable for most applications where timing accuracy and speed are not essential
  4. Power consumption is reduced by using a slower clock


  1. The 8MHz oscillator will vary more with temperature and device supply voltage
  2. Accurate timing will be affected (The clock frequency can be adjusted or "tuned" using a register within the device)
  3. High speed processing is not possible

Never alter the fuses unless you know what you are doing and have fully understood the "Memory Programming" section of the device datasheet!

To change the default (factory shipped settings) we need to change the fuses and this suggested "boards.txt" profile will do the job: (INT 8MHz Clock ArduinoISP)
atmega328.bootloader.lock_bits=0x0F (change to "atmega328_8mhz" if you install the new variants file - see below)

After "Burn Bootloader" on the device it will be running at 8MHZ and will not require an external crystal or capacitors. To return the device to 16MHz crystal operation simply use the Uno profile with "Burn Bootloader" and attach the crystal and capacitors. You will also need to use the 8MHz output from the Arduino ISP. Uno

Once the device is programmed for 8MHz internal oscillator the pins that were originally used for the external crystal become available as follows:

PORTB bit Arduino Uno pin Atmega328x pin Current use 8MHz internal clock use
0 8 14 ICP ICP
1 9 15 OC1 OC1
2 10 16 SS SS
3 11 17 MOSI MOSI
4 12 18 MISO MISO
5 13 19 SCK SCK
6 20* 9 XTAL1 input/output PB6
7 21* 10 XTAL2 input/output PB7

* Pin assignments only apply when using the "atmega328_8mhz" variant file downloadable below! (I have modified the "standard" Arduino pin definition file to include pins 20 & 21)

Alternatively you can control/access the new pins by directly accessing the DDRB & PORTB registers.

Did you know that Arduino Pins "A0 - A6" can also be referred to within sketches as Arduino Pins "14 - 19"?

Variants file for ATmega328 devices using 8MHz internal clock to give Arduino pins 20 & 21

Chapter 12: ATtiny devices>>>