summaryrefslogtreecommitdiffstats
path: root/_site/blog/arduino-uno
diff options
context:
space:
mode:
authorSadeep Madurange <sadeep@asciimx.com>2025-12-08 17:34:35 +0800
committerSadeep Madurange <sadeep@asciimx.com>2025-12-08 21:05:19 +0800
commit752a06ec0ebf20d6232b13f1ea53fe21fefcefbd (patch)
tree690411afad8eb76216417a42de94135214cb2401 /_site/blog/arduino-uno
parent20b0a045a7dc78f9728837fe5a1be8cf12caae4e (diff)
downloadwww-752a06ec0ebf20d6232b13f1ea53fe21fefcefbd.tar.gz
Fix list indentation.
Diffstat (limited to '_site/blog/arduino-uno')
-rw-r--r--_site/blog/arduino-uno/3v3.Makefile46
-rw-r--r--_site/blog/arduino-uno/Makefile43
-rw-r--r--_site/blog/arduino-uno/breadboard.jpegbin0 -> 54319 bytes
-rw-r--r--_site/blog/arduino-uno/index.html139
-rw-r--r--_site/blog/arduino-uno/pinout.pngbin0 -> 247197 bytes
5 files changed, 228 insertions, 0 deletions
diff --git a/_site/blog/arduino-uno/3v3.Makefile b/_site/blog/arduino-uno/3v3.Makefile
new file mode 100644
index 0000000..4ca89d4
--- /dev/null
+++ b/_site/blog/arduino-uno/3v3.Makefile
@@ -0,0 +1,46 @@
+CC = avr-gcc
+MCU = atmega328p
+PORT = /dev/cuaU0
+TARGET = app
+
+SRC = main.c
+OBJ = $(SRC:.c=.o)
+
+CFLAGS = -std=gnu99
+CFLAGS += -Os
+CFLAGS += -Wall
+CFLAGS += -mmcu=$(MCU)
+CFLAGS += -DBAUD=57600
+CFLAGS += -DF_CPU=8000000UL
+CFLAGS += -ffunction-sections -fdata-sections
+
+LDFLAGS = -mmcu=$(MCU)
+LDFLAGS += -Wl,--gc-sections
+
+HEX_FLAGS = -O ihex
+HEX_FLAGS += -j .text -j .data
+
+AVRDUDE_FLAGS = -p $(MCU)
+AVRDUDE_FLAGS += -c arduino
+AVRDUDE_FLAGS += -b 57600
+AVRDUDE_FLAGS += -P $(PORT)
+AVRDUDE_FLAGS += -D -U
+
+%.o: %.c
+ $(CC) $(CFLAGS) -c -o $@ $<
+
+elf: $(OBJ)
+ $(CC) $(LDFLAGS) $(OBJ) -o $(TARGET).elf
+
+hex: elf
+ avr-objcopy $(HEX_FLAGS) $(TARGET).elf $(TARGET).hex
+
+upload: hex
+ avrdude $(AVRDUDE_FLAGS) flash:w:$(TARGET).hex:i
+
+.PHONY: clean
+
+clean:
+ rm -f *.o *.elf *.hex
+
+
diff --git a/_site/blog/arduino-uno/Makefile b/_site/blog/arduino-uno/Makefile
new file mode 100644
index 0000000..9db7b09
--- /dev/null
+++ b/_site/blog/arduino-uno/Makefile
@@ -0,0 +1,43 @@
+CC = avr-gcc
+MCU = atmega328p
+PORT = /dev/cuaU0
+TARGET = app
+
+SRC = main.c
+OBJ = $(SRC:.c=.o)
+
+CFLAGS = -std=gnu99
+CFLAGS += -Os
+CFLAGS += -Wall
+CFLAGS += -mmcu=$(MCU)
+CFLAGS += -DBAUD=115200
+CFLAGS += -DF_CPU=16000000UL
+CFLAGS += -ffunction-sections -fdata-sections
+
+LDFLAGS = -mmcu=$(MCU)
+LDFLAGS += -Wl,--gc-sections
+
+HEX_FLAGS = -O ihex
+HEX_FLAGS += -j .text -j .data
+
+AVRDUDE_FLAGS = -p $(MCU)
+AVRDUDE_FLAGS += -c arduino
+AVRDUDE_FLAGS += -P $(PORT)
+AVRDUDE_FLAGS += -D -U
+
+%.o: %.c
+ $(CC) $(CFLAGS) -c -o $@ $<
+
+elf: $(OBJ)
+ $(CC) $(LDFLAGS) $(OBJ) -o $(TARGET).elf
+
+hex: elf
+ avr-objcopy $(HEX_FLAGS) $(TARGET).elf $(TARGET).hex
+
+upload: hex
+ avrdude $(AVRDUDE_FLAGS) flash:w:$(TARGET).hex:i
+
+.PHONY: clean
+
+clean:
+ rm *.o *.elf *.hex
diff --git a/_site/blog/arduino-uno/breadboard.jpeg b/_site/blog/arduino-uno/breadboard.jpeg
new file mode 100644
index 0000000..bd74907
--- /dev/null
+++ b/_site/blog/arduino-uno/breadboard.jpeg
Binary files differ
diff --git a/_site/blog/arduino-uno/index.html b/_site/blog/arduino-uno/index.html
new file mode 100644
index 0000000..7c4a71b
--- /dev/null
+++ b/_site/blog/arduino-uno/index.html
@@ -0,0 +1,139 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <meta charset="utf-8">
+ <title>How to configure ATmega328P microcontrollers to run at 3.3V and 5V</title>
+
+ <head>
+ <meta charset="utf-8">
+ <meta name="viewport" content="width=device-width, initial-scale=1">
+ <title>How to configure ATmega328P microcontrollers to run at 3.3V and 5V</title>
+ <link rel="stylesheet" href="/assets/css/main.css">
+ <link rel="stylesheet" href="/assets/css/skeleton.css">
+</head>
+
+
+
+ </head>
+ <body>
+
+ <div id="nav-container" class="container">
+ <ul id="navlist" class="left">
+
+ <li >
+ <a href="/" class="link-decor-none">hme</a>
+ </li>
+ <li class="active">
+ <a href="/blog/" class="link-decor-none">blg</a>
+ </li>
+ <li >
+ <a href="/projects/" class="link-decor-none">poc</a>
+ </li>
+ <li >
+ <a href="/about/" class="link-decor-none">abt</a>
+ </li>
+ <li><a href="/feed.xml" class="link-decor-none">rss</a></li>
+ </ul>
+</div>
+
+
+
+ <main>
+ <div class="container">
+ <div class="container-2">
+ <h2 class="center" id="title">HOW TO CONFIGURE ATMEGA328P MICROCONTROLLERS TO RUN AT 3.3V AND 5V</h2>
+ <h6 class="center">10 APRIL 2025</h5>
+ <br>
+ <div class="twocol justify"><p>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.</p>
+
+<p>The steps that follow refer to the following pinout.</p>
+
+<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>
+
+<h2 id="5v-16mhz-configuration">5V-16MHz configuration</h2>
+
+<p>Powering ATmega328P microcontrollers with 5V is the most common setup. This is
+also how Arduino Uno boards are wired.</p>
+
+<p>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.</p>
+
+<p><a href="Makefile">Here’s</a> a sample Makefile for compiling C programs for ATmega328P
+microcontrollers using avr-gcc/avrdude toolchain.</p>
+
+<h2 id="33v-8mhz-configuration">3.3V-8MHz configuration</h2>
+
+<p>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.</p>
+
+<p>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).</p>
+
+<p>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.</p>
+
+<p>Power up the the ATmega328P by connecting its V<sub>CC</sub> 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.</p>
+
+<p>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.
+<a href="3v3.Makefile">Here’s</a> a sample Makefile with adjusted parameters (e.g., baud
+rate) for an 8MHz clock.</p>
+
+<h2 id="remarks">Remarks</h2>
+
+<p>In both configurations, if you intend to use the ATmega328P’s analog-to-digital
+converter with the internal 1.1V or AV<sub>cc</sub> voltage as reference, do
+not connect AREF (pin 21) to V<sub>cc</sub>. Refer to section 23.5.2 in the
+datasheet for more information.</p>
+
+</div>
+ <p class="post-author right">by W. D. Sadeep Madurange</p>
+ </div>
+ </div>
+ </main>
+
+ <div class="footer">
+ <div class="container">
+ <div class="twelve columns right container-2">
+ <p id="footer-text">&copy; ASCIIMX - 2025</p>
+ </div>
+ </div>
+</div>
+
+
+ </body>
+</html>
diff --git a/_site/blog/arduino-uno/pinout.png b/_site/blog/arduino-uno/pinout.png
new file mode 100644
index 0000000..59acfbc
--- /dev/null
+++ b/_site/blog/arduino-uno/pinout.png
Binary files differ