Arduino

What Is the Function of Crystal Oscillator in Arduino

Arduino and other microcontroller boards need an oscillator circuit which helps them to synchronize internal operations according to clock signal. Oscillator circuits are there to give a constant clock source to Arduino microcontrollers. Using an external clock oscillator Arduino can not only run but also communicate with external circuits or PCs. The type of oscillator used in Arduino is Crystal oscillator. Let’s discuss why Arduino chooses a crystal oscillator and what are the main functions of a crystal oscillator in Arduino.

What Is Crystal Oscillator

Crystal oscillators are devices that move in a repeating pattern just like a pendulum or a tuning fork. Modern devices and microcontrollers require an external clock source in the form of a crystal oscillator. Microcontrollers use external crystal oscillators to set their clock speed. Different Arduino boards use crystal oscillators according to their type. The below table highlights some main boards with various types of crystal oscillators.

Arduino Board Oscillator Frequency
Uno 16MHz
Nano 16MHz
MKR Wi-Fi 48MHz
Mega2560 16MHz
Due 84MHz

Crystal oscillator helps the microcontroller to calculate time and synchronize the internal operations. Time factors play a crucial role in receiving and sending signals to Arduino and its peripherals. Based on crystal oscillator frequency microcontrollers can make decisions fast. Generally, most Arduino boards have a 16MHz crystal oscillator onboard with a name indicating 16.000H9H.

A voltage signal from a quartz resonator is given to the crystal oscillator circuit which generates oscillations according to it. Amplify the signal and feed it back to the quartz resonator.

Cut and size of quartz crystal determines the resonant frequency of quartz. Multiple sizes of crystal oscillators are available with frequencies ranging from MHz to GHz.

Function of Crystal Oscillator

Arduino uses two different microcontrollers one is Atmega328p which is the main controller while the second one Atmega16u2 specific for serial communication between Arduino and devices. Both microcontrollers have an internal clock of 8MHz but along with that both are equipped with a 16MHz of external clock.

Oscillator one with the serial interface microcontroller Atmega16u2 is known as Crystal oscillator and the main function behind using it despite an internal 8MHz is that crystal oscillators have high speed, greater efficiency and can complete instruction twice the speed.

If we investigate the datasheet of Atmega16u2 it can handle clock frequency of up to 20MHz so instead of using an internal clock Arduino uses an external crystal oscillator of 16MHz. More frequency will execute instructions faster, but it also consumes more power. It doesn’t mean that the Arduino cannot run without an external oscillator, by default the Arduino microcontroller is set to an external clock. You can easily configure the internal clock by setting fuses in the bootloader. To know more about this, click here.

Why Crystal Oscillator

Crystal oscillators are preferred over other clock sources because of their versatile nature. Following are some major highlights of an Arduino crystal oscillator.

  • Crystal oscillators are stable, can generate constant frequency under multiple conditions.
  • High Q factor which means crystal oscillators are slower to die out. Requires less energy to give constant frequency signals.
  • Frequency customization is possible which means cutting quartz with specific size and shape can give us a crystal oscillator with different frequencies.
  • Low phase noise.
  • Compact and inexpensive.

Conclusion

Arduino microcontrollers can use an internal source of clock or take clock signals from external oscillators such as crystal oscillator and ceramic resonator. Crystal oscillator in Arduino is 16MHz which helps the serial interface to build communication with devices. By default, Arduino is set to use external oscillators.

About the author

Kashif

I am an Electrical Engineer. I love to write about electronics. I am passionate about writing and sharing new ideas related to emerging technologies in the field of electronics.