Questions tagged [atmega328p]

This tag should only be used with questions about the ATmega328p microcontroller. Questions about other ATmega series MCUs should use the tag "atmega", and those about the use of the ATmega328p within the Arduino UNO should use the tag "arduino". It is acceptable to use this tag with specific variants, like the ATmega328, ATmega328P-PU, etc.

Filter by
Sorted by
Tagged with
0 votes
1 answer
26 views

How to connect BMP390 to arduino? [duplicate]

I have a bmp390 sensor and an official circuit from the manufacturer for connecting it to i2c, but there is a problem, the ...
Settings's user avatar
0 votes
1 answer
57 views

ATMega328p wakes immediately after sleep

I'm having issues with my current AVR-C project that runs on an ATMega328p. After issuing the sleep command the chip wakes up again immediately. I want to wakeup with an external interrupt, but while ...
Julian F. Weinert's user avatar
3 votes
1 answer
172 views

Need help to understand an Arduino Capacitance-Meter program

There is a program for Arduino that without using any external component, measures value of an unknown capacitor in the range of 470pF to 18pF: https://www.circuitbasics.com/how-to-make-an-arduino-...
Meysam's user avatar
  • 73
0 votes
1 answer
52 views

How to fix a chain break? [closed]

There is a task, there is a MOSFET transistor that should, on command from an Atmega328p, close the circuits and supply power, but is it possible to somehow check this circuit for closure without ...
Settings's user avatar
0 votes
0 answers
15 views

Designing ICSP pin header while SPI slave present?

Is this portion of my schematic accurate for designing an ICSP header while there is an SPI slave? The four SPI net labels also go to the respective hardware on my 328P. I have CS (where I believe NSS ...
1W0n_29's user avatar
  • 21
0 votes
1 answer
88 views

AVR ATmega328P wrong fuses set

I was programming on the AVR ATmega328P using the USBasp programmer. I uploaded the blink example but the LED was not blinking. Thus I went on changing the fuse bits to the one Arduino has. During ...
kam1212's user avatar
  • 455
0 votes
0 answers
39 views

Making a custom programmer

I'm working on making my custom ATmega328P programmer. I am new to this and don't have a proper track on how to follow things. I have read the complete datasheet and have knowledge regarding the ...
user avatar
0 votes
1 answer
62 views

Programming an ATMega328 while on a custom PCB

I designed and had made a custom PCB for a project I am working on. The PCB uses an ATMega328 chip that sits in a socket that is soldered on the board. Currently, to program the chip, I am removing ...
Thomas's user avatar
  • 81
0 votes
2 answers
54 views

burning the code to atmega328p

I am a bit confused regarding the code uploading process to the atmega328p. I have read a site where usb-ttl was used to upload the code. There is not bootloader uploaded on the atmega328p and the ...
kam1212's user avatar
  • 455
0 votes
3 answers
43 views

Making a custom Arduino

I am working on making a custom Arduino board but I have some confusions regarding that. I have seen all the documentations but am confused regarding the ICSP pins and the communication through the ...
kam1212's user avatar
  • 455
1 vote
1 answer
55 views

FIFO buffer in the ATmega328P

I have a problem in understanding the working of the FIFO buffer. The diagram of the USART in the datasheet does not mention the FIFO buffer, and it just gives the UDR register which acts as a ...
kam1212's user avatar
  • 455
2 votes
2 answers
355 views

Detecting a break condition over UART on ATmega328P

I'm implementing a protocol which begins with an 88 µs break (low) and uses an 8-N-1 configuration. The latter is easily set with UCSRnC, but is there a way to configure the UART hardware to detect ...
19172281's user avatar
  • 685
0 votes
2 answers
124 views

DHT22 issues at 3.3V - What else could I try?

I'm attempting to use an DHT22 at 3.3V for a very low power application - remote sensor unit with a very long battery life. Currently it's on a naked breadboard with a 328p. At 5V in a spare arduino ...
user2702772's user avatar
0 votes
1 answer
43 views

How to make a circuit which can give divided voltage to ADC and can send a trigger pulse to INT0 when I press a button?

I connected 4 buttons to the ADC module of AVR-ATMega328p with different resistor values, To know which button is pressed this ...
yssh's user avatar
  • 11
1 vote
1 answer
133 views

How do I measure distance of Ultrasonic Sensor HC-SR04 using the ATmega328P Timer Input Capture?

I am using an ATmega328P MCU with an 16 MHz external oscillator. I need to measure distance of Ultrasonic Sensor HC-SR04 using the ATmega328P Timer 1 Input Capture interrupt. I have to measure the ...
Pumbaa's user avatar
  • 25
0 votes
1 answer
70 views

Software serial not sending the first byte correctly

I implemented the following program to send data to a serial monitor.When I run it, I expect to see abcd but I always see ⸮bcd: <...
kovac's user avatar
  • 343
2 votes
2 answers
62 views

Microcontroller sinking current from another MCU

I have two microcontrollers, the beloved ATmega328p and an ATtiny85. The ATtiny85 does power management (toggling power to main MCU, get buttons clicks, and other things). The ATtiny85 disconnects VCC ...
Rokas Sondaras's user avatar
1 vote
0 answers
69 views

Not being able to write&read data from the 24C04N EEPROM using I2C

I have connected the 24C04N EEPROM to the ATmega328p like this - Image source - Google The only difference is I connected the ATmega328p on a breadboard using FTDI like this - Image source - This is ...
yssh's user avatar
  • 11
0 votes
1 answer
119 views

ESP8266 responds with gibberish and 'ready' to AT commands from C program

I have gotten the ESP8266 working by sending commands manually from the TTY. Now, I'm trying to connect to wifi using the following C program: ...
kovac's user avatar
  • 343
6 votes
1 answer
429 views

How does USART know which port to use for IO?

I'm trying to learn to use USART on an ATmega328P. I'm using this datasheet. I'm using the following code to echo characters I type on my terminal: ...
kovac's user avatar
  • 343
1 vote
1 answer
79 views

Uploading sketch to ATMEGA328 via FTDI with some pins set to HIGH logic

I recently changed my PCBA design so that the digital pins 4, 5, & 6, are set to HIGH logic by default (so I can use some switches on these inputs). However, now when I upload a sketch to the ...
Newbie's user avatar
  • 153
0 votes
0 answers
87 views

What are the control lines in the ATmega328P for?

I'm trying to understand the block diagram for AVR architecture in the datasheet for ATmega328P on page 9. In it, I see that instruction decoder is connected to control lines. What are they in terms ...
kovac's user avatar
  • 343
1 vote
1 answer
216 views

Understanding assembly code for LED blink with ATmega328P

I wrote the following program to turn an LED on and off at 1-second intervals: ...
kovac's user avatar
  • 343
0 votes
1 answer
87 views

Why is ENC28J60 getting as hot as 65°C?

I am working on an Ethernet adapter and I am using ENC28J60 as SPI slave an ATMEGA328P as SPI master. The adapter works fine, but ENC28J60 really gets hot, measured with infrared thermometer and it ...
salocinx's user avatar
  • 103
7 votes
2 answers
487 views

What is the '0x04' next to 'DDRB' in the ATmega328 datasheet?

I was trying to change the value of DDRB by its memory address with the following code: *(volatile byte*) 0x04 = 0b00100000; It did not work. I got the value 0x04 ...
luek baja's user avatar
  • 269
0 votes
0 answers
31 views

FT231XS + Atmega328p not able to program via UART

I am building a board that's based off the Arduino nano but having some trouble programming it. I ripped the chip off a spare Arduino nano, so it already has the optiboot bootloader flashed. For some ...
rkrishnan2012's user avatar
2 votes
2 answers
322 views

How do I measure a pulse width using the ATmega328P interrupts and timers?

I am using an ATmega328P MCU with an 8 MHz internal oscillator. I need to measure the pulse width of an incoming pulse. The frequency of this pulse is approximately 500 Hz. Once every 2 ms, one pulse ...
turqay mammadov's user avatar
1 vote
1 answer
94 views

DIY voltmeter safety concerns

I would like to build a voltmeter using an ATMEGA328P that measures AC mains voltage. I came across the following schematic which appears to be what I am looking for: The top part of the circuit goes ...
jhorv's user avatar
  • 85
2 votes
1 answer
91 views

ATmega328P-AU VCC and capacitors & software uploads

I've designed a circuit to utilise the ATmega328P-AU on a PCBA. I'm having trouble uploading software to the chip, and wanted to check whether you think that it's okay to have both VCC connected to ...
Newbie's user avatar
  • 153
0 votes
1 answer
49 views

Erratic voltage on ATmega328P digital pin when reading switch state

I have a 12 V KCD3 unipolar switch with a LED inside. It is wired as per manufacturer specification, pin2 powers the load when switch is ON, pin 3 provides GND for LED. I would like to read its state, ...
Gianf DS's user avatar
0 votes
1 answer
70 views

ATMEGA328P-AU with USB capabilities

I would like to use an ATMEGA328P-AU microcontroller with USB capabilities (to program it and turn it into a USB Human Interface Device). So, I am thinking of using a CP2102-GMR to do that. Is it a ...
Amparo's user avatar
  • 101
3 votes
1 answer
108 views

Fan start disrupts ATmega328P's functioning

I have a 12 V power supply unit. To its terminals a 12 V fan is connected and in parallel a L7805 voltage regulator (regulates to 5 V). I use this 5 V line to power an ATmega328P controlling a few ...
Gianf DS's user avatar
0 votes
1 answer
114 views

Is it possible to exactly generate n number of clock pulses at half the clock frequency of the Atmega328p?

Let the problem be to exactly generate n clock pulses at half the clock frequency of the Atmel Atmega328p (datasheet here). To generate a PWM at a prescaled clock frequency of the Atmel Amega328p, we ...
chckx592's user avatar
2 votes
2 answers
239 views

ATmega328P flash address order

I'm currently attending a basic course on real-time embedded systems. Recently, we have been talking about embedded systems memory architecture. When doing some extra studying on memory maps, I came ...
user294957's user avatar
3 votes
3 answers
310 views

Could I change decoupling capacitors values on ATmega power pin?

I have a question about some capacitor values. I'm building, as part of my project, an Arduino with an ATmega328. For some reasons, in my design I have capacitors of 47 k that allow me to construct ...
jairoG's user avatar
  • 67
0 votes
2 answers
256 views

Guide for power supply for ATMega328 and SIM800L project

I am creating a data logger that uses: ATMega328p - microcontroller SD card module to read and write data SIM800l - modem to transmit data from SD card to API OLED I2C display DHT22 temperature ...
dracarys's user avatar
  • 121
0 votes
1 answer
302 views

How can I calculate the 10 bit binary number I have at the output of the ATMEGA328p ADC?

For example, suppose I have an AREF of 2.5 V and a voltage of 0.3V at the A0 input of the microcontroller. How would one calculate the resulting 10-bit binary number at the output
Lucio Mazzini's user avatar
3 votes
2 answers
924 views

ATMEGA328P reset circuit, not pulling down fully

Attached is the schematic of a reset circuit. When I press the reset button, the voltage on the reset pin is 2.5 V. Rmoving R13 naturally solves the issue, but I'm unclear as to why the ...
Matt Roberts's user avatar
1 vote
0 answers
129 views

Best frequency for ATmega328P using internal oscillator?

I wonder what frequency I should set for the internal oscillator of my ATmega328P. I'll only be reading and outing digital signals, 1s and 0s. I'd like for the processing to be as fast as it can get, ...
Israel Almaraz Vásquez's user avatar
0 votes
2 answers
141 views

ATmega328p microcontroller stops working and executes random instructions

I develop a system that filters water. I added two solenoid valves connected with a relay to the circuit. and uploaded this code to check if they worked well or not: ...
Kiroloes Amir's user avatar
1 vote
2 answers
628 views

Reading LM35 temperature sensor with atmega328p [closed]

I want to read the temperature using LM35 and atmega328p so when the temperature equals or less than 30 a red LED (PINB0) will be turned ON, otherwise a green LED (PINB1) will be ON but I did not get ...
Muntadher Mohammed's user avatar
2 votes
1 answer
378 views

Software disable brownout detection (BOD) on ATmega328p

I'm trying to disable the brownout detection (BOD) of a ATmega328p at runtime, before putting it into power-down sleep like this: ...
maxschlepzig's user avatar
3 votes
2 answers
141 views

Can I improve EEPROM lifetime by not changing individual bits?

In my current project I need to store (among other things) the current elapsed time in hours to retrieve it in case of power loss. Since I am using a Arduino Nano I would ideally like to use the built ...
maxmilgram's user avatar
1 vote
4 answers
210 views

Multiplexing with a limited number of pins

I want to create a 10x20/20x10 grid of LEDs by multiplexing. I will probably use an Atmega328p chip for my project, and I obviously don't see 30+ digital pins. Will any of these methods work to ...
e3rowning's user avatar
1 vote
1 answer
66 views

When does a USART 'buffer ready' bit turn on?

I have an Atmel328P mini Xplained. The datasheet specifies UCSR0A (1 << UDRE0) as a 'buffer ready' signal. This reads 1 if the receive or transmit buffer is ...
Angelo van Meurs's user avatar
-4 votes
1 answer
75 views

Atmega328p I2c to SPI [closed]

I have atmega328p and I need resend data from more sensors I2C to another atmega328p via SPI. Do you have some example? I am only beginer.
user2219071's user avatar
1 vote
1 answer
300 views

How to remove low-level audio noise from an ATMEGA328p + LM386 circuit

I'm building an audio project with an ATMEGA328p using an LM386 as the amplifier and the Mozzi audio library. Power source is 4 AA batteries. I'm using an MCP1700 voltage regulator to drop the ...
cody blanchard's user avatar
1 vote
1 answer
90 views

Why am I having communication issues between ESP12F and ATmega328?

I am working on a PCB to enable an ATmega328 to connect to an MQTT network through an ESP12F. I am using a voltage divider in the TX line from the ATmega to reduce it to 3.3v (using nets SR+ and SR- ...
Shanuver Isniyakh TV's user avatar
3 votes
0 answers
100 views

Running a 12V motor on 9V battery and arduino and matlab implementation

I have a DC geared motor rated at 12V and 60 rpm . It has a quadrature encoder with 700 PPR. I connected it directly to a 9V battery (almost new) and wished to measure the rpm of that motor. To find ...
Helix xxx's user avatar
0 votes
1 answer
181 views

SCT-013-010 - Pulse on current threshold

I have an SCT-013-010 current sensor. It has a measuring range of 0-20 A and outputs 0-1 V. I need to create a circuit that uses this current sensor, and trimming a current threshold (using a trimmer) ...
VirtApp's user avatar
  • 569

1
2 3 4 5
7