blob: 4e71f0de4fdff840667268cd346a10f0b73139dd (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
|
---
title: ATmega328P at 3.3 V and 5 V
date: 2025-06-10
layout: post
---
Quick reference for wiring ATmega328P ICs at 5 V and 3.3 V. 5 V uses 16 MHz
crystal, 3.3 V uses 8 MHz.
<table style="border: none; width: 100%;">
<tr style="border: none;">
<td style="border: none; width: 50%; vertical-align: top;">
<img src="pinout.png" alt="Pinout" style="width: 100%">
<p style="text-align: center;">Pinout</p>
</td>
<td style="border: none; width: 50%; vertical-align: top;">
<img src="breadboard.jpeg" alt="Circuit" style="width: 100%">
<p style="text-align: center;">Breadboard</p>
</td>
</tr>
</table>
## 5 V - 16 MHz
Standard setup. How Arduino Uno boards are wired.
Connections: Pin 1 → 5 V via 10 kΩ resistor. Pins 9/10 → 16 MHz crystal via 22
pF capacitors to ground. Pins 7/20/21 → 5 V supply. Pins 8/22 → ground. Add 0.1
μF decoupling caps between pins 7/20/21 and ground.
Sample Makefile: [Makefile](Makefile)
## 3.3 V - 8 MHz
Electrical connections identical to 5 V circuit. Replace 5 V with 3.3 V supply,
16 MHz crystal with 8 MHz.
Problem: ATmega328P ships configured for 5 V. Must modify fuses (BOD level,
etc.) and replace bootloader. Standard Arduino bootloader expects 16 MHz—needs
8 MHz version.
Solution: Use Arduino Uno as ISP. Upload 'ArduinoISP' sketch from Arduino IDE.
Connect SPI pins (ATmega328P ↔ Uno), Uno's SS pin → ATmega328P RESET pin. Power
ATmega328P from Uno's 5V pin during programming.
Arduino IDE: Select 'ATmega328P (3.3 V, 8 MHz)' processor, 'Arduino as ISP'
programmer. Burn bootloader via tools menu.
Sample Makefile (8 MHz): [Makefile.3v3](3v3.Makefile)
## Remarks
Don't connect AREF (pin 21) to V<sub>cc</sub> if using ADC with internal 1.1 V
or AV<sub>cc</sub> reference. See datasheet section 23.5.2.
|