The Arduino Nano is one of the most popular microcontroller development boards used by electronics hobbyists and professionals alike. Despite its small size, the Nano packs an impressive set of capabilities through its various pins and ports.

In this comprehensive 2600+ word guide, we will explore:

  • Key technical specs of the Arduino Nano
  • Detailed functionality available through each pin group
  • Internal hardware architecture powering the Nano
  • Comparisons with other Arduino boards
  • Usage guidance with sample circuits and code
  • Additional learning resources

So if you want to truly master the Arduino Nano, its pinout configuration and harness its full potential for your own projects – read on!

Overview of the Arduino Nano Board

The Arduino Nano is designed around the ATmega328P microcontroller chip, which serves as the brain of this small but mighty board. The ATmega328P also powers Arduino‘s popular Uno board. Here are some key specs:

Microcontroller
ATmega328P running at 16MHz with external resonator

Operating Voltage
5V

Input Voltage Limits
7-12V

Digital I/O Pins
14 (of which 6 provide PWM output)

Analog Input Pins
8

Flash Memory
32 KB

SRAM
2 KB

EEPROM
1 KB

Length x Width
18 x 45 mm

Weight
Less than 10 grams

The ATmega328P comes from Atmel‘s megaAVR line and has a modified Harvard architecture. This means it has separate memories and buses for program instructions and data. We will unravel the significance of this internal structure as we discuss the Nano‘s pin capabilities.

Power Pins

As with any electronic device, the Arduino Nano needs power to operate. Power can be supplied via the Vin, 5V or 3.3V pins using the onboard voltage regulator. There are also two GND pins for ground.

Vin Pin

The Vin pin can supply operational input voltage to the Nano ranging from 7-12V DC. Typical sources include:

  • AC to DC wall adapter providing 9V or 12V
  • A 7.4V LiPo rechargeable battery pack
  • An 11.1V LiFePO4 battery

The input voltage passes through an onboard linear voltage regulator to generate a steady 5V output for the Nano‘s operation.

Vin pin supplying power to Arduino Nano

The Vin pin accepts 7-12V input to power the Nano

A word of caution when supplying voltage via Vin – always provide at least 3V more than whatever 5V output you need for stable operation. For example, for a 5V/500mA draw, input at least 8V through Vin. Lower differences risk unstable output.

The input regulator can deliver up to 800mA peak current before overheating. So the Vin pin allows flexibility powering moderately high current draws.

5V Pin

For lower current requirements, the 5V pin gives a regulated supply straight from the output of the onboard voltage regulator. This bypasses battery input limitations to provide a steady 5V/500mA to external circuits.

5V Output from Arduino Nano

The 5V pin offers easy access to the onboard 5V regulator output

Since the 5V pin taps the output instead of the input side, noise and fluctuations are lower compared to Vin. Use this pin to power clean sensitive analog circuits.

3.3V Pin

For supplying power to components tolerant of lower 3.3V operation, the 3.3V pin offers a handy source. This can power ESP8266 WiFi modules, accelerometers, gyroscopes and some ADC/DAC ICs.

Note: The 3.3V supply draws from the 5V regulator via a secondary onboard regulator. This limits the available current to 50mA – sufficient for powering a few ICs but not for driving motors or multiple modules.

GND Pins

Every circuit needs ground references and the Nano provides two GND pins for the same. These connect internally to the power supply ground. Connect both digital and analog components to these GND pins for completing their ground returns.

The GND pins offer convenient common ground access instead of attempting to probe tiny individual paths – helping keep projects compact.

Digital I/O Pins

Let‘s move on to the digital input/output pins which enable the Nano to interface with a variety of sensors, drivers and external circuits.

Capabilities Overview

The 14 digital pins labeled D0 through D13 serve for both digital input and digital output functions. Since these connect directly to ports integrated into the ATmega328P microcontroller, they can be software configured for specialized roles.

Here are some key capabilities:

Input/Output Voltages
5V (TTL logic levels)

Output Current per Pin (Sink/Source)
40mA

Total Output Current across all I/O Pins
200mA

Input Capacitance
10 pF typical

Clock Frequency
16 MHz

Multiple pins share the total output current budget of 200mA – allowing high drive simultaneously across few selected pins. The 40mA individual limit allows directly driving small LEDs, transistors, sensor modules etc. without needing driver buffers.

Now let‘s understand the unique functions of specific digital pins labeled D0-D13:

Serial Pins (D0, D1)

The D0 and D1 pins connect to the RX and TX UARTs of the ATmega‘s built-in hardware USART interface. This enables serial data send/receive through just two wires connected to a computer or other serial device.

D0 -> RX: Receives TTL serial data

D1 -> TX: Transmits TTL serial data

This built-in serial interface works in conjunction with the USB-UART chip onboard enabling easy communication with the PC for debugging, programming and serial data transfer.

External Interrupts (D2, D3)

The D2 and D3 pins connect to External Interrupt inputs of the ATmega328P. These can trigger interrupts on:

  • Rising signal edge
  • Falling signal edge
  • Low level
  • Pin value change

As an example, a rotary encoder with dedicated A/B outputs can connect via D2 and D3. The code can check each pulse to update counter variables tracking position. Using pin change interrupts eliminates constant polling resulting in efficient utilization of the CPU for other tasks.

PWM Pins (D3, D5, D6, D9, D10, D11)

A key capability of several digital pins is pulse-width modulation (PWM) for variable analog-like output. This works by toggling the pin voltage high/low very fast and controlling the percentage of ON time.

Capabilities of these 6 PWM pins are:

Resolution
8-bit -> 255 levels

Frequency
490 Hz

For example, changing the duty cycle from 0% being always low (0V) to 100% being always high (5V) gives the full range from off to maximum brightness when driving an LED. 128 (50%) turns it on half brightness. This mimics an analog output.

Intermediate levels allow controlling servos and motor speed controllers. Typically you can control the position of a servo motor connected to a PWM pin using values between 1000-2000 μs pulse widths updating 50 times a second.

SPI Pins (D10-D13)

D10-D13 connect to the hardware SPI (Serial Peripheral Interface) engine in the ATmega328P supporting high speed synchronous data transfer with external devices like sensors, SD card modules and A/D converters.

The SPI uses 4 lines common across devices:

D10 (SS)
Slave Select

D11 (MOSI)
Master Out Slave In

D12 (MISO)
Master In Slave Out

D13 (SCK)
Serial Clock

For example, reading acceleration data from the MPU6050 gyro+accel sensor uses the hardware SPI pins instead of bit banging GPIOs manually. The master (Nano) selects each slave device using SS, sends clock pulses via SCK and exchanges data with MOSI + MISO lines.

LED Pin (D13)

Amongst the 14 digital pins, D13 stands out by having an onboard LED connected to it for visual feedback and testing during program debugging/development.

Toggling D13 high/low turns the LED on/off providing visual response without needing an external LED wired up. The majority of example sketches available include some form of LED toggling for quick validation when trying out the Arduino Nano for the first time.

Analog Input Pins

While the 14 digital pins discussed above provide binary on/off outputs, the Analog Input pins enable reading a full range of voltages making them ideal for connecting sensors.

ADC Capabilities

The 8 analog input pins labeled A0 through A7 connect to channels of the ATmega328P‘s inbuilt 10-bit successive approximation ADC via multiplexer.

Here are the ADC capabilities accessible through these analog input pins:

Resolution
10 bits = 1024 levels (0-1023)

Full Scale Input Voltage
0V to Vref (5V or AREF)

Conversion Time
104 μs

The higher resolution of 10-bit vs 8-bit for PWM allows discerning smaller changes in sensor signals. As an example, reading voltage from a force sensor strip to measure weight or a thermistor to measure temperature.

The successive approximation conversion first compares input against 50% of Vref giving the MSB. It then recursively compares the lower bits against upper bits, taking just 104 μs even for 10-bits. Faster than integrating types like deltasigma ADC.

Two analog reference voltage options set the upper limit of 0-1023 ADC outputs:

5V: Gives 200mV per step resolution for 0-5V input
External AREF: Apply up to 5V reference for gaining resolution

I2C Pins (A4/A5)

Amongst the several analog input pins, two special pins A4 and A5 support TWI/I2C communication using the on-chip Wire module.

A4 -> SDA (Data)
A5 -> SCL (Clock)

I2C uses just two wires allowing communicating with multiple external devices/sensors using device addresses embedded in data packets sent over the shared SDA line, while SCL provides the clock.

For example, connecting OLED or SSD1306 type dot matrix graphical displays uses I2C communication via the A4 and A5 pins. Other examples include sensors, EEPROMs, LED drivers etc.

AREF Pin

While the analog inputs by default use the ATmega‘s Vcc as the reference voltage (5V board), you can optionally connect an external lower reference voltage to the AREF pin.

For example, applying a precise 2.5V voltage reference reduces the input range giving higher input resolution – each ADC step represents ~2.44mV instead of ~4.88mV for 0-5V. This external reference applies to all analog input pins from A0-A7 when enabled through code.

Comparison with Arduino Uno and Mega

The Arduino Nano builds on the popularity and extensibility of its Uno and Mega cousins by packing similar capabilities into a smaller footprint. Let‘s contrast some differences:

Arduino Uno

Larger board dimensions ~2.7" x 2.1"
6 PWM pins vs Nano‘s 6
Single hardware serial vs Nano‘s one UART
Similar 5V operation and IO capabilities
No power out pins like Nano‘s 5V

Arduino Mega

Much bigger board ~4" x 2.1"
15 PWM pins vs 6 on Nano
4 hardware serial UARTs vs 1 on Nano
More GPIOs (54), RAM, Flash and EEPROM

Where board space is limited, or portability needed, the Nano triumphs with no real impact on core features. Its richer input pinout including regulated 3.3V/5V outputs adds greater usage flexibility. Easily pair it with wireless modules for building IoT prototypes.

For more demanding projects however, the Mega clearly outpaces the Nano in resources – but you pay the price in substantially larger footprint and power draws!

Sample Circuits

Now that we have toured the capabilities of the various Nano pins, let‘s look at a couple of sample circuits to see the pins in action.

Circuit 1 – Blink LED

This simple example demonstrates using the D13 onboard LED plus an external LED connected to a digital GPIO pin to blink alternatively. The dual blink pattern validates both pin types working for digital output.

Blink two LEDs using Arduino Nano

Here is the Arduino sketch code driving the blink behavior:

void setup() {

  // Initialize D7 output  
  pinMode(7, OUTPUT);
}

void loop() {

  digitalWrite(13, HIGH); // Turn on D13 LED
  digitalWrite(7, LOW);  // Turn off external LED

  delay(500);

  digitalWrite(13, LOW); // Turn off D13 LED
  digitalWrite(7, HIGH); // Turn on external LED

  delay(500);  
}

The built-in LED turns on/off every 500ms, while the external LED does the opposite mimicking a heartbeat type dual blink pattern.

Circuit 2 – Read Analog Sensor

Let‘s monitor temperature information from an analog thermistor sensor using the ADC.

Read analog temperature sensor

Here is an excerpt focusing on the analogRead() of sensor voltage on A0 pin and Serial.println() for display:

void loop() {

  // Read analog voltage on A0  
  sensorVoltage = analogRead(A0); 

  // Convert voltage to temperature
  tempC = ThermistorVoltageToTemp(sensorVoltage); 

  // Display temperature value 
  Serial.println(tempC);

  delay(500);
}

The analog input capability allows measuring the variable resistance across the thermistor due to temperature change. The ADC provides the needed resolution to discern minute signal changes.

Additional Resources

Hopefully you now feel equipped to fully utilize the various capabilities of the Arduino Nano pins for your own electronics projects. Here are some additional resources for even deeper knowledge:

Nano Pin Mapping: Detailed diagrams showing ATmega328P internal hardware connectivity to each pin
ATmega328P Datasheet: In-depth technical reference covering the internal hardware blocks and capabilities
AVRGCC Programming: Details about the AVR GCC toolchain, register usage and low level access
Example Sketches: Collection of sample sketches showing usage of different Nano pins and capabilities

The Nano punches way above its weight when it comes to flexibility! Spend time harnessing its pins‘ functions shown here and you will reap rich rewards in your creative journey of building electronic prototypes.

Similar Posts

Leave a Reply

Your email address will not be published. Required fields are marked *