Atmega328p-au powering the chip with batteries

EDIT: I changed the title from, burning pro mini bootloader; does it need an external crystal?, rather than starting a new thread. See post #12

Hello

I’ve ordered some parts to experiment with an atmega328p-au chip, with the intention to shrink my current project by replacing a Pro Mini with a stand alone chip.

The plan is, although not attempted yet, due to parts having not arrived. If I burn the Pro Mini bootloader, it being 3.3V 8MHz, will I need an external 8MHz crystal?

I’ve read the data sheet and it does have an internal clock, which can be affected by temperature, causing the clock to increase or decrease accordingly, which is not a problem.

To rephrase my question, by using the Pro Mini bootloader, will that set the internal clock speed of 8MHz? Without me having to adjust settings etc, if it doesn’t then I’ll use an external crystal.

Hope my ramblings make sense. I’ll read tons of websites and watched videos but I’m not finding what I need.

Thank you

In Arduino IDE, when you "burn bootloader", also the fuses will be set. Fuses are some kind of "switches" that set very basic configuration settings of the microcontroller, like oscillator source (internal/external), oscillator frequency and more.
With Arduino Pro Mini bootloader there are only 2 variants (as much as I know): 16 MHz external (for 5 Volts) and 8 MHz external (fort 3.3 Volts).

So: Yes, with Arduino Pro Mini bootloader you always need an external crystal (or resonator).

How to work with internal oscillator?

  • You can use LilyPad bootloader which uses 8 MHz internal oscillator.
  • Or you can download and use MiniCore which supports several microcontrollers and frequencies (internal and external).

(There are also other ways, like make "your own" configuration by editing the file "boards.txt".)

uxomm:
In Arduino IDE, when you "burn bootloader", also the fuses will be set. Fuses are some kind of "switches" that set very basic configuration settings of the microcontroller, like oscillator source (internal/external), oscillator frequency and more.
With Arduino Pro Mini bootloader there are only 2 variants (as much as I know): 16 MHz external (for 5 Volts) and 8 MHz external (fort 3.3 Volts).

So: Yes, with Arduino Pro Mini bootloader you always need an external crystal (or resonator).

How to work with internal oscillator?

  • You can use LilyPad bootloader which uses 8 MHz internal oscillator.
  • Or you can download and use MiniCore which supports several microcontrollers and frequencies (internal and external).

(There are also other ways, like make "your own" configuration by editing the file "boards.txt".)

Thank you for confirming.

I’ll into a resonator, as that’ll be a bit smaller than a crystal. I’ll also look into the Lillypad, as I had not considered anything else.

Now I’m just thinking about the 3.3V output of the Pro Mini, which is what I want. Will the bootloader set that too or will I need voltage regulators? I’m assuming voltage regulators.

Use MiniCore; it’s made for applications like this. It gives you much more flexibility and is actively maintained.

The internal 8 MHz oscillator works great but is not as accurate as an external resonator/crystal.

MiniCore would be the best choice!

exiledyorkie:
I’ll also look into the Lillypad, as I had not considered anything else.

When I mentioned Lilypad, I did not mean you should use a LilyPad board but only use the LilyPad bootlaoder with your ATmega328 microcontroller (as LilyPad does also use a 328 but with the internal clock source of 8 MHz).
The LilyPad bootloader is part of the Arduino IDE.

exiledyorkie:
Now I’m just thinking about the 3.3V output of the Pro Mini, which is what I want. Will the bootloader set that too or will I need voltage regulators? I’m assuming voltage regulators.

The bootloader (fuse settings) will not change any voltage.
There are two different versions of Arduino Pro Mini:
Arduino Pro Mini 328 - 5V/16MHz
and
Arduino Pro Mini 328 - 3.3V/8MHz

They have different voltage ragulators.

If you want to make your own "stand alone" board with ATmega328 take a look here:
http://gammon.com.au/breadboard

hansibull:
Use MiniCore; it's made for applications like this. It gives you much more flexibility and is actively maintained.

The internal 8 MHz oscillator works great but is not as accurate as an external resonator/crystal.

I've not come across Minicore before, I'll have a google and see if it looks easier to me. That's both people who have mentioned it, so it's promising.

uxomm:
MiniCore would be the best choice!

When I mentioned Lilypad, I did not mean you should use a LilyPad board but only use the LilyPad bootlaoder with your ATmega328 microcontroller (as LilyPad does also use a 328 but with the internal clock source of 8 MHz).
The LilyPad bootloader is part of the Arduino IDE.
The bootloader (fuse settings) will not change any voltage.
There are two different versions of Arduino Pro Mini:
Arduino Pro Mini 328 - 5V/16MHz
and
Arduino Pro Mini 328 - 3.3V/8MHz

They have different voltage ragulators.

If you want to make your own "stand alone" board with ATmega328 take a look here:
Gammon Forum : Electronics : Microprocessors : How to make an Arduino-compatible minimal board

I understood about the Lilypad bootloader, I was just getting at the fact I know nothing about that board. I guess it makes no difference really, as it is the same chip.

Currently I'm using a Pro Mini 3.3V as it's being used with a BME280 sensor and a nrf24l01+. I thought I'd have a go at creating my first PCB but as it stands, I thought it'd be too basic to use the Pro Mini. Which is why I'm going to try and get a stand alone chip to work. I wanted to stick with the Pro Mini bootloader, as the brown out works well along with the two AA batteries, which are powering the circuit.

Now I'm thinking I'll need a voltage regulator to maintain 3.3V, for all the other modules. In my mind I was still going to run those from the chip, stupidly.

Any reccomendations with regards to the volt reg? Maintain a 3.3V to power the chip and all of the modules, or just power the chip directly from the battery source and just have a volt reg to power the rf24 and bme separately. Again, if I'm making sense there. thanks

I do not think that a regulator is needed at all.

nRF24 voltage range is: 1.9 - 3.6 V
BME280: I have seen different boards, some are: 1.8 - 5 V, others: 1.8. - 3.6 V
Pro Mini 328 at 8MHz (or standalone at 8 MHz) will work down to about 2.3 V (and 5.5 V max.)

With two AA batteries (non rechargeable) you get about 3 V, that looks fine for all the components.
I would just give it a try.

Yes, it works perfectly with the Pro Mini with a very small current consumption, I forget what it is now.

But I’m referring to needing a voltage regulator when I’ve replaced the Pro Mini with the stand alone chip, to feed the modules.

I think I misunderstood you. You DO mean a standalone chip but referring to a Pro Mini bootloader.

I’d just be worried about supplying the nrf24 with a too high a voltage.

Take a look at the parts (modules) you use and the voltage range they can work on.

Yes, it’s 3.6v max for the nrf module.

Like a fool I was thinking the chip could output 3.3v. I’ll have to supply 5v maybe and step down to 3.3v.

exiledyorkie:
Yes, it’s 3.6v max for the nrf module.

Like a fool I was thinking the chip could output 3.3v. I’ll have to supply 5v maybe and step down to 3.3v.

Yeah NRF24 modules works on 3.3V, if you are providing 5V, it may burnt it out. I have once worked on NRF24L01 and have provided it 3.3V from Arduino Pro Mini.

You can use LM317 to design a variable power supply and can adjust it to 3.3V. It's safe to use heat sink with LM317.

So, the bootloader has been loading using Minicore, thank you for that! The blink sketch works, so now I’m going to try and rebuild the project using the chip, rather than a Pro Mini.

I’m using the chip, nrf24l01+ and a bme280 sensor. I’m planning on using two AA batteries, any advive with regards to voltage regulator or ldo to maintain 3.3V. Not sure what to use as the voltage will not be constant from the batteries. I’m going to make a small pcb to install everything, so I want small components rather than a large volt regulator which will kick out a lot of heat and possibly skew the temp readings.

Another plan would be to reduce the BOD to 1.8V as everything should run that low, including the modules and just power directly from the batteries. Any advice with regards to capacitor size for the voltage input to the chip (100nF). I’m using a capacitor for the rf24 already and the bme280 has a voltage regulator.

I’m going to build it later and just test with AA batteries, just curious to peoples advice and for components which I may not have found.

I know I’m re-asking questions here but I can’t find any details for what I’m asking. Thank you