Optimizing power consumption on Arduino Nano for a weather station

Hello everyone, this is my first post on a forum like this, I'll try to make this as concise as possible. I've started a project to measure Temperature and Humidity both inside and outside my house, to study how hall heating and outside temperature interact, as well as thermal inertia etc.

The problem is, I thought a 9V Alkaline battery would be enough to power everything for 1-2-3 days (3 would be more than enough), but after researching a bit it turns out, it might be a problem.

The set-up is:

  • x1 Arduino Nano
  • x1 MicroSD card reader (5V or 3.3V)
  • x1 DHT22 Temperature and Humidity sensor (5V or 3.3V)(Measuring: 0.5 mA, Standby: 15 μA)
  • x1 9V Alkaline Battery
    *(Optional) x1 LM35DZ (To just measure Temperature if the DHT22 consumes too much)

So, I've read about how the Vin pin from the Arduino dissipates the exceeding energy from the 9V to turn it into 5V, and I've also read that a x4 AA/AAA rechargeable batteries would have much more capacity and would be better. Should I aim for that configuration instead of the 9V battery?

Edit: I'm probably going to use x4 AA Rechargable Batteries at 1.5V so we start at 6V instead at 4.5V, which is already lower than 5V and will continue to decrease with time.

Should power everything that admits 3.3V with just 3.3V (instead of 5V if they admit it), to save energy, or that doesn't work like that?

I would like to measure once every minute (could be more or less often depending on battery life), so I get the current temperature and relative humidity values, and I store them into the SD card in a .txt separated by commas in order to read it as a .csv on the computer later.

In order to do that I've seen that the Arduino has different sleep modes:

  • SLEEP_MODE_IDLE: 15 mA
  • SLEEP_MODE_ADC: 6.5 mA
  • SLEEP_MODE_PWR_SAVE: 1.62 mA
  • SLEEP_MODE_EXT_STANDBY: 1.62 mA
  • SLEEP_MODE_STANDBY : 0.84 mA
  • SLEEP_MODE_PWR_DOWN : 0.36 mA

It also can deactivate some functionalities (ADC for example) to save additional battery life, if I'm not mistaken.

So, how should I set up my Arduino to work in order to just take a single measurement every minute and then just consume the least energy as possible? Could I deactivate everything but some Timer0, or interrupt, so the ONLY thing the Arduino does, is keep track of millis() or something similar in order to just know when to wake up and take the next measurement?

Edit2: I've read that you could also store data in an array and only save it into the MicroSD once every hour or so. Would this make sense in this case to save energy?

All of the information I read on this topic was from: Gammon Forum : Electronics : Microprocessors : Power saving techniques for microprocessors

Minimising power consumption involves both hardware and software.

  1. Battery. 9 volts has to be regulated down = power loss. Use 4.5 volts or so.
  2. Nano has a power hungry USB chip, voltage regulator and led. Use a barebones atmega328P (or a pro mini with some modifications).
  3. Ensure that peripherals such as the SD card reader can be shut down when not in use.
  4. Then look at sleep options for the MCU.
1 Like

First of all, thank you very much for the reply! :smiling_face_with_three_hearts:

  1. Battery. 9 volts has to be regulated down = power loss. Use 4.5 volts or so.

Okay I will do that, but wouldn't it make more sense to do what I said in the edit?:

Edit: I'm probably going to use x4 AA Rechargable Batteries at 1.5V so we start at 6V instead at 4.5V, which is already lower than 5V and will continue to decrease with time.

  1. Nano has a power hungry USB chip, voltage regulator and led. Use a barebones atmega328P (or a pro mini with some modifications).

To keep everything simple or at least with the hardware I already have, is it possible to turn off any of those functionalities, like the LED for example? I'll keep in mind though, that there are better options for battery powered projects, over the Arduino Nano.

6 volts is at the absolute limit for an ATmega328p chip such as that on the Nano.
If those rechargeable batteries deliver a maximum of 1.2 volts or less, that will be OK.

Then you feed this into the Nano's 5v terminal. With an unmodified Nano, this takes about 15mA. (I've just measured it - not in sleep mode). How that is distributed over the Led, regulator and USB chip, I am not sure.

You can't turn these components off. You can remove the power led and the regulator and still be able to power it with batteries and program it over a USB cable. If you remove the USB chip then you'll need to program it with an external USB/Uart adaptor.

Can you provide a link for the SD card reader you are using.

6 volts is at the absolute limit for an ATmega328p chip such as that on the Nano.
If those rechargeable batteries deliver a maximum of 1.2 volts or less, that will be OK.

If I plug it to the Vin pin wouldn't all the problems be fixed? Only a little is wasted from 6V to 5V and it won't affect the ATmega328p because it lowers from 6V to 5V right?

The MicroSD card reader is a generic one from Aliexpress:

https://www.aliexpress.com/item/1005001861949506.html?spm=a2g0o.order_list.order_list_main.15.5f8a194dcDBgH2&gatewayAdapt=glo2esp

SD card readers are may or may not have 5v tolerant pins. Here is one that claims it has: https://universal-solder.ca/product/micro-sd-memory-card-adapter-for-arduino-with-3-3v-5v-converter/ It is not clear from the description if yours is 5v tolerant.

You should also probably switch the power off to it when not in use. There is no specific shutdown pin but you could use a transistor to supply power to it on demand.

You can also run the Nano on 3 volt battery power, but then you need to run it at 8MHz, say using the internal oscillator.

From the pins of the MicroSD reader, it is labeled as 3.3V input, so I could do that.

Your link is to a seller with 3 different SD card module variants. They call them TF Module, SD Module and Mini SD Module. Which one are you referring to?

Your link is to a seller with 3 different SD card module variants. They call them TF Module, SD Module and Mini SD Module. Which one are you referring to?

The one for TF (which is also compatible with MicroSD cards I believe). If I'm not mistaken, MiniSD and SD are much bigger.

The Vin pin on the Nano is the input to a 5V linear voltage regulator. To operate properly, that regulator needs the input to be 1.5-2.0V above its 5V output. So the minimum voltage you can apply to Vin is usually considered to be about 7V. You could use 4 NiMH AA batteries, which are about 1.2V each, but in that case you would connect them directly to the 5V pin of the Nano, bypassing the regulator. That would be close enough to 5V, and should give you a lot more battery life than a 9V battery. You just have to be sure that when fully charged the 4 AAs are at 5.5V or less.

Your SD card module has a similar setup. The Vcc pin feeds a 3.3V linear regulator (SD cards are 3.3V devices) with similar headroom requirements. But your module has no separate 3.3V input pin, so you have to supply it with 5V or more. But if that 5V comes from the Nano's voltage regulator output, the current may be too much for it. So powering the module directly from the 4 NiMH batteries is probably the best option.

You can power the DHT22 from a GPIO pin on the Nano, which will allow you to power it down between readings. But you can't do that with the SD card because the current requirement is too great. You would need a P-channel mosfet for that, which would be switched from a GPIO pin on the Nano.

Also, you don't have to save each reading to the SD card. You could collect 10 or 20 readings, then write all of them to the card at once. That would save power.

It seems to me that using 4 NiMH rechargeables, or 3 alkaline, AA cells is the best option. You would power the Nano via the 5V pin, and the SD module via its Vcc pin, directly from the battery pack.

If you are good with a soldering iron, you could also remove the power indicator LED on the Nano, which is just wasted power.

1 Like

Yes, thinking that is a problem! You already changed your mind about that, but just to confirm, the typical capacity of a PP3 size 9V battery is around 500~600mAh. If you use a linear regulator to reduce that to 5V (like the Nano's built-in regulator) the regulator will waste approximately four ninths of that capacity as heat, reducing the effective capacity to 280~330mAh. That's enough to power the Nano, alone, for maybe 22 hours. Add the extra current for the other components and ...

You could improve this a little by using a switch-mode regulator, also called a DC-DC converter or buck converter. You would adjust it to output 5V and feed this directly to the Nano's 5V pin, bypassing it's built-in regulator. Buck converters are significantly more efficient than linear regulators in most situations, so if we assume 80% efficiency, you should get 400~480mAh from the PP3. That could power the Nano, alone, for perhaps 32 hours.

1 Like

You could improve this a little by using a switch-mode regulator, also called a DC-DC converter or buck converter.

I do have some level shifters around (if those are the same you were talking about), I could try to use them.

So I'm trying to process all the help and information you guys are giving me. I tried to picture how this would be looking at the moment in Fritzing (first time using this software). Tried to picture it as clean as possible, I have no experience drawing this kind of diagrams.

I used generic components from Fritzing, so I attach as well, my ACTUAL setup (please ignore my soldering skills, my tin, flux and soldering equipemt are 45 years old hehe).

My setup:

MicroSD Reader:
image
image

Level shifter:
image

This arises more questions for me...

1. Are this connections correct? (which I honestly doubt)

2. Since the MicroSD card is powered with 3.3V, do all the connections (MOSI, MISO, CS and CLK), also have to be 3.3V, and passed through the level shifter? As I did in Fritzing?

3. In order to power everything from the batteries we were discussing, the setup would be identical but with the 4.5-5V coming from the batteries connected to the 5V pin from the Arduino Nano?

Also, I really appreciate your time and help guys. Never posted in any kind of forum before and the experience is being very enriching. :heartbeat:

Your microSD card module is not the one I believed you had. It is 3.3V only, and yes, the SPI lines feeding into it need to be 3.3V, not 5V.

But even if you do the translation, I don't believe the 3.3V output pin of the Nano will deliver enough current to power an SD card.

No. I was talking about a DC-DC or "buck" converter. These are power supplies, taking power from one voltage and creating power at another voltage. They can provide 5V or 3.3V supply from a 9V supply, for example, but more efficiently than a linear regulator.

You are talking about a logic level converter or adapter. These translate logic signals from one level to another. A logic signal carries information/data, not power. A logic level converter normally requires an external power supply for each of the 2 voltage levels it is converting between, it does not create those voltages itself. (I have seen a logic level converter that could create a voltage level, but it was not the ones shown in your pictures/diagrams).

But you will need a logic level adapter in your circuit, if you continue to use a 5V Nano with a 3.3V SD card adapter. The one in your pictures looks suitable for that purpose. The adapter shown in your diagram would not be suitable, I think.

Personally, I avoid using components that require different power supply voltages in the same circuit, as far as I can. For battery powered circuits I prefer to use only 3.3V components. For example, a 3.3V Pro Micro or Pro Mini.

Most beginners make the same mistake when they first use Fritzing. They start by laying out the circuit on a breadboard. They should start by drawing a schematic. Fritzing unhelpfully starts up in breadboard view, encouraging this misconception.

Fritzing has a Schematic mode or view, in addition to breadboard and PCB design views. You should start by drawing a schematic. This will help you get the connections correct (in schematic mode, all the pin's names are shown) without being concerned about the layout. Once the schematic is done, you can switch to breadboard view and lay out your circuit on breadboard. Fritzing will help you by checking that all connections are the same between the two views.

We can't check the connections because you have posted only the breadboard layout, and in that view, the pin names are not shown. Also, the logic level converter is not the model you plan to use, and will have a different pin layout. Try to find and use a better matching component in Fritzing. You can download extra libraries of components to Fritzing. Maybe a component library is available which contains the logic level adapter you have.

As @ShermanP points out, the 3.3V output of Nano can supply only a small current, not enough to power an SD card. SD cards are quite power-greedy when they are in use.

It does not matter if we ignore them or not. If your soldering is bad, the circuit will not work!

Even if he had the other microSD card module, shown below, which could be powered by 5V, and which also has the translator chip, there is still a question whether the 5V regulator on the Nano could properly power an SD card. It would be dropping 4V with no heat sink. It would probably work if the SD card is only powered up occasionally, but no guarantees.

An alternative would be to power the SD module directly from the 9V battery. But then the 3.3V regulator on the module would be dropping 5.7V, and wasting most of the power it draws.

I think in the end it's going to be easier and cheaper to get the other SD module, and power everything from some battery pack at around 5V. Or use the existing SD module and get a 3.3V Pro Mini, so everything is at 3.3V.

microSD module

With respect to level shifters for the SPI lines, I've never seen anyone use those bidirectional shifters successfully. And for the SPI lines specifically, you don't need bidirectional lines. You have MISO which is an SD card output at 3.3V, which doesn't need translation at all since 3.3V will be recognized as high by a 5V Arduino. The Adafruit SD module just connects them directly, and it works fine.

The other three lines (MOSI, SCK and CS) are Arduino outputs at 5V. It looks like the OPs 3.3V module has 10K resistors to 3.3V on those lines. So you can connect the three Arduino SPI pins to the module pins through reverse-biased signal diodes (1N4148). The Arduino can bring the lines low, but the diodes block any 5V output from reaching the SD card. Instead, the 3.3V pullup resistors bring them high when the Arduino isn't bringing them low.

You may lose a little speed doing it this way, but if you have three extra diodes, it's a pretty simple hack that works. But you still have to provide 3.3V power to the module, which is the primary problem in this case.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.