Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

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.

81
votes
3answers
74k 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?
14
votes
4answers
9k 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 ...
12
votes
5answers
43k 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 ...
11
votes
2answers
8k 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, ...
11
votes
2answers
4k 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, ...
10
votes
1answer
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?
9
votes
2answers
2k 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 ...
9
votes
1answer
13k 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 ...
8
votes
1answer
1k 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 ...
8
votes
2answers
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 ...
7
votes
2answers
7k 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 ...
7
votes
1answer
761 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 ...
7
votes
2answers
1k 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....
7
votes
2answers
8k 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 ...
6
votes
3answers
4k 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 ...
6
votes
2answers
1k 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 ...
5
votes
3answers
4k 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 ...
5
votes
3answers
2k 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 ...
5
votes
3answers
1k 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 ...
5
votes
1answer
555 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 ...
5
votes
2answers
11k 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 ...
5
votes
1answer
404 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?
5
votes
2answers
604 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 ...
5
votes
3answers
101 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 ...
5
votes
1answer
1k 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 ...
5
votes
1answer
90 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 ...
5
votes
2answers
868 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 ...
4
votes
3answers
822 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?
4
votes
2answers
2k views

Using Arduino as ISP to burn sketch directly to ATmega328 without first installing a bootloader on the ATmega328

Is it possible to take a bare ATmega328 chip, and with an Arduino as ISP, burn a sketch directly to the chip (e.g. not needing a bootloader), or is the bootloader required to run Arduino sketches? I ...
4
votes
2answers
137 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 ...
4
votes
2answers
111 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 ...
4
votes
1answer
350 views

Which of the clock sources are actually internal to the ATmega328P?

I am trying to determine exactly what all of the fuse settings correspond to on the ATmega328P. The options for the CKSEL bits are: 1111-1000: Low Power Crystal Oscillator 0111-0110: Full Swing ...
4
votes
2answers
346 views

7805 powered Atmega328 Stops working when input of 7805 exceeds 7volts

I am developing a circuit with atmega328, the MCU is powered by a LM7805. The input of 7805 is given by a variable supply. Till the input of 7805 is 7volts, the output voltage is 4.9volts and current ...
4
votes
2answers
3k 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?
4
votes
1answer
46 views

Cheapest way to change digital output source

Powering at 5 volts, atmega328 output ~4.7 volts. I need to output between 12 and 24 volts @ 2 amp. I'm currently using relay but they are costly. Is there a way to do it with transistors or any thing ...
4
votes
5answers
6k 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 ...
3
votes
6answers
9k 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 ...
3
votes
4answers
148 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 <&...
3
votes
1answer
4k 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 ...
3
votes
3answers
631 views

Constructing my own serial command syntax to control arduino

I know this is a basic question, but as a hardware electronics guy and not a programmer I cannot seem to fathom how to do this - so any examples of code would be greatly appreciated: I want the ...
3
votes
2answers
450 views

Grab keys from an ordinary USB kyboard

Arduino USB I want to write an Arduino Sketch (if there is no other possibility it can also be plain c) , to grab keyboard inputs from my ordinary USB keyboard. Preferably without expensive hardware, ...
3
votes
3answers
415 views

Atmega328p - Going low power 1.8V using 4Mhz oscillator - Bootloader flash

I would like to use an Atmega328p micro-controller with a 4 Mhz oscillator in order get some low power consumptions. I am using an Arduino board to flash the bootloader into the Atmega. EDIT In ...
3
votes
2answers
520 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 ...
3
votes
2answers
145 views

Barebones 328p, 2xAA vs 3xAA, which will last longer?

So im just running a 328p at 8mhz with the internal oscillator. Datasheet says 1.8 to 5.5v is voltage range. Will 3xAA in series (~4.5v) last longer than 2xAA in series (~3v), assuming all batteries ...
3
votes
2answers
616 views

WORDS in ATmega328 datasheet note

I came across something strange while reading the datasheet for the microcontroller in the Arduino Uno board. It is the (8) note in pg.296-297 of this datasheet: what does WORDS mean in that context?
3
votes
1answer
349 views

ctc mode on atmega 328

I'm trying to use CTC mode on Arduino 1 but I have the following problem. I need to generate an interrupt on threshold B and A and I have set the prescaler to 1 since I want to generate interrupt A at ...
3
votes
1answer
57 views

Arduino Standalone construction

In tutorial - https://www.arduino.cc/en/Main/Standalone , they have used voltage regulator. Can we able to do without Voltage regulator ?(to compact the circuit), If so what should the voltage & ...
3
votes
1answer
319 views

Using Arduino with Assembly on MacOS

I'm trying to use an Arduino UNO board with Assembly on MacOS, but I couldn't find any documentation about it. How can I compile and upload Assembly files to the Arduino with MacOS?
3
votes
1answer
3k views

Reset fuses on atmega328p using Arduino

I bought a few atmega328p chips but unfortunately they came with the Arduino bootloader and they are set to use the external clock. I want to reset their fuses using avrdude so I can use the internal ...
3
votes
1answer
548 views

ATmega328P SPI Slave

I was scrolling through the ATmega328P datasheet when I came across a rather fascinating statement about the way in which the data part of the SPI interface is buffered. I can't seem to understand why ...