From 196cf07dff3e16f6c44bb2a6cca10c0af3652fe9 Mon Sep 17 00:00:00 2001 From: Sadeep Madurange Date: Sat, 27 Dec 2025 12:39:08 +0800 Subject: ATmega328P 3.3V post. --- _site/feed.xml | 2 +- _site/index.html | 2 +- _site/log/arduino-uno/index.html | 95 ++++++++++++++-------------------------- _site/log/index.html | 2 +- _site/posts.xml | 2 +- 5 files changed, 38 insertions(+), 65 deletions(-) (limited to '_site') diff --git a/_site/feed.xml b/_site/feed.xml index 1447d49..2f1bab9 100644 --- a/_site/feed.xml +++ b/_site/feed.xml @@ -1 +1 @@ -Jekyll2025-12-27T12:19:17+08:00/feed.xmlASCIIMX | LogW. D. Sadeep MadurangeMatrix Rain: 2025 refactor2025-12-21T00:00:00+08:002025-12-21T00:00:00+08:00/log/matrix-digital-rainW. D. Sadeep MadurangeFingerprint door lock (LP)2025-08-18T00:00:00+08:002025-08-18T00:00:00+08:00/log/fpm-door-lock-lpW. D. Sadeep MadurangeHigh-side MOSFET switching2025-06-22T00:00:00+08:002025-06-22T00:00:00+08:00/log/mosfet-switchesW. D. Sadeep MadurangeHow to configure ATmega328P microcontrollers to run at 3.3V and 5V2025-06-10T00:00:00+08:002025-06-10T00:00:00+08:00/log/arduino-unoW. D. Sadeep MadurangeFingerprint door lock (RF)2025-06-05T00:00:00+08:002025-06-05T00:00:00+08:00/log/fpm-door-lock-rfW. D. Sadeep MadurangeBumblebee: browser automation2025-04-02T00:00:00+08:002025-04-02T00:00:00+08:00/log/bumblebeeW. D. Sadeep MadurangeHow to set up ATSAM3X8E microcontrollers for bare-metal programming in C2024-09-16T00:00:00+08:002024-09-16T00:00:00+08:00/log/arduino-dueW. D. Sadeep MadurangeEtlas: e-paper dashboard2024-09-05T00:00:00+08:002024-09-05T00:00:00+08:00/log/etlasW. D. Sadeep MadurangeExperimental e-reader2023-10-24T00:00:00+08:002023-10-24T00:00:00+08:00/log/e-readerW. D. Sadeep MadurangeNeo4J A* search2018-03-06T00:00:00+08:002018-03-06T00:00:00+08:00/log/neo4j-a-star-searchW. D. Sadeep Madurange \ No newline at end of file +Jekyll2025-12-27T12:40:20+08:00/feed.xmlASCIIMX | LogW. D. Sadeep MadurangeMatrix Rain: 2025 refactor2025-12-21T00:00:00+08:002025-12-21T00:00:00+08:00/log/matrix-digital-rainW. D. Sadeep MadurangeFingerprint door lock (LP)2025-08-18T00:00:00+08:002025-08-18T00:00:00+08:00/log/fpm-door-lock-lpW. D. Sadeep MadurangeHigh-side MOSFET switching2025-06-22T00:00:00+08:002025-06-22T00:00:00+08:00/log/mosfet-switchesW. D. Sadeep MadurangeATmega328P at 3.3V and 5V2025-06-10T00:00:00+08:002025-06-10T00:00:00+08:00/log/arduino-unoW. D. Sadeep MadurangeFingerprint door lock (RF)2025-06-05T00:00:00+08:002025-06-05T00:00:00+08:00/log/fpm-door-lock-rfW. D. Sadeep MadurangeBumblebee: browser automation2025-04-02T00:00:00+08:002025-04-02T00:00:00+08:00/log/bumblebeeW. D. Sadeep MadurangeHow to set up ATSAM3X8E microcontrollers for bare-metal programming in C2024-09-16T00:00:00+08:002024-09-16T00:00:00+08:00/log/arduino-dueW. D. Sadeep MadurangeEtlas: e-paper dashboard2024-09-05T00:00:00+08:002024-09-05T00:00:00+08:00/log/etlasW. D. Sadeep MadurangeExperimental e-reader2023-10-24T00:00:00+08:002023-10-24T00:00:00+08:00/log/e-readerW. D. Sadeep MadurangeNeo4J A* search2018-03-06T00:00:00+08:002018-03-06T00:00:00+08:00/log/neo4j-a-star-searchW. D. Sadeep Madurange \ No newline at end of file diff --git a/_site/index.html b/_site/index.html index 682339b..0bc5788 100644 --- a/_site/index.html +++ b/_site/index.html @@ -95,7 +95,7 @@ - How to configure ATmega328P microcontrollers to run at 3.3V and 5V + ATmega328P at 3.3V and 5V diff --git a/_site/log/arduino-uno/index.html b/_site/log/arduino-uno/index.html index 45f6456..95681a4 100644 --- a/_site/log/arduino-uno/index.html +++ b/_site/log/arduino-uno/index.html @@ -2,12 +2,12 @@ - How to configure ATmega328P microcontrollers to run at 3.3V and 5V + ATmega328P at 3.3V and 5V - How to configure ATmega328P microcontrollers to run at 3.3V and 5V + ATmega328P at 3.3V and 5V @@ -41,17 +41,11 @@
-

HOW TO CONFIGURE ATMEGA328P MICROCONTROLLERS TO RUN AT 3.3V AND 5V

+

ATMEGA328P AT 3.3V AND 5V

10 JUNE 2025

-

This is a quick reference for wiring up ATmega328P ICs to run at 5V and 3.3V. -While the 5V configuration is common, the 3.3V configuration can be useful in -low-power applications and when interfacing with parts that themselves run at -3.3V. In this guide, the 5V setup is configured with a 16MHz crystal -oscillator, while the 3.3V configuration makes use of an 8MHz crystal -oscillator.

- -

The steps that follow refer to the following pinout.

+

Quick reference for wiring ATmega328P ICs at 5V and 3.3V. 5V uses 16MHz +crystal, 3.3V uses 8MHz.

@@ -66,59 +60,38 @@ oscillator.

-

5V-16MHz configuration

- -

Powering ATmega328P microcontrollers with 5V is the most common setup. This is -also how Arduino Uno boards are wired.

- -

In this configuration, the microcontroller’s pin 1 is connected to 5V via a -10kΩ resistor. Pins 9 and 10 are connected to a 16MHz crystal oscillator via -two 22pF capacitors connected to ground. The microcontroller is powered by -connecting pins 7, 20, and 21 to a 5V DC power supply. Lastly, pins 8 and 22 -are connected to ground. In addition to the these connections, which are -required, it’s a good idea to add 0.1μF decoupling capacitors between pins 7, -20, and 21 and ground.

- -

Here’s a sample Makefile for compiling C programs for ATmega328P -microcontrollers using avr-gcc/avrdude toolchain.

- -

3.3V-8MHz configuration

- -

Electrical connections for running an ATmega328P at 3.3V are identical to that -of the 5V circuit. The only differences are that all the 5V connections are -replaced with a 3.3V power source and a 8MHz crystal oscillator takes the place -of the 16MHz crystal.

- -

However, standard ATmega328P chips are preconfigured to run at 5V. To run one -at 3.3V, we must first modify its fuses that control characteristics like the -BOD level. If a bootloader that expects a 16MHz clock (e.g., Arduino -bootloader) is pre-installed on the ATmega328P, it must be swapped with one -that accepts an 8MHz clock. To accomplish that, we need an in-system programmer -(ISP).

- -

Fortunately, we can turn an ordinary Arduino Uno board into an ISP by uploading -the ‘ArduinoISP’ sketch found in the Arduino IDE. The ISP communicates with the -microcontroller using a Serial Peripheral Interface (SPI). So, connect the SPI -port of the ATmega328P to that of the Arduino Uno, and the Uno’s SS pin -to the ATmega328P’s RESET pin.

- -

Power up the the ATmega328P by connecting its VCC to a 5V supply (we -can use Arduino Uno’s 5V pin). From the Arduino IDE, select ‘ATmega328P (3.3V, -8MHz)’ for processor from the tools menu. Also from the tools menu, select -‘Arduino as ISP’ as programmer. Finally, upload the new bootloader by selecting -‘Burn Bootloader’ from the tools menu.

- -

The ATmega328P is now ready to run at 8MHz with a 3.3V power supply. You can -upload programs to the ATmega328P as you normally would using avrdude. -Here’s a sample Makefile with adjusted parameters (e.g., baud -rate) for an 8MHz clock.

+

5V-16MHz

+ +

Standard setup. How Arduino Uno boards are wired.

+ +

Connections: Pin 1 → 5V via 10kΩ resistor. Pins 9/10 → 16MHz crystal via 22pF +capacitors to ground. Pins 7/20/21 → 5V supply. Pins 8/22 → ground. Add 0.1μF +decoupling caps between pins 7/20/21 and ground.

+ +

Sample Makefile: Makefile

+ +

3.3V-8MHz

+ +

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

+ +

Problem: ATmega328P ships configured for 5V. Must modify fuses (BOD level, +etc.) and replace bootloader. Standard Arduino bootloader expects 16MHz—needs +8MHz 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.3V, 8MHz)’ processor, ‘Arduino as ISP’ +programmer. Burn bootloader via tools menu.

+ +

Sample Makefile (8MHz): Makefile.3v3

Remarks

-

In both configurations, if you intend to use the ATmega328P’s analog-to-digital -converter with the internal 1.1V or AVcc voltage as reference, do -not connect AREF (pin 21) to Vcc. Refer to section 23.5.2 in the -datasheet for more information.

+

Don’t connect AREF (pin 21) to Vcc if using ADC with internal 1.1V +or AVcc reference. See datasheet section 23.5.2.

diff --git a/_site/log/index.html b/_site/log/index.html index 659609d..0fcfc51 100644 --- a/_site/log/index.html +++ b/_site/log/index.html @@ -85,7 +85,7 @@ - How to configure ATmega328P microcontrollers to run at 3.3V and 5V + ATmega328P at 3.3V and 5V