Questions tagged [atmega328]

The ATMega328 is the chip that is the heart of the Arduino Uno. It is popular also as a chip to use to create your own board. Since it is available in the through hole version, it can be placed on a breadboard easily for circuits.

Filter by
Sorted by
Tagged with
105 votes
3 answers
110k views

Have I bricked my Arduino Uno? Problems with uploading to board

I can't upload sketches to my Arduino Uno. Have I "bricked" it? What steps can I take to work out what is wrong? What can I do to fix it?
Nick Gammon's user avatar
  • 37.9k
17 votes
1 answer
26k views

How do interrupts work on the Arduino Uno and similar boards?

Please explain how interrupts work on the Arduino Uno and related boards using the ATmega328P processor. Boards such as the: Uno Mini Nano Pro Mini Lilypad In particular please discuss: What to use ...
Nick Gammon's user avatar
  • 37.9k
16 votes
4 answers
71k views

Program an ATMega328P and use it without Arduino board

I'd like to use an ATMega328P for my project, I hope to do it without the Arduino board. I know with the Arduino IDE and an Arduino board I can program the microcontroller. However, would it be ...
George's user avatar
  • 169
16 votes
4 answers
14k views

Is my Arduino dead or is it just its processor?

I have a problem with my Arduino. I can't upload any sketches to it (it gives me the error avrdude: verification error; content mismatch), but the LEDs are still blinking. Do you think that the whole ...
Pop Flamingo's user avatar
13 votes
2 answers
14k views

Put ATmega328 in very deep sleep and listen to serial?

I have investigated the sleeps options of the ATmega328, and read a few articles about it, and I would like to understand if there are more options. So I would like to get as low current as possible, ...
Curnelious's user avatar
13 votes
3 answers
7k views

I got a missignatured ATmega328-PU. How can I fix that?

Sometime in the past, I was burning bootloaders on a fresh batch of four ATmega328-PU using the Arduino IDE (notice there's no P after 328 - it's the slightly cheaper non-picopower version of the MCU, ...
Ricardo's user avatar
  • 3,360
12 votes
3 answers
10k views

ATMega328P-PU and 328P-AU

im planing to make my very own arduino design based on the Arduino PRO mini. I picked this board instead of the UNO mostly because it's way more simpler compared with the UNO since the USB-to-Serial ...
Meletis Flevarakis's user avatar
11 votes
2 answers
2k views

What is the purpose of the I/O pin capacitor on the AVR microcontroller?

What is the purpose of the capacitor on the I/O pins on the ATmega328 (I imagine it's on other AVR microcontrollers as well)? Is it to reduce noise from other parts of the microcontroller?
lemontwist's user avatar
9 votes
2 answers
3k views

very lightweight low power microcontroller with memory?

I have build a couple of projects using arduino. For a new project I want to log skin surface temperature vs. time (just perhaps a few times per day) and possibly other easy to obtain info such as ...
Shara's user avatar
  • 125
9 votes
1 answer
2k views

Why connect a diode between the reset pin of Arduino and 555 timer?

I am trying to create a watchdog timer using 555 IC and I am following this. I do not understand why a 1N4148 diode is connected between the reset pin of Arduino and the output of the 555 timer. As ...
bukke hari prasad's user avatar
8 votes
2 answers
15k views

Basic makefile for avr-gcc

I would like to make a makefile for compiling c programs for the arduino. I am somewhat familiar with make but have never used it with avr-gcc. What is the simplest way I could put the commands below ...
connorwstein's user avatar
8 votes
3 answers
7k views

What is the rise time of an output pin of atmega328 changing its state?

I've already searched a lot and didn't found the answer. Also, I don't have an o'scope. Anyone can help me?
Pedro Quadros's user avatar
8 votes
2 answers
9k views

What are the implications of running an ATmega328P at 8 MHz and 3.3 V with the Arduino system?

I'm working on a custom arduino that will run at 3.3 V with no regulators or USB chips (for power consumption). I've heard that overclocking the chip at 16 MHz/3.3 V is generally fine, but I'd like ...
Vulcan's user avatar
  • 245
8 votes
1 answer
2k views

Programming Chinese Arduinos

I have an authentic Arduino UNO, but I didn't want to pay full price for a new one to build semi perminate projects, so I bought a few ATMEGA328P-PU chips off of AliExpress: https://www.aliexpress....
AndyD273's user avatar
  • 183
8 votes
1 answer
808 views

Can I program a 3.3v chip on a 5v board?

I bought a Gertboard a while ago, and one of the features it has on-board is an ATMega328 (DIP). However, since the Gertboard is designed for use with the Raspberry Pi, it only operates at 3.3v, so ...
Peter Bloomfield's user avatar
8 votes
2 answers
21k views

How to use the analog comparator to determine when an analog pin has reached a certain voltage?

I am trying to find some information on how to use the analog comparator on an Atmega328 to detect when an analog pin has reached a certain voltage (3.16 volts). I cannot find any example code that ...
3871968's user avatar
  • 308
8 votes
2 answers
2k views

Burning sketch with I2C

Not a pure Arduino question really. I'm actually using a standalone ATmega168. So far I've been using AVR-ISP programmer (working from AVR Studio) to program the chip. After everything is done, the ...
tsf144's user avatar
  • 243
7 votes
7 answers
14k views

Arduino 16 MHz with only 3.3V?

Now I have these Arduino Pro Mini from Sparkfun. They are the latest version that I know (yeah, it's the one that have those horrible misaligned pins). Now they are designed around the ATmega328P and ...
Dat Ha's user avatar
  • 2,913
7 votes
3 answers
419 views

Measuring li-ion that arduino is running from

I am using a 5v Arduino pro mini (with regulator and power led removed). I have been reading how to accurately measure Li-ion batteries when powering from the same battery you are trying to measure ...
Lindsay Cox's user avatar
6 votes
2 answers
2k views

Can we burn Arduino bootloader into any microcontroller chip?

I am new to this Arduino community I noticed on youtube that while the prototype is complete people purchase new ATmega328p chips and flash bootloaders into them using in-system-programmers so that ...
Ravikiran's user avatar
  • 195
6 votes
3 answers
9k views

How to deep sleep ATtiny/ATmega (to run for years with batteries) but still detect a button press?

Question (TL;DR): what is the optimal method to deep sleep (to run an ATtiny45 or ATmega on batteries for 1+ year) but still be able to detect a button press? Is it possible to deep sleep until a ...
Basj's user avatar
  • 398
6 votes
4 answers
7k views

Confusion with ATmega328P and 3.3V/8MHz

Firstly, I have tried to set the bootloader to be 8MHz internal oscillator. I have tried the board setup from here - https://github.com/oshlab/Breadboard-Arduino. And also the breadboard-1-6-x.zip ...
Paul Grime's user avatar
6 votes
5 answers
995 views

How do I convert Arduino to an ATmega328P-based project?

I have an Arduino board where I am using some of the peripherals like LCD with I2C. Now I want to convert this Arduino-based circuit to an atmega328p based circuit, i.e. atmega328p with LCD and I2C. ...
Mahadev Panchal's user avatar
6 votes
3 answers
6k views

Two function Reset button - long/short press

I am trying to make a circuit using an ATmega328, that has a reset button that behaves like many consumer devices: A short press just restarts the micro-controller A long press (5 seconds?) causes ...
njh's user avatar
  • 243
6 votes
1 answer
794 views

Is my ATmega broken, and would replacing it with another break that one, too?

I was communicating between my computer and my Arduino Uno R3 through Bluetooth using this Bluetooth module. The connector I use has a red wire where it connects to GND, and a black wire where it ...
The Guy with The Hat's user avatar
5 votes
3 answers
18k views

ATMEGA328P-U vs ATMEGA328-PU

On my Arduino UNO the chip part number is ATMEGA328P-U, i recently bought a ATMEGA328-PU to make a standalone Arduino. realized the part number differences after receiving the package... I noticed ...
ElectronSurf's user avatar
5 votes
3 answers
11k views

What to do with Arduino floating pins?

I have some unused pins, should I connect them together and to the ground or leave them floating?
ElectronSurf's user avatar
5 votes
6 answers
12k views

Lowest power possible in Arduino

I have googled all around and I know about some tricks to make ATmega328 not being a power hog. I am using Arduino Nano V3.0. However, I didn't find out what is the minimal consumption possible with ...
nemewsys's user avatar
  • 215
5 votes
2 answers
692 views

Powering Atmega328p from 4.5V

I want to use Atmega328p controller to handle some very simple signals. I'm using the chip and not the whole arduino board because it is a lot cheaper. The problem is that chip itself doesn't have ...
Mirakul's user avatar
  • 75
5 votes
2 answers
2k views

Run code once after programming

I'm using EEPROM to store project settings non-volatile. After reuploading the sketch to my board (over SPI via ArduinoISP), the EEPROM is reset to full 0xFFs and I have to manually do a "software ...
towe's user avatar
  • 863
5 votes
4 answers
210 views

Where in datasheet is the warning about unreliability of reading PINxn?

I use atmega32u4 (but believe it applies to all models). Here is the datasheet. Consider the following C program (I use AVR-GCC 5.4.0): #include <avr/io.h> int main(void) { PORTB |= 1 <&...
Igor Liferenko's user avatar
5 votes
2 answers
159 views

Trouble with Timer 0

I'm taking my first wobbly steps outside the Arduino IDE and I'm not having much success with timers / interrupts. I can set a pin to output and light an LED with registers fine but I cannot for the ...
Ashlyn Black's user avatar
5 votes
3 answers
2k views

Can I use an ATmega328 alone without anything and what is the max voltage I can power the atmega328 with

Okay 2 questions. If I am to replace the Arduino with an ATmega328 programmed with a standard blink on pin 13, is this configuration correct, do I still need oscillators and whatnot? Second question ...
suckms's user avatar
  • 125
5 votes
1 answer
422 views

Why were Atmel MCUs used for Arduino?

Atmel microcontrollers are not cheap compared to STM and Microchip. Why did Arduino select Atmel MCUs such as atmega328 and atmega2560 on their board out of so many alternatives?
user768421's user avatar
5 votes
3 answers
162 views

Powering an USB to Serial from USB

I am creating a PCB which is a modification of the Arduino on a breadboard. I am intending to buy an USB to Serial breakout from Adafruit so that I can upload my sketches to the atmega 328 I'll be ...
francisaugusto's user avatar
5 votes
1 answer
2k views

EEPROM value reverting to 255

When I write '13' to the EEPROM and read it straight after it works correctly. However when I comment out the write part of the code and try to just read the data, the value is no longer 13 as it ...
MoKaM's user avatar
  • 51
5 votes
2 answers
2k views

How can I use PWM in power saving mode (ATmega328)?

I fail to use PWM in power saving mode. The output behaves erratically. This should be possible, I guess. The following is a minimal working example: /* MWE: Cannot use PWM in any power saving ...
stefan's user avatar
  • 153
5 votes
3 answers
10k views

nRF24L01+ RF24 library - can send but can't receive

I'm prototyping out a board with temperature, humidity, windspeed sensors, and using an NRF2401+ board to send values to a Raspberry Pi base station that will record the data. Using a Leonardo clone ...
Steve's user avatar
  • 51
5 votes
2 answers
2k views

Jumping to bootloader from application code in atmega328p

I'm trying to program an Arduino Uno (atmega328p) using only the serial Tx/Rx lines (no DTR, so no automatic reset). This is so I can upload code via WiFi/TCP using an ESP-01. To achieve this, I need ...
Nuno's user avatar
  • 63
5 votes
2 answers
2k views

Arduino Uno as USB to Serial converter (bypass 328p)

I'm trying out computer to computer serial communication using 2 Arduino Unos (both connected to different computers). Right now, I use the Software Serial library, which redirects data from the ...
Carl's user avatar
  • 89
4 votes
1 answer
8k views

Is there a way to disable modules like ADC without a sleep mode?

I'm working on a binary watch project. I want my circuit to live off of batteries for as long as possible, so I want to decrease the power consumption of my chip. I'm using a barebones ATmega328P-PU ...
thallia's user avatar
  • 43
4 votes
2 answers
13k views

Sending serial data in an interrupt

An ATMEGA328-P chip is used with a toggle switch attached to pin 8 and a momentary switch attached to pin 9. My objective is to send the following information over serial: The status of pin 8, every ...
Greg's user avatar
  • 143
4 votes
2 answers
174 views

Usefulness of measuring 0v using ADC

I'm looking at the datasheet of the ATMega328, and I see the different channels you can select for AD conversion. ADC0..7, ADC8 (temperature), 1.1V (VBG), and lastly 0V (GND). What would be the use ...
Gerben's user avatar
  • 11.3k
4 votes
3 answers
2k views

Can I remove soldered atmega328P from arduino board, using hot air gun, without damaging it?

I need to remove atmega328P from arduino board and the best tool what comes up to my mind is a hot air gun. What is the maximum temperature that atmega328P can withstand?
Kirill's user avatar
  • 151
4 votes
2 answers
1k views

Can a timer be used in both CTC and (fast) PWM mode simultaneously?

I would like to generate a sequence of pulses of varying lengths in the range of 0-100us, so that from the start of one pulse to the start of the next there is a delay of 100us. I have set up timer0 ...
Tom van der Zanden's user avatar
4 votes
3 answers
14k views

Stable frequency generation

I'm trying to work out the best way to generate a stable frequency with my Uno R3 I'm using interrupts to generate an approximately 40KHz frequency which drives some ICs/MOSFETs to effectively ...
Ramrod's user avatar
  • 187
4 votes
1 answer
429 views

What does "Update of OCR1x at" mean in the WGM table of ATMEGA328?

I just finished a reading a couple of online guides on how to use timer registers with pulse width modulation, so I'm still new to its concept. When I looked in the ATMEGA328 specification sheet, I ...
John's user avatar
  • 173
4 votes
1 answer
1k views

How to burn the bootloader and upload sketches on ATmega328P U (specifically this model)?

Recently I started to learn embedded electronics and C/C++ and for a couple of days I tried and I am still trying to burn a new ATMega328P U bought from Aliexpress. From what I know new ATMega328P's ...
Vlad George's user avatar
4 votes
1 answer
6k views

Using usb port to communicate with standalone atmega328p circuit

noob here So I managed to get my circuit to be a standalone circuit (as pictured below). I want to use this circuit as an input to a game on my computer. What I want to know is could this micro-usb ...
user19964's user avatar
4 votes
1 answer
214 views

Arduino IDE Based Data Logger - Stops Running

I have created a data logger that writes to a MicroSD on a user defined interval. The data logger also has the ability to use an xBee unit to transmit the data received to a base station. This is ...
Alex Bohleber's user avatar

1
2 3 4 5
10