-1

I moved from an Arduino to a bare ATmega328P-PU (to save energy). First I wanted to start a blink-script to verify that it's all working. For this I flashed the bootloader and uploaded the blink-script on the microprocessor. On the arduino the internal pin was successfully blinking. Then I unmounted the ATmega and put it into a breadboard.

I wired everything up. The LED to GND and pin 13, on the other side I put in 5V from a battery, and GND of course. Between the LED and GND I added 220 Ohm and surprisingly if I power it over battery inside the Arduino the internal LED blinks but my own LED (the one with 220 ohms) does not. If I power the arduino over USB both of them blink.

Do you have any ideas on how I can fix this?

4
  • 1
    Have you attached a 16MHz Crystal with 22 Pico farad capacitors to the Atmega on the breadboard ??? It's essential and you didn't mention this. Feb 3, 2020 at 11:40
  • Please add your wiring scheme in both of the states when it's blinking succssfully and when it's not, because it's not very clear what you mean. Feb 3, 2020 at 11:45
  • I'll do that as soon as I'm at home again. And no I haven't added any of these parts yet. But doesn't the ATmega have an internal 8 MHz clock? How can I use that one? Feb 3, 2020 at 12:57
  • You will have to "burn the bootloader" to setup the fuses to use the internal 8MHz but if you programed the ATMega328 as an Arduino Uno you will need to attach these components Feb 3, 2020 at 13:27

1 Answer 1

2

This might help you alot

The ATMega328 is 8bit AVR microcontroller with a wide variety of things, in order for this IC to work it's essential to have a "Clock Source".as default of Arduino UNO it uses a 16MHz Crystal oscillator with two 22pF capacitors in order to generate the clock signal so, if you took the ATMega328 from the Arduino and put it in a breadboard you should connect these components in order it to work as well as pulling up RESET pin to VCC.

The Atmega328 has a lot of internal calibrated oscillators, from them are 8MHz and 1MHz and alot more, but in order to them to work you need to configure them first by setting up things called "high fuses and low fuses" these control alot of things in the microcontroller from them they determine the clock source.

As how to burn the bootloader to set fuses is not the topic of the question, I won't come to details about it.

3
  • 1
    Re “a lot of internal calibrated oscillators”: it's actually one oscillator with a programmable prescaler (i.e. frequency divider). Feb 4, 2020 at 19:16
  • @EdgarBonet Okay maybe I have missed that one ... Thanks for your note. Shall I edit the answer or leave it ? Feb 4, 2020 at 19:20
  • 1
    You may edit if you want. Otherwise do not worry: I am just nitpicking, and yours is a perfectly good answer. Feb 4, 2020 at 19:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.