Arduino projects

Arduino UNO full analysis

This article mainly introduces how the Arduino development board works from a hardware perspective.

Most articles cover Arduino software. However, a deeper understanding of its hardware design will help you take a solid step in your Arduino journey. Mastering the electronic design of Arduino hardware will help you learn how to embed Arduino into the design of the final product, including what parts should be kept and omitted from the original design.

Component Overview

The PCB design of the Arduino UNO development board uses all SMD (Surface Mount Device) components. I started to learn about SMD components when I was learning Arduino PCB design a few years ago, and I was re-designing a DIY clone of the Arduino UNO .

Integrated circuits use standardized packages and come in a variety of packaging styles.

The dimensions of many SMD resistors, capacitors and LEDs are indicated by the following package codes:

Arduino UNO  full analysis

SMD package codes for discrete components such as resistors, capacitors and inductors.

Most packages are generic and can be used for different parts with different functions. For example, a SOT-223 package can be a transistor or a voltage regulator.

Arduino UNO  full analysis

The following table lists some of the components used by Arduino UNO and their corresponding packages:

element
Encapsulation
NCP1117ST50T3G 5V Regulator SOT223
LP2985-33DBVR 3.3V Regulator SOT753 / SOT23-5
M7 diode SMB
LMV358IDGKR Dual Channel Amplifier MSOP08
FDN340P P-Channel MOSFET Transistor SOT23
ATmega16U2-MU MLF32

Arduino UNO System Overview

Before we learn about the UNO’s hardware, we must first get a general overview of the system.

After compiling the code using the Arduino IDE, it should be uploaded to the main microcontroller of the Arduino UNO through the USB connection. Since the main microcontroller does not have a USB transceiver, a bridge is required to convert the signals between the serial interface ( UART) of the microcontroller and the host USB signals.

The bridge in the latest version is an ATmega16U2, which has a USB transceiver and a serial interface (UART).

 

To power your Arduino board, you can use USB power. Another way is to use the DC jack. You may ask, “If I have both a DC adapter and USB connected, which one will be the power source?” The answer is discussed in the “Power Supply” section of this article.

To reset your board you should use the button on the board. Another reset source should be generated every time you open the serial monitor from the Arduino IDE.

I have re-purposed the original Arduino UNO schematic to make it more readable, as shown below.

Arduino UNO  full analysis

A redistributed version of the original Arduino schematic

Microcontroller

It is important to note that the Arduino board contains a microcontroller, and the microcontroller is what executes the instructions in the program. If you know this, you will never say something like “Arduino is a microcontroller” again.

The ATmega328 microcontroller is used as the main controller in the Arduino UNO R3. The ATmega328 is an MCU from the AVR series; it is an 8-bit device, which means that its data bus architecture and internal registers are designed to handle 8 parallel data signals.

The ATmega328 has three types of memory:

● Flash memory: 32KB of non-volatile memory. This is used to store the application, which explains why you don’t need to upload the application every time you unplug the arduino from the power source.

● SRAM memory: 2KB volatile memory. This is used to store variables used by the application at runtime.

● EEPROM memory: 1KB of non-volatile memory. This can be used to store data that must be available even after the board is powered off and then back on again.

Let’s briefly review the specifications of this MCU:

Encapsulation

The MCU is packaged in a DIP-28, which means it has 28 pins in a dual in-line package. These pins include power and I/O pins. Most of the pins are multi-function, which means that the same pins can be used in different modes depending on how you configure them in software. This reduces the number of necessary pins because the microcontroller does not need a separate pin for each function. It also makes your design more flexible because one I/O connection can provide multiple types of functions.

ATmega328 is also available in other packages such as TQFP-32 SMD package (Surface Mount Device).

Atmega328 has two different packages

power supply

The MCU supports a supply voltage of 1.8 to 5.5 V. However, there are restrictions on the operating frequency; for example, if you want to use the maximum clock frequency (20 MHz), a supply voltage of at least 4.5 V is required.

Digital I/O

This MCU has three ports: PORTB, PORTC, and PORTD. All pins of these ports can be used for general digital I/O or for alternate functions as indicated in the pinout below. For example, PORTC pins 0 to 5 can be ADC inputs instead of digital I/O.

There are also some pins that can be configured as PWM outputs. These pins are marked with a “~” on the Arduino board.

NOTE: The ATmega168 is almost identical to the ATmega328, and they are pin compatible. The difference is that the ATmega328 has more memory (32KB Flash, 1KB EEPROM, and 2KB RAM) compared to the ATmega168’s 16KB Flash, 512 Bytes EEPROM, and 1KB RAM.

Tmega168 pinout with Arduino labels; the ATmega168 and ATmega328 are pin-compatible.

 

Arduino UNO R3 Pinout.

ADC Input

This MCU has 6 channels – PORTC0 to PORTC5 – of A/D converter with 10-bit resolution. These pins are connected to the analog headers on the Arduino board.

A common mistake is to think of the analog inputs as inputs dedicated to A/D functionality because the headers in the board say “Analog.” The truth is, you can use them as either digital I/O or A/D.

ATmega328 block diagram.

As shown in the diagram above (via the red traces), the pins associated with the A/D unit are:

AVCC: Power supply pin for A/D unit.

AREF: An optional input pin if you want to use an external reference voltage for the ADC instead of the internal Vref. You can configure this using the internal registers.

Internal register setting to select Vref source.

UART Peripheral

UART (Universal Asynchronous Receiver/Transmitter) is a serial interface. ATmega328 has only one UART module.

The pins (RX, TX) of the UART are connected to the USB to UART converter circuit and to pin 0 and pin 1 in the digital header. If you are already using UART to send/receive data over USB, you must avoid using UART .

SPI peripherals

SPI (Serial Peripheral Interface) is another serial interface. The ATmega328 has only one SPI module.

In addition to using it as a serial interface, you can also program the MCU using a standalone programmer. You can access the SPI’s pins from the header next to the MCU in the Arduino UNO development board or from the digital header as shown below:

11 <-> MOSI

12 <-> MISO

13 <-> SCK

TWI

The I2C or TWI interface consists of two lines, serial data SDA and serial clock SCL.

You can access these pins through the last two pins of the digital header, or through pins 4 and 5 of the analog header.

Other Features

There are other features included in the MCU, such as those provided by the Timer/Counter module. You may not be aware of features that you are not using in your code. You can refer to the datasheet for more information.

Arduino UNO R3 MCU part.

Coming back to the electronics design, the microcontroller part has the following:

●    ATmega328-PU : The MCU we just talked about.

●    IOL and IOH (digital) headers : In addition to GND, AREF, SDA, and SCL, these are the digital headers for pins 0 to 13. Note that RX and TX from the USB bridge are connected to pins 0 and 1.

●    AD plug : plug for analog pins.

●    16 MHz ceramic resonator (CSTCE16M0V53-R0) : Connected to XTAL2 and XTAL1 of the MCU.

●    Reset pin : Pulled up by a 10K resistor, helps prevent false resets in noisy environments; this pin has an internal pull-up resistor, but according to the AVR Hardware Design Considerations application guide ( AVR042 ), “If the environment is too noisy, it may cause unwanted resets and resets may occur occasionally.” A reset occurs if the user presses the reset button or if the USB bridge sends a reset signal. You can also see a D2 diode. The purpose of this diode is described in the same application note: “If high-voltage programming is not used, it is recommended to add an ESD protection diode from RESET to Vcc, as this diode is not provided internally due to high-voltage programming.”

●    C4 and C6 capacitors (100nF) : These devices are added to filter power supply noise. The impedance of the capacitor decreases with frequency:

XC=12πfC

The capacitor provides a low impedance path to ground for high frequency noise signals. 100nF is the most common value.

●    PIN13 : Connected to the SCK pin of the MCU and also connected to the LED. The Arduino development board uses a buffer (LMV358) to drive the LED.

●    ICSP header (In-Circuit Serial Programming): used to program the ATmega328 using an external programmer. It connects to the In-System Programming (ISP) interface (using the SPI pins). Normally, you do not need to use this programming method because the bootloader handles the programming of the MCU through the UART interface connected to the USB using a bridge. This header is only used when programming a bootloader to the MCU for the first time in production.

USB to UART Bridge

Arduino USB bridge section.

 

As we discussed in the section “Arduino UNO System Overview”, the role of the USB to UART bridge section is to use the ATmega16U2 with its internal USB transceiver to convert the signals of the USB interface into a UART interface that the ATmega328 can recognize. This is done by using special firmware uploaded to the ATmega16U2.

From an electronic design perspective, this section is similar to the microcontroller section. The MCU comes with an ICSP header, an external crystal with load capacitors (CL), and Vcc filter capacitors.

Note that there are series resistors in the D+ and D- USB lines. These provide the correct termination impedance for the USB signals. Here is some further reading about these resistors:

1.    Why does USB data require a series resistor?

2.    USB Developer FAQ

Z1 and Z2 are varistors (VDR). They are used to protect the USB lines from ESD transient pulses.

The 100nF capacitor in series with the reset line allows the Atmega16U2 to send a reset pulse to the Atmega328. You can read more about this capacitor at this link .

power supply

For power, you can choose to use USB or DC jack. Now it’s time to answer the question: “If I connect both the DC adapter and USB, which one will be the power source?”

The 5V regulator is NCP1117ST50T3G , and the Vin of the regulator is connected to the DC socket input through an M7 diode (SMD version of IN4007 diode ). The diode provides reverse protection.

The output of the 5V regulator is connected to the rest of the 5V network in the circuit and also to the input of the 3.3V regulator LP2985-33DBVR . You can connect the 5V directly from the power socket 5V pin.

Another source of 5V is USBVCC, which is connected to the drain of the FDN340P , a P-channel MOSFET with the source connected to the 5V network. The gate of the transistor is connected to the output of the LMV358 op-amp which is used as a comparator. The comparison is between 3V3 and Vin/2. When Vin/2 is larger, this will produce a high output of the comparator and the P-channel MOSFET is turned off. If Vin is not applied, the V+ of the comparator is pulled down to GND and Vout is low, causing the transistor to turn on and USBVCC to be connected to 5V.

Power switching mechanism.

 

The LP2985-33DBVR is a 3V3 regulator. Both the 3V3 and 5V regulators are LDO (Low Dropout), which means they can regulate voltage even when the input voltage is close to the output voltage. This is an improvement over older linear regulators, such as the 7805.

Lastly, I will talk about the power protection provided in the Arduino UNO.

As mentioned above, VIN from the DC jack is protected from reverse by using the M7 diode in series at the input. Note that the VIN pin in the power plug is not protected. This is because it is connected after the M7 diode. Personally, I don’t know why they decided to connect it before the diode to provide the same protection.

VIN pin of the power plug.

When you use USB as power and to provide protection for your USB port, there is a PTC (Positive Temperature Coefficient) fuse (MF-MSMF050-2) in series with USBVCC. This provides over-current protection, 500mA. When the over-current limit is reached, the PTC resistance increases. The resistance drops after the over-current is removed.

It was very useful to read the Rugged Circuits post about Arduino protection .

You should now be more familiar with electronic design with the Arduino UNO and have a better understanding of its hardware. I hope this helps you in your future design projects!

VIN pin of the power plug.


When you use USB as power and to provide protection for your USB port, there is a PTC (Positive Temperature Coefficient) fuse (MF-MSMF050-2) in series with USBVCC. This provides over-current protection, 500mA. When the over-current limit is reached, the PTC resistance increases. The resistance drops after the over-current is removed.

It was very useful to read the Rugged Circuits post about Arduino protection .


You should now be more familiar with electronic design with the Arduino UNO and have a better understanding of its hardware. I hope this helps you in your future design projects!


This article is translated from Understanding Arduino UNO Hardware Design . Thanks to Yahya Tawil for his contribution. If there are any errors or omissions, please correct them.

 


Back to top button