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.
500
questions
0
votes
1
answer
313
views
Arduino ISP external power
I want to program an atmega328p-pu via my arduino uno as ISP in a circuit.
I omitted my connected sensors, LCD, etc in the schematic to keep it simple.
When I power the circuit via a 5V power supply ...
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 ...
1
vote
1
answer
981
views
ATmega328 is not recognized by software
I installed the required drivers for the board. But I cannot still upload a program to the board. It says that
avrdude: Version 6.3, compiled on Jan 17 2017 at 12:00:53
Copyright (c) 2000-...
1
vote
1
answer
298
views
Errors trying to set fuses on bare Atmega328p
I have an Atmega328p on a board that I want to program using an Arduino programmer. I've got the programmer working to program other Arduino's over ICSP header, but when trying to use the same ...
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 ...
0
votes
1
answer
381
views
Burn hex with optiLoader
Can optiLoader be used to burn custom hex?
For example, there's hex representation stored in optiLoader.ino in image_328, if that value is replaced with content of my pre-compiled hex, should that ...
0
votes
3
answers
776
views
Switch case does not work after booting system
int value1;
int value2;
int runs1 = 0;
int runs2 = 0;
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x3F, 16, 2);
int inPin = 6;
int val = 0;
int push_count = 0;
...
1
vote
2
answers
6k
views
Standalone Arduino with ATMEGA328P / Serial working, but serial programming not (only once after buning bootloader)
For my master thesis I've designed a board with an ATMEGA328P-AU as micro controller.
As I want to use some libraries and I like the simplicity, I want to use "Arduino" to program it.
...
0
votes
2
answers
305
views
Getting error 32 in multi-master I2C sketch with library https://github.com/rambo/I2C
I am developing a multi-master scenario sketch with the https://github.com/rambo/I2C library, because this library will handle multi-master data collisions.
I created a setup with two Arduino nano's ...
2
votes
2
answers
2k
views
8 bits 62.5kHz PWM signal
// TIMER/COUNTER 0
// PIN 6(OC0A) = NON-INVERTED [_BV(COM0A1)]
// PIN 5(OC0B) = INVERTED [_BV(COM0B1) | _BV(COM0B0)]
// PWM MODE = FAST PWM [_BV(WGM01) | _BV(WGM00)]
// PRESCALER = 1 ...
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 ...
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 ...
4
votes
5
answers
28k
views
SIM800L change default baud rate
I am using an ATmega328P with internal clock (8 MHz) with a SIM800L module. The default baud rate of the SIM800L is 115,200 baud and I can't make them talk to each other correctly. Although I was able ...
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?
0
votes
1
answer
916
views
Can I use atmega328P without capacitors?
I need to use atmega328P without arduino board, so far I know that I will need 16MHZ Quartz Resonator and two 22nf capacitors. However, I have seen that other people are using atmega328P without ...
0
votes
1
answer
58
views
Increasing number of iterations not increasing time
I am using Arduino Uno with Atmel Atmega328. I am using micros() function in Arduino IDE to measure time taken for execution. Here is my code:
void setup() {
Serial.begin(9600);
}
void loop() {
...
3
votes
1
answer
3k
views
ATMEGA AVcc pin - low pass filter
I am a newby to the world of electronics and IC chips, and am looking to make an ATMEGA328 based board to monitor 12v batteries. The board will be powered from the batteries being monitored, with a ...
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 ...
0
votes
2
answers
163
views
Lifecycle hook in Arduino to know if Arduino is reset or powered down
I am new to Arduino programming and I'm really fascinated with its working. Is there a way to know if an Arduino is getting switched off or being reset? Like a function would be called before the ...
0
votes
3
answers
690
views
Why doesn't millis() use 1 µsec or 1 msec interrupt?
Arduino millis() does not make use of one millisecond interrupt. Instead they make use of 1,024 µsec interrupts and manipulate. Any specific reason why this was implemented this way?
In one case, we ...
0
votes
1
answer
493
views
Can we use analog input pins as a parameter of analogWrite() for PWM? [closed]
int led = A1;
void setup() {
pinMode(led, OUTPUT);
}
void loop() {
analogWrite(led, 188.7);
delay(100);
analogWrite(led ,0);
delay(100);
}
Like this and it works! I mean I am getting the ...
0
votes
2
answers
699
views
Programming ATmega328p on external board with FT232R
I am making a 100W AC-DC linear power supply, for which I want to show output Voltage and Output current on LCD display. I already used shunt resistor and voltage resistor to bring both values to ...
2
votes
1
answer
1k
views
Cannot find COM port for Arduino after replacing Atmega328p
I had mistakenly burnt my ATmega328p that was there on the Arduino UNO R3 board. So I bought a new ATmega328p-pu with Arduino UNO bootloader installed and a sample blinking LED program pre-flashed.
...
0
votes
2
answers
407
views
5v input on ATmega328p running on 3.3v
The ATmega328p can run on 5v but will it cause problems if it runs on 3.3 v and one input signal is 5v?
1
vote
1
answer
3k
views
understanding timer overflow detection code
I am trying to understand in details the (great tutorial and) code of Nick Gammon ''Improved sketch using Timer 1'', available here: http://www.gammon.com.au/forum/?id=12075 . I post the whole code at ...
3
votes
1
answer
97
views
Issues graduating to AVR-C [closed]
I'm trying to make the transition from coding in the Arduino language to AVR-C, but I'm having some issues with my microcontrollers.
I don't have an ISP, so I'm using one of my Arduino UNOs with the ...
0
votes
2
answers
587
views
Arduino pro mini not compiling after changing fuse to 128khz
I used Arduino UNO as ISP to change the fuse setting of Arduino Pro Mini. Using avrdude cmd, I successfully changed it to 8MHz setting. Due to curiosity, I decided to try changing it to 128kHz. But ...
-1
votes
2
answers
462
views
interrupt not triggered correctly
I have an arduino uno and want to react to three sensors, which should trigger an ISR.
I wrote the following program, and for sensor 3 it works, however the other two sensor don't seem to trigger an ...
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 ...
1
vote
0
answers
850
views
Atmega328p ISP won't work
I have a grbl board that runs on an Atmega328p. On the board I have also provided the ability to control the stepper drivers through an external control step and dir signals. The schematics are shown ...
1
vote
2
answers
1k
views
Error when trying flash bootloader into Arduino Pro Mini 328P 8MHz 3.3V
I tried flash bootloader into Arduino Pro Mini 328P 8MHz/3.3V clone, but got error.
First I did test:
~$ avrdude -c usbasp -p m328p
avrdude: AVR device initialized and ready to accept instructions
...
2
votes
1
answer
81
views
Do I Have to Change Internal Interrupt Setups when I Change Clock Speed?
Do I Have to Change Internal Interrupt Setups when I Change Clock Speed? The reason I ask is because I am trying to modify this code:
https://github.com/DccPlusPlus/BaseStation/blob/master/DCCpp_Uno/...
3
votes
1
answer
675
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 ...
0
votes
1
answer
786
views
Connection of serial pin on ATMEGA328P to connector B type(female) D+ and D-
Now I am using ATMEGA328P and want to communicate with computer in serial using B connector female (also want to provide power from computer to ATMEGA328P using B connector).
So here is my question. ...
0
votes
1
answer
2k
views
Powering Arduino Pro Mini with different voltage, fuse setting
Arduino Pro Mini commonly comes in two packages, 5V 16MHz and 3.3V 8MHz.
The only difference between those two boards are regulator and clock crystal, right?
What happens if I supply 2V to VCC pin of ...
1
vote
1
answer
534
views
Error using nRF24L01+ with ATmega328P-PU. Works fine on Uno
I am trying to use a nRF24L01+PA with an ATmega328P minimal breadboard system. I first connected the module to my Uno and verified it with the "scanner" example sketch from the rf24 library, which ...
1
vote
2
answers
3k
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...) ...
1
vote
1
answer
964
views
Analog pins as output by using digitalWrite
I am making a triac-controlled light dimmer. To control the triac I want to use pins A4 or A5, because others are occupied. I have tried the following functions and methods, but nothing seems to put ...
3
votes
0
answers
699
views
Is it possible to put ATtiny85 to sleep while using TinywireS?
I have an arduino uno as the master I2C device talking to an ATtiny85 as the slave.
What I want to do is have the Attiny85 receive a message from the UNO to tell it to power off which will then ...
0
votes
1
answer
67
views
Is it possible to use SPI on Redbot Mainboard?
My students use the Sparkfun RedBot Inventor's Kit for their final design projects. The documentation about this board isn't great. There are connectors to SPI pins (they are not soldered to headers, ...
0
votes
2
answers
2k
views
Arduino core structure and timer usage
I needed to use TC1 for input capture, but also analogWrite() and an approximate 1 ms interrupt to poll the user interface (encoder, button).
The Arduino Nano's ATmega328p (datasheet, beware: a lot ...
1
vote
1
answer
551
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 ...
1
vote
1
answer
152
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 ...
0
votes
1
answer
962
views
Arduino - fuse setting problem on ATmega328P-PU
I am trying to do fuse setting on ATmega328P-PU chips using an avr programmer.
I was successfully able to do fuse setting on 3 ATmega328P-PU chips (which I bought from one of the sites - I forgot). ...
2
votes
0
answers
1k
views
PWM output maximum current
i made a project with arduino in wich I used arduino to activate 18 n-ch mosfet with PWM. I used the softPWM library to use PWM in 18 output pins, I used a nano v3.
The question is about the maximum ...
1
vote
2
answers
2k
views
I2C from two masters (ATtiny85, ESP8266) to one slave (ATmega328)
I've been working on a project with I2C protocol where an ATmega328 (Arduino) configured as slave, receives messages from an ATtiny (ATtiny85, ATTinyCore by SpenceKonde) configured as master, or from ...
0
votes
1
answer
64
views
Why is CLK_FLASH separate from CLK_CPU?
The ATmega328P has a separate clock signal for Flash and EEPROM (CLKFLASH) than it has for the RAM (CLKCPU). Why is this?
1
vote
2
answers
3k
views
Standalone 328p Programming with CH340G programmer
I have made a standalone arduino board with a Atmega328p w/ Uno bootloader taking inspiration from this video https://youtu.be/sNIMCdVOHOM
However, when I try to program mine all I get is "Problem ...
1
vote
3
answers
266
views
Can I port a project built on Arduino Uno to a standalone ATmega328 using the exact same code?
I'm building an IoT power usage monitor in which the data is logged using a RTC and an SD card module and a web app hosted on an ESP8266 gives access to this data. My question is can I use the exact ...
1
vote
1
answer
278
views
Servo jitter with two atmegas
So i'm building my own quadcopter at this moment and I have designed a flight controller board for it using two atmega328p's. I've programmed it so that the first atmega receives al the data from ...