0
\$\begingroup\$

I am creating a data logger that uses:

  1. ATMega328p - microcontroller
  2. SD card module to read and write data
  3. SIM800l - modem to transmit data from SD card to API
  4. OLED I2C display
  5. DHT22 temperature sensor

I want to power all this using 4 or 6 AA batteries. I do not have much knowledge about power electronics.

  • As the ATMega328p needs 5 V, I think the batteries should suffice, but the voltage output from AA batteries degrades over time and fluctuates, so do I need additional circuitry to control the input to the ATMega328p?
  • The SIM800 needs 4.2 V input, but transmitting causes a voltage drop and current bursts up to 2 A. For that I am using the power circuit given in the datasheet.

enter image description here

So what I want to know is if a 4-6 AA battery bank would be sufficient for this project. The ease of replaceability of the batteries is very important. The batteries should be cheap and easily available at local stores, hence the choice for AA batteries.

Would I need additional circuitry to supply power to the ATMega328 and other components, or would a direct connection to the battery bank suffice?

\$\endgroup\$

2 Answers 2

1
\$\begingroup\$

As ATMega328p needs 5V, I think the batteries should suffice. But the Voltage output from AA batteries degrades over time and fluctuates so do I need additional circuitry to control the input to the ATMega328p?

Charged, each battery cell is somewhere around >1.5V but discharged they near 1V. This means that if you go with 4 cells, then the input voltage will drop below 5V when discharging, which makes voltage regulation trickier. It would be better if you were using a modern MCU with 3.3V instead of an antique AVR. So your options are:

  • Use 6 cells and then you don't have to worry about the supply dropping below 5V, or
  • Use a boost or buck/boost regulator instead, or
  • Use a modern MCU with 3.3V instead.

For the relatively huge amount of current you expect, you probably want to go with as powerful batteries as you can for that reason.

The SIM800 needs a 4.2V input. But while transmitting its causes a voltage drop and current bursts up to 2A. For that I am using the power circuit given on the datasheet.

It appears to require a voltage between 3.4V to 4.4V in which case it will at least not affect your choice of batteries and regulator like the MCU does.

Either way, I would consider letting it work on its dedicated power plane. Maybe use one regulator down to 5V and another down to 4.2V.

Overall you should consider the choice of voltage regulator. The one you have picked is adjustable but comes as a fixed 5V version as well. And then linear regulators aren't ideal for battery-powered applications since they have poor efficiency. If you wish to use one as clean reference for the RF part, which is a good idea for EMC reasons, then maybe consider a switch regulator down to 5V and a linear one down from 5V to 4.2V, to power that RF device. The Micrel part you've found seems like it would perhaps suit as the 4.2V one.

Would I need additional circuitry to supply power to the ATMega328 and other components as well or directly from the battery bank should suffice?

I think it is modern enough to have a low-voltage detect feature? Otherwise you need to add an external one.

You will most definitely need reverse polarity protection to protect the board and/or batteries from frying when placed backwards. This is commonly done with a P MOSFET with the body diode in series with your supply, followed by a zener, along the lines of this.

\$\endgroup\$
6
  • \$\begingroup\$ Thanks for the detailed answer. Can you suggest a arduino based microcontroller that would operate on 3.3V. I think ATMega328 does operate on 3.3V but I would maybe need a 8Hz crystal oscillator instead of 16Hz, not sure. Can you clarify? \$\endgroup\$
    – dracarys
    Aug 19, 2022 at 7:28
  • \$\begingroup\$ @dracarys I don't know much about the old AVR stuff since I rarely used them when they were still a sensible design choice some 15-20 years back. I think the MCU should be 3 to 5V tolerant. Down-clocking it probably not a good idea since it's already so awfully slow. Aren't there Arduinos based on ARM Cortex you can use instead? Arduino Due seems to be using a modern MCU, some Microchip SAM Cortex M. \$\endgroup\$
    – Lundin
    Aug 19, 2022 at 7:49
  • \$\begingroup\$ Please note that 8 bitters is a horrible choice for low current applications. You can't just stare at their rated current consumption or they will look great. You have to consider mA per MIPS. If it takes 100 times longer for an 8 bitter to execute something while drawing 10mA, than it takes for an ARM to execute the same code in 1 instruction while drawing 20mA, then the ARM is no less than 50 times more current efficient. Also you can downclock most Cortex M to run on a low Hz oscillator and then they are very current efficient. \$\endgroup\$
    – Lundin
    Aug 19, 2022 at 7:50
  • \$\begingroup\$ Arduino Due is quite expensive. I need this project to be low cost. Any other ARM Cortex MCU suggestions that work on Arduino IDE and are cost effective \$\endgroup\$
    – dracarys
    Aug 19, 2022 at 8:27
  • \$\begingroup\$ Would the RP2040, be a better alternative? \$\endgroup\$
    – dracarys
    Aug 19, 2022 at 8:39
0
\$\begingroup\$

Atmega328p at 16 MHz is a great choice (for amateurs) for fun projects and even for real world applications.

Power supply design is critical for your project to succeed. I would pick a switching regulator to step up from a 4xAAA or 4xAA(rechargeable) to a 5 volt regulated supply. 9V to step down to 5V with an efficient switching regulator could be a second alternative.

Direct connection to a battery pack is definitely not the way to go. The voltage will vary depending on load and constant Vcc can't be guaranteed to the MCU.

\$\endgroup\$

Your Answer

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

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