In previous part of this post, we have seen what is on board of Arduino Uno, Its schematic, surface mount devices used on board, microcontroller section, Its available different packages and its block diagram with some feature details. In this article we’ll continue with some more features of ATmega microcontrollers like peripherals on board like ADC/UART etc. We’ll also cover Power Section and USB bridge section details.
Overview of Arduino Uno Hardware – Continued…
There are several more important features of Arduino boards, let us see those one by one with details.
3. Peripherals
- ADC (Analog to Digital Converter) = 6CH 10-bit
- Programmable Serial USART
- Master/Slave SPI Serial Interface
- Byte-oriented 2-wire Serial Interface (Philips I 2 C compatible)
- Timer/Counters = Two 8-bit and one 16-bit
- PWM Channels = 6
ADC (Analog to Digital Converter)
ADC is one of the most important feature of MCU which helps to process the physical quantities such as temperatures, Pressure etc. This MCU has 6-channel 10-bit ADC in PDIP Package. PORTC0 to PORTC5 connected to 10-bit resolution A/D converter. These pins are connected to the Analog header on the Arduino board.
Note = Even though the name of header is ‘Analog header’ of Arduino, it can be used for both A/D purpose. There is one common misconception is to think of analog input as dedicated input for A/D function only, as the header in the board states” Analog”. But the reality is that you can use them as digital I/O or A/D.
As shown in the diagram above (via the red traces), the pins related to the A/D unit are: AVCC, AREF, GND, PC[0-6] and ADC[6-7]
- AVCC: The power pin for the A/D unit.
- AREF: The input pin used optionally if you want to use an external voltage reference for ADC rather than the internal Vref.
- We can configure that using an ADC Multiplexer Selection Register, as shown in image here.
UART (Serial Interface)
A UART (Universal Asynchronous Receiver/Transmitter) is a serial interface. The ATmega328 has only one UART module.
Note : The pins (RX, TX) of the UART are connected to a USB-to-UART converter circuit and also connected to pin0 and pin1 in the digital header. You must avoid using the Hardware UART if you’re already using it to send/receive data over USB. We can also use (bit banging) software Serial in such cases.
SPI (Serial Peripheral Interface)
The SPI (Serial Peripheral Interface) is another serial interface. The ATmega328 has only one SPI module.
Note : Besides using it as a serial interface, it can also be used to program the MCU using a standalone programmer.
You can reach the SPI’s pins from the header next to the MCU in the Arduino UNO board or from the digital header as below:
Pin 11<->MOSI ; Pin 12<->MISO ; Pin 13<->SCK ; Pin10<->SS
Two Wire Interface (TWI)
The I2C or Two Wire Interface is an interface consisting of only two wires, serial data, and a serial clock: SDA, SCL.
You can reach these pins from the last two pins in the digital header or pin4 and pin5 in the analog header.
We can see all above mentioned peripherals and its pin configurations in following image of Arduino Uno R3 pinout,
4. Other Important functions and parts
Other important part includes Headers -IOL-IOH, ICSP, Reset Pin functioning etc. You may not be aware about the functions those you usually do not use in programming such as In circuit programming function. Lets explore these functionalities in this section.
IOL and IOH Headers
These headers are the digital header for pins 0 to 13 in addition to GND, AREF, SDA, and SCL. Note that RX and TX from the USB bridge are connected with pin0 and pin1.
Note: There is gap between headers on board, it was not intentional “Basically it was a mistake on the first PCB and they have kept it so that the shields would be compatible with future models.” And it also works as a key, To help in preventing user from connecting the shields in the wrong way.
Reset Pin
Reset Pin is pulled up with a 10K resistor (recommended >4.7kOhm) to help prevent spurious resets in noisy environments; the pin has an internal pull-up resistor, but according to the AVR Hardware Design Considerations application note (AVR2519),
“if the environment is noisy, it can be insufficient and reset may occur sporadically.” Reset occurs if the user presses the reset button or if a reset is issued from the USB bridge. You can also see the D2 diode. The role of this diode is described in the same app note: “If not using High Voltage Programming it is recommended to add an ESD protection diode from RESET to Vcc, since this is not internally provided due to High Voltage Programming HVPP”.
C4 and C6 100nF Capacitors
These are added to filter supply noise. The impedance of a capacitor decreases with frequency:
Xc = 1/2πfC
The capacitors give high-frequency noise signals a low-impedance path to ground. 100nF is the most common value.
ICSP (In-Circuit Serial Programming) Header
This is used to program the ATmega328 using an external programmer. It’s connected to the In-System Programming (ISP) interface (which uses the SPI pins). Usually, you don’t need to use this way of programming because bootloader handles the programming of the MCU from the UART interface which is connected using a bridge to the USB. This header is used when to flash the MCU, for example, with a bootloader for the first time in production.
Pin 13
This is connected to the SCK pin from the MCU and is also connected to an LED. The Arduino board uses a buffer (the LMV358) to drive the LED.
16 MHz Ceramic Resonator (CSTCE16M0V53-R0): Connected with XTAL2 and XTAL1 from the MCU.
AD Header: The analog pins header.
Power Section
We can power Arduino Uno in different ways as following
- Using USB Port: 5 V
- JAPAN JACK socket 7-12V
- Vin socket: this socket has a dual function. Cannot be used simultaneously with input JAPAN Jack. Otherwise dangerous conflict may arise. in fact the connection goes directly to the regulator’s input and below the JACK socket’s diode.
- (5 V) socket: it is directly connected to the regulator’s output. In the case voltages are not applied to the USB Port or to the JACK socket, the 5 V socket can be even used to power Arduino directly, if having an external stabilized 5 V source.
NOTE: regardless of the input used, Arduino has a 3.3 V output socket to power loads operating at this voltage. In fact a second regulator, right for the purpose of generating 3.3 V, is directly connected to the 5 V. This socket cannot be used as input.
The 5V regulator is the NCP1117ST50T3G and the Vin of this regulator is connected via DC jack input through the M7 diode which is SMD version of 1N4007. This diode provides reverse-polarity protection to circuit.
As mentioned above, VIN from a DC jack is protected from reverse polarity by using a serial M7 diode in the input. Be aware that the VIN pin in the power header is not protected. This is because it is connected after the M7 diode.
The output of the 5V regulator is connected to the rest of 5V net in the circuit and also to the input of the 3.3V regulator, LP2985-33DBVR. You can access 5V directly from the power header 5V pin.
Power Conflict Management
- Another source of 5V is USBVCC which is connected to the drain of an FDN340P, a P-channel MOSFET, and the source is connected to the 5V net. The gate of the transistor is connected to the output of an LMV358 op-amp used as a comparator.
- The comparison is between 3V3 and Vin/2. When Vin/2 is larger, this will produce a high output from the comparator and which is applied to the P-channel MOSFET hence it will get off.
- If there is no Vin applied, the V+ of the comparator is pulled down to GND and hence Vout gets low, such that the transistor is on and the USBVCC is connected to 5V.
The LP2985-33DBVR is the 3V3 regulator. Both the 3V3 and 5V regulators are LDO (Low Dropout), which means that they can regulate voltage even if the input voltage is close to the output voltage.
When we use USB as a power source, and to provide protection for your USB port, there is a PTC (positive temperature coefficient) fuse (MF-MSMF050-2) in series with the USBVCC. This provides protection from overcurrent, 500mA. When an overcurrent limit is reached, the PTC resistance increases a lot. Resistance decreases after the overcurrent is removed.
USB Bridge Section
- Main purpose of the USB-to-UART bridge part is to convert the signals of USB interface to the UART interface, which the ATmega328 understands, using an ATmega16U2 with an internal USB transceiver. This is done using special firmware uploaded to the ATmega16U2.
- This MCU also has an separate ICSP header, an external crystal with load capacitors (CL), and a Vcc filter capacitor.
- Notice that there are series resistors in the D+ and D- USB lines. These provide the proper termination impedance for the USB signals. Z1 and Z2 are voltage-dependent resistors (VDRs), also called varistors. They are used to protect the USB lines against ESD transients.
- The 100nF capacitor connected in series with the reset line allows the Atmega16U2 to send a reset pulse to the Atmega328.