Arduino · A000005

Arduino Nano

Arduino Nano: an ATmega328P (8-bit AVR, 16 MHz) at 5 V on a breadboard stick, with a USB-serial chip.

AVR (C)Arduino
Arduino NanoArduino · ATmega328P · AVR · 16 MHz · 2 KB · bare metal123456781usb USBMini-USB (power, uploads, serial)2pwr Power5 V USB, or 7 V to 12 V on VIN3v3v3 Power3V3 pin (from the USB-serial chip)4v5 Power5V pin (from USB)5gnd PowerGND6uart0 UARTUSART0 (D1, D0: the USB serial too) · tx PD1,rx PD07i2c0 I²CTWI, the I²C (A4, A5) · sda PC4, scl PC58spi0 SPISPI (D13, D11, D12, D10) · sck PB5, mosi PB3,miso PB4, cs PB223 GPIO pins, each a port (led, …)

In short

The UNO's chip on a breadboard stick: an ATmega328P at 16 MHz, 32 KB flash, 2 KB SRAM, 5 V pins. 14 digital pins (6 PWM) and 8 analog inputs (A6 and A7 analog only).

Clock16 MHz
Flash32 KB
RAM2 KB
GPIO20
Logic5 V

Specs

From the board’s model in the store.

Processor
ATmega328P · 1× AVR · chip "atmega328p"
Clock
16 MHz
Flash
32 KB
RAM
2 KB
GPIO pins
20
ADC
ADC 8 ch 10-bit
Logic level
5 V
Power
5 V USB, or 7 V to 12 V on VIN (in); 3V3 pin (from the USB-serial chip): 3.3 V (≤ 50 mA); 5V pin (from USB): 5 V (≤ 500 mA)
Current per pin
20 mA
Buses
UART ×1, I²C ×1, SPI ×1
Runs
bare metal (no OS)

Pin map

Each pin by what it does. Hover or tap a pin to see what else it can be.

  • Power 3
  • Ground 1
  • Digital 8
  • Analog 6
  • Bus 6
  • Control 2
  • PD0D0 (RX)
  • PD1D1 (TX)
  • PD2D2 (INT0)
  • PD3D3 (PWM, INT1)
  • PD4D4
  • PD5D5 (PWM)
  • PD6D6 (PWM)
  • PD7D7
  • PB0D8
  • PB1D9 (PWM)
  • PB2D10 (PWM, SS)
  • PB3D11 (PWM, MOSI)
  • PB4D12 (MISO)
  • PB5D13 (SCK, LED L)
  • PC0A0
  • PC1A1
  • PC2A2
  • PC3A3
  • PC4A4 (SDA)
  • PC5A5 (SCL)
  • ADC6A6 (analog only)
  • ADC7A7 (analog only)
  • pwr5 V USB, or 7 V to 12 V on VIN
  • v3v33V3 pin (from the USB-serial chip)
  • v55V pin (from USB)
  • gndGND

Watch out

What archec checks for this board, from its data. Each one names the check that catches it.

  • Its pins give 5 V. A 3.3 V part on one of them needs a level shifter between them.

    check pin-level

  • One pin gives at most 20 mA. An LED needs a resistor; a motor or a relay needs a driver.

    check pin-current

  • Two of the board’s connectors share these pins: PB5 (LED L (D13) / SPI (D13, D11, D12, D10) / D13 (SCK, LED L)), PD1 (USART0 (D1, D0: the USB serial too) / D1 (TX)), PD0 (USART0 (D1, D0: the USB serial too) / D0 (RX)), PC4 (TWI, the I²C (A4, A5) / A4 (SDA)), PC5 (TWI, the I²C (A4, A5) / A5 (SCL)), PB3 (SPI (D13, D11, D12, D10) / D11 (PWM, MOSI)), PB4 (SPI (D13, D11, D12, D10) / D12 (MISO)), PB2 (SPI (D13, D11, D12, D10) / D10 (PWM, SS)). Use one or the other.

    check pin-conflict

  • The board already uses PB5 (LED L (D13)), PD0 (D0 (RX)), PD1 (D1 (TX)), PD2 (D2 (INT0)), PD3 (D3 (PWM, INT1)), PD4 (D4), PD5 (D5 (PWM)), PD6 (D6 (PWM)), PD7 (D7), PB0 (D8), PB1 (D9 (PWM)), PB2 (D10 (PWM, SS)), PB3 (D11 (PWM, MOSI)), PB4 (D12 (MISO)), PB5 (D13 (SCK, LED L)), PC0 (A0), PC1 (A1), PC2 (A2), PC3 (A3), PC4 (A4 (SDA)), PC5 (A5 (SCL)). Something else wired there fights with it.

    check pin-conflict

  • The 3V3 pin (from the USB-serial chip) gives at most 50 mA at 3.3 V. Add up what you power from it.

    check board-current

  • The 5V pin (from USB) gives at most 500 mA at 5 V. Add up what you power from it.

    check board-current

  • It gives 3.3 V (3V3 pin (from the USB-serial chip)), 5 V (5V pin (from USB)). Power each part from a rail at its own voltage.

    check board-supply

  • It has 1 UART, 1 I²C, 1 SPI. One more bus of a kind than that is an error.

    check board-peripheral

  • Each bus goes on the pins that can carry it (see the pin map). Another pin is an error.

    check pin-function

First model

A blink for this board: the board, an LED and a part that turns it over every 500 ms. archec checks it, then writes the code on the right.

main.archeOpen in the playground
project Blink "Blink" {
  version "0.1.0"
  edition "1.0"
  uses arche-hw-store "^0.1"
}

include "arche-hw-store/boards/arduino-nano/arduino-nano.arche"
include "arche-hw-store/devices/led/led.arche"

/// Turns the LED over at each step.
component Blinker "Blinker" {
  out led: requires Led
  fn blink "Blink" {
    ```arche
    led.toggle()
    ```
    wcet 50us
  }
}

/// The board, an LED on the board's LED L (D13) (PB5), and the blinker.
system Hw "Blink" {
  part board:   ArduinoNano
  part led:     GpioLed { in pin { pins { pin PB5 } } }
  part blinker: Blinker
  blinker.led -> led.led
}

/// The firmware: the blinker every 500 ms.
deployment OnBoard "On the board" {
  system Hw
  platform Hw
  binary blink on board {
    thread main "Blink" { runs blinker; period 500ms; step blink }
  }
}
archec gen --target cblinker.c
/* Generated by archec: component Blinker. Do not edit outside the USER CODE regions: run `archec gen --target c` again, it keeps them. */
#include "blinker.h"
#include "arche_rt.h"
#include <math.h>
/* USER CODE BEGIN Blinker.includes */
/* USER CODE END Blinker.includes */

/* @arche Blinker.init main.arche:11 init */
void blinker_init(blinker_t *self)
{
    (void)self;
    /* USER CODE BEGIN Blinker.init */
    /* USER CODE END Blinker.init */
}

/* @arche Blinker.blink main.arche:13 fn */
void blinker_blink(blinker_t *self)
{
    blinker_call_led_toggle(self);
}

blinker.c, one of the 18 files archec writes.

Open in the playground

Parts on the board

What each numbered part is. Click a number to find it on the board.

1 2 3 4 5 6 7 8 9 10 11

Find the part

The quiz names a part: click it on the board. A first try scores a point.

Compare every board