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
94
votes
3answers
91k 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
1answer
19k 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 ...
13
votes
2answers
10k 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, ...
3
votes
2answers
1k views

Timer2 “Clear OC2B on Compare Match” not working as expected in CTC mode

This is a follow up to my previous question. I have Timer2 in CTC mode, with TOP=OCR2A set to 150 (with a prescaler of 8, giving a 75us timing interval). The datasheet states that setting COM2B1 to ...
11
votes
3answers
7k 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 ...
0
votes
5answers
643 views

How would I use Arduino microcontroller separately?

I'm learning Arduino. I use Arduino Uno board with ATMEGA328-PU. I tried basic codes like LED blink, control of DC motor etc. Arduino board is used only when we program microcontroller, right? I mean, ...
0
votes
2answers
179 views

How do I replace a burnt atmega328 with a new atmega328(bootloaded) in arduino?

I have an arduino UNO with atmega 328 whose microcontroller got burnt. I bought a new atmega328. I have another working arduino with atmega8. I followed the instructions in http://arduino.cc/en/...
13
votes
4answers
55k 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 ...
3
votes
1answer
2k views

Using an Arduino board to program an AVR

I think the arduino board is awesome. Though I'm not interested in the library and IDE at all... Is there a way, to use an AVR 328p, as you normally would, on an arduino board? I like how arduino's ...
2
votes
2answers
536 views

Change the fuses of an Arduino Uno (can an Arduino Uno change its own fuses?)

For now, I'm using an Arduino Uno alone including its 328p (no other external chip to program). I would like to change its fuses to internal 8 Mhz clock (because then I'll move the 328p out of the ...
3
votes
2answers
706 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
469 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 ...
2
votes
1answer
4k 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 ...
5
votes
1answer
640 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 ...
4
votes
5answers
9k 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 ...
3
votes
2answers
2k views

Atmega328P-PU: Programmer is not responding

Few days ago, I built my own custom Arduino on the breadboard. It is built according to tutorial on http://www.crash-bang.com/resource/breadboard-arduino/. The Atmega328P-PU is already burned with the ...
3
votes
3answers
13k 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 ...
2
votes
1answer
1k views

Vcc measurement with internal 1.1V reference fails on 3.3V powered Atmega328

I need to monitor a battery plugged to an ATmega running on standalone mode. I use the "ATmega on a breadboard (8 MHz internal clock)" bootloader. More info here When the ATmega is powered with 5V ...
2
votes
2answers
6k 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 ...
1
vote
1answer
985 views

Nano clone not working over USB, no data, no power, but can power via Vin (CH340 chip? schottky diode?)

My quite new Nano clone (ATmega328P + CH340G) suddenly stopped working. Plugging it in with USB did not light up the LED(s) nor did it get detected by my machine. I looked it up, and found some how-to'...
1
vote
2answers
291 views

Powering Atmega328P-Pu externally [closed]

Please I'm new to Arduino and I need assistance. I'm working on a project which makes use of the ultrasonic sensor to make a certain pin high if a certain distance is attained. When I used the USB ...
1
vote
2answers
1k views

Aduino 7 segment dice project

I am struggling with the code that I should write for my project. I finished my breadboard but I have never learnt programming before so I cannot write the program for the dice. My project is to make ...
1
vote
1answer
95 views

redefining delay and delaymicros as personal function

Is it possible to redefine delay and delaymicros function with #define ? I want to use timer2 interrupt instead of these. Something like this: #define delay(unisgned long ms) countMicros(uint16_t ...
1
vote
1answer
1k views

Timer2 Compare Interrupt not working as expected

To get this out of the way first: I have already looked at "Timer2 does not work as it should" and "Timer2 “Clear OC2B on Compare Match” not working as expected in CTC mode" but have not found the ...
0
votes
0answers
739 views

Unable to reset arduino with RESET pin

I am using a custom built arduino UNO for some personal projects. I am using a custom optiboot bootloader given by Nick in this post. This was done to prevent the three LED flashes on digital pin 13. ...
0
votes
3answers
2k views

Feasability of flashing Arduino UNO r3 with teensy firmware for HID (keyboard) emulation purposes

I've been working on a DIY keyboard project I have all the hardware designed and now its time for the code. For the microcontroller, I'm sort of locked into an Arduino UNO r3 as I already have it ...
0
votes
1answer
429 views

LCD library and timer2 CTC interrupt not working together

I want to set up real time counter along with lcd functions from LiquidCrystal library. But they don't work together. However, they work fine separately. The code is working by itself, but by ...
0
votes
0answers
121 views

Implementing pluseIn using interrupt

I am trying to implement pluseIn using an interrupt. I tried attaching an interrupt in CHANGE mode. The time when the signal goes HIGH is recorded as raising time and the time when it goes signal LOW ...
0
votes
2answers
1k views

Arduino analogWrite source code explanation

The source code for the analogWrite function looks like this: void analogWrite(uint8_t pin, int val) { ... sbi(TCCRnA, COM0x); OCRnx = val; ... } Where n is which timer (0, 1, 2...) ...
0
votes
3answers
182 views

Why atmega168/328p starts to reset?

First we set fuse bits: avrdude -c usbasp -p atmega328p -U lfuse:w:0xFF:m -U hfuse:w:0xDF:m -U efuse:w:0x07:m # same for atmega168 In the following examples we use the following commands to compile ...
0
votes
3answers
906 views

Extending EEPROM life

I'm working on some software using an Uno (ATmega328P). I have a stage byte that can be 1 of 5 values (0-4) in my code and it will increase by 1 every 2.5 hours. If I lose power I need to ensure that ...
0
votes
1answer
246 views

Running Arduino code for Bluefruit LE on bare ATMega328

I need to hook up Bluefruit LE Breakout (nRF8001-based) to ATMega328 chip (to use it as wireless UART), and it seems like the library provided is for Arduino. What I have is just bare ATMega328 (note ...
-1
votes
1answer
781 views

transmit a sequence of bit using arduino uno [closed]

How do i code to transmit a sequence of bit using arduino uno?My project is about a transmitter and a receiver.Arduino as the transmitter and an application as the receiver.Light sensor will detect ...