Provides comprehensive pinout reference, board specifications, and TinyGo development guide for the Arduino Uno R3 (ATmega328P) microcontroller. Use when writing TinyGo firmware for the Arduino Uno R3, wiring peripherals, or configuring pins. Keywords: Arduino, Uno, R3, ATmega328P, AVR, TinyGo, pinout, GPIO, I2C, SPI, UART, analog, digital, PWM, 5V, 8-bit.
Provides comprehensive reference for developing TinyGo firmware for the Arduino Uno R3 (ATmega328P).
Arduino-UnoR3-Arduino skillArduino-UnoR4Minima-TinyGo or Arduino-UnoR4WiFi-TinyGo skillArduino-Nano-TinyGo skillArduino-Mega2560-TinyGo skill| Parameter | Value |
|---|---|
| MCU | ATmega328P |
| Architecture | 8-bit AVR |
| Clock Speed | 16 MHz |
| Flash | 32 KB (0.5 KB used by bootloader) |
| SRAM | 2 KB |
| EEPROM | 1 KB |
| USB | USB-B (via ATmega16U2 USB-serial) |
| Operating Voltage | 5V |
| Input Voltage (VIN) | 7–12V recommended (6–20V limit) |
| DC Current per I/O Pin | 20 mA |
| DC Current for 3.3V Pin | 50 mA |
| Dimensions | 68.6 × 53.4 mm |
| Weight | 25 g |
| Digital I/O | 14 (D0–D13) |
| PWM Outputs | 6 (D3, D5, D6, D9, D10, D11) |
| Analog Inputs | 6 (A0–A5, 10-bit ADC) |
| Built-in LED | D13 |
[USB-B] [Barrel Jack]
┌──────────────────────────────┐
│ RESET IOREF 5V GND VIN │ ← Power Header
│ 3.3V AREF GND │
├──────────────────────────────┤
SCL/A5 ──┤ A5 D13 ├── SCK / Built-in LED
SDA/A4 ──┤ A4 D12 ├── MISO
A3 ──┤ A3 ~D11 ├── MOSI / PWM
A2 ──┤ A2 ~D10 ├── SS / PWM
A1 ──┤ A1 ~D9 ├── PWM
A0 ──┤ A0 D8 ├──
│ │
│ [ATmega328P] │
│ │
│ D7 ├──
│ ~D6 ├── PWM
│ ~D5 ├── PWM
│ D4 ├──
│ ~D3 ├── PWM / INT1
│ D2 ├── INT0
TX ─────┤ D1 D1 ├── TX
RX ─────┤ D0 D0 ├── RX
├──────────────────────────────┤
│ [ICSP] │
└──────────────────────────────┘
~ = PWM capable INT = External interrupt
| 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 | — | — |
| Pin | Function |
|---|---|
| VIN | Input voltage (7–12V recommended) |
| 5V | Regulated 5V output |
| 3.3V | Regulated 3.3V output (50 mA max) |
| GND | Ground (3 pins) |
| AREF | Analog reference voltage |
| IOREF | I/O reference voltage |
| RESET | Reset (active LOW) |
arduino-uno
tinygo info -target=arduino-uno
# Build only
tinygo build -target=arduino-uno -o firmware.hex ./main.go
# Build and flash (board must be connected via USB)
tinygo flash -target=arduino-uno ./main.go
# Monitor serial output
tinygo monitor -target=arduino-uno
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()
// Transfer data
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. When using SPI, the LED will flicker during data 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 Uno R3\r\n"))
Note: D0/D1 are shared with the USB-serial bridge (ATmega16U2). Using UART0 for external devices will conflict with serial upload/monitor. Disconnect external devices from D0/D1 before uploading.
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("ADC:", value)
The Arduino Uno R3 operates at 5V logic. This is different from 3.3V boards (XIAO, ESP32, etc.):
The ATmega328P supports several 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
// or direct register manipulation via volatile memory access
Note: Classic AVR boards like the Uno R3 do not have sophisticated deep sleep support in TinyGo. For battery-powered low-power applications, consider the Arduino/C++ framework or a board with better TinyGo sleep support.
println() instead of fmt.Println()println() outputs to hardware UART