summaryrefslogtreecommitdiffstats
path: root/_log/arduino-uno.md
blob: d726c1fdc10461981600fe239fb76cfe8a93422d (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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
---
title: ATmega328P 3.3 V and 5 V configurations
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:

<pre class="pre-no-style">
    Pin 1   --> [ 10k Resistor ] --> 5V
    Pin 7   --> 5V (w/ 0.1uF Cap to GND)
    Pin 8   --> GND
    Pin 9   --> [ 16MHz Crystal ] --> [ 22pF Cap ] --> GND
    Pin 10  --> [ 16MHz Crystal ] --> [ 22pF Cap ] --> GND
    Pin 20  --> 5V (w/ 0.1uF Cap to GND)
    Pin 21  --> 5V (w/ 0.1uF Cap to GND)
    Pin 22  --> GND
</pre>

Sample Makefile: [Makefile](Makefile)

## 3.3 V - 8 MHz

Electrical connections are identical to 5 V circuit. Replace 5 V with 3.3 V supply,
16 MHz crystal with 8 MHz.

ATmega328P ships with its fuses(BOD level, etc.) configured for 5 V. Need to
modify them. The standard Arduino bootloader requires a 16 MHz clock.  Replace
the default bootloader with one that works witha 8 MHz clock.

Upload the 'ArduinoISP' sketch from the Arduino IDE to an Arduino Uno to use it
as an ISP.

<pre class="pre-no-style">
    ARDUINO UNO (ISP)                       ATMEGA328P
    +-------------------+               +-------\/-------+
    |               D13 |-------------->| 19  PB5 (SCK)  |
    |               D12 |<--------------| 18  PB4 (MISO) |
    |               D11 |-------------->| 17  PB3 (MOSI) |
    |               D10 |-------------->| 1   RESET      |
    |                   |               |                |
    |                5V |-------------->| 7   VCC        |
    |               GND |-------------->| 8   GND        |
    +-------------------+               +----------------+
</pre>

From the Arduino IDE, select 'ATmega328P (3.3 V, 8 MHz)' processor, 'Arduino as
ISP' programmer. Upload the bootloader from the tools menu.

Sample Makefile (8 MHz): [Makefile.3v3](3v3.Makefile)

Note: 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.