Provides comprehensive pinout reference, board specifications, and TinyGo development guide for the Arduino Nano (ATmega328P) microcontroller. Use when writing TinyGo firmware for the Arduino Nano, wiring peripherals, or configuring pins. Keywords: Arduino, Nano, ATmega328P, AVR, TinyGo, pinout, GPIO, I2C, SPI, UART, analog, digital, PWM, 5V, 8-bit, breadboard, Mini-B USB, compact.
Provides comprehensive reference for developing TinyGo firmware for the Arduino Nano (ATmega328P).
Arduino-Nano-Arduino skillArduino-UnoR3-TinyGo skill (same MCU, different form factor)Arduino-Mega2560-TinyGo skill| Parameter | Value |
|---|---|
| MCU | ATmega328P |
| Architecture | 8-bit AVR |
| Clock Speed | 16 MHz |
| Flash | 32 KB (2 KB used by bootloader) |
| SRAM | 2 KB |
| EEPROM | 1 KB |
| USB | Mini-B USB |
| Operating Voltage | 5V |
| Input Voltage (VIN) | 7–12V recommended |
| DC Current per I/O Pin | 20 mA |
| Dimensions | 45 × 18 mm |
| Weight | 7 g |
| Digital I/O | 14 (D0–D13) |
| PWM Outputs | 6 (D3, D5, D6, D9, D10, D11) |
| Analog Inputs | 8 (A0–A7; A6/A7 are analog-only) |
| Built-in LED | D13 |
[Mini-B USB]
┌─────────────────────┐
│ │
D13 ──┤ D13 D12 ├── D12
3.3V ──┤ 3V3 D11 ├── ~D11 / MOSI / PWM
AREF ──┤ AREF D10 ├── ~D10 / SS / PWM
A0/D14 ──┤ A0 D9 ├── ~D9 / PWM
A1/D15 ──┤ A1 D8 ├── D8
A2/D16 ──┤ A2 D7 ├── D7
A3/D17 ──┤ A3 D6 ├── ~D6 / PWM
SDA/A4/D18 ──┤ A4 D5 ├── ~D5 / PWM
SCL/A5/D19 ──┤ A5 D4 ├── D4
A6 (analog) ┤ A6 D3 ├── ~D3 / PWM / INT1
A7 (analog) ┤ A7 D2 ├── D2 / INT0
5V ──┤ 5V GND ├── GND
RESET ──┤ RST RST ├── RESET
GND ──┤ GND D0 ├── RX
VIN ──┤ VIN D1 ├── TX
│ │
└─────────────────────┘
~ = PWM capable INT = External interrupt
A6/A7 = Analog input ONLY (no digital I/O)
| Pin | Digital | Analog | PWM | Interrupt | SPI | I2C | UART | Other |
|---|---|---|---|---|---|---|---|---|
| D0 | ✓ | — | — | — | — | — | RX | — |
| D1 | ✓ | — | — | — | — | — | TX | — |
| D2 | ✓ | — | — | INT0 | — | — | — | — |
| D3 | ✓ | — | ✓ | INT1 | — | — | — | — |
| D4 | ✓ | — | — | — | — | — | — | — |
| D5 | ✓ | — | ✓ | — | — | — | — | — |
| D6 | ✓ | — | ✓ | — | — | — | — | — |
| D7 | ✓ | — | — | — | — | — | — | — |
| D8 | ✓ | — | — | — | — | — | — | — |
| D9 | ✓ | — | ✓ | — | — | — | — | — |
| D10 | ✓ | — | ✓ | — | SS | — | — | — |
| D11 | ✓ | — | ✓ | — | MOSI | — | — | — |
| D12 | ✓ | — | — | — | MISO | — | — | — |
| D13 | ✓ | — | — | — | SCK | — | — | Built-in LED |
| A0 | ✓ | ADC0 | — | — | — | — | — | — |
| A1 | ✓ | ADC1 | — | — | — | — | — | — |
| A2 | ✓ | ADC2 | — | — | — | — | — | — |
| A3 | ✓ | ADC3 | — | — | — | — | — | — |
| A4 | ✓ | ADC4 | — | — | — | SDA | — | — |
| A5 | ✓ | ADC5 | — | — | — | SCL | — | — |
| A6 | — | ADC6 | — | — | — | — | — | Analog only |
| A7 | — | ADC7 | — | — | — | — | — | Analog only |
| Pin | Function |
|---|---|
| VIN | Input voltage (7–12V recommended) |
| 5V | Regulated 5V output |
| 3.3V | Regulated 3.3V output |
| GND | Ground |
| AREF | Analog reference voltage |
| RESET | Reset (active LOW) |
arduino-nano
tinygo info -target=arduino-nano
# Build only
tinygo build -target=arduino-nano -o firmware.hex ./main.go
# Build and flash (board must be connected via USB)
tinygo flash -target=arduino-nano ./main.go
# Monitor serial output
tinygo monitor -target=arduino-nano
machine.I2C0)machine.SPI0)machine.UART0)println() insteadfmt alone can exceed flashmachine.UART0package main
import (
"machine"
"time"
)
func main() {
led := machine.D13 // Built-in LED
led.Configure(machine.PinConfig{Mode: machine.PinOutput})
for {
led.High()
time.Sleep(500 * time.Millisecond)
led.Low()
time.Sleep(500 * time.Millisecond)
}
}
machine.I2C0i2c := machine.I2C0
err := i2c.Configure(machine.I2CConfig{
SDA: machine.SDA_PIN, // A4
SCL: machine.SCL_PIN, // A5
Frequency: 100000, // 100 kHz (standard mode)
})
if err != nil {
println("I2C init failed:", err)
}
// Write to device
data := []byte{0x00, 0x01}
i2c.Tx(0x3C, data, nil)
// Read from device
buf := make([]byte, 2)
i2c.Tx(0x3C, []byte{0x00}, buf)
machine.SPI0spi := machine.SPI0
err := spi.Configure(machine.SPIConfig{
SCK: machine.D13,
SDO: machine.D11, // MOSI
SDI: machine.D12, // MISO
Frequency: 4000000, // 4 MHz
})
if err != nil {
println("SPI init failed:", err)
}
cs := machine.D10
cs.Configure(machine.PinConfig{Mode: machine.PinOutput})
cs.High()
cs.Low()
result := make([]byte, 1)
spi.Tx([]byte{0x00}, result)
cs.High()
⚠ Warning: D13 is shared between SPI SCK and the built-in LED. The LED will flicker during SPI transfers.
machine.UART0uart := machine.UART0
uart.Configure(machine.UARTConfig{
TX: machine.UART_TX_PIN, // D1
RX: machine.UART_RX_PIN, // D0
BaudRate: 9600,
})
uart.Write([]byte("Hello from Arduino Nano\r\n"))
Note: D0/D1 are shared with the USB-serial bridge. Disconnect external devices from D0/D1 before uploading.
// Standard analog pins (A0–A5 also work as digital)
adc := machine.ADC{Pin: machine.ADC0} // A0
adc.Configure(machine.ADCConfig{
Resolution: 10, // 10-bit (0–1023)
})
value := adc.Get() // Returns 16-bit scaled value
println("A0:", value)
// A6 and A7 — analog only (no digital capability)
adc6 := machine.ADC{Pin: machine.ADC6} // A6
adc6.Configure(machine.ADCConfig{})
value6 := adc6.Get()
println("A6:", value6)
The Arduino Nano operates at 5V logic. This is different from 3.3V boards (XIAO, ESP32, etc.):
The ATmega328P supports sleep modes, but TinyGo has limited support:
// TinyGo does not have full sleep mode support on AVR
// For low-power applications, consider using Arduino/C++ instead
Note: The Nano's small form factor makes it popular for battery projects, but TinyGo lacks AVR sleep mode support. Use the Arduino/C++ framework for low-power applications.
pinMode(), no digitalRead()/digitalWrite()