Project by Michael; Datalogging Weather Station (Battery Powered)

Michael just shared a new project: "Datalogging Weather Station (Battery Powered)"



This project will measure atmospheric conditions (Temperature, Humidity, Air Pressure) and log them to an SD card over a long period (months!) while running off a few AA or AAA cells.
Usually, projects powered by an Arduino Uno are quite power hungry and not really appropriate for extended battery power. Using a Power Timer module allows us to cycle power to the Arduino at a set interval (eg. 10 minutes) - that way we can have the Arduino wake up to perform measurements and datalogging, then send a shutdown signal to the power timer which will completely remove power until the next measurement interval.

Read more

4 Likes

Hi Michael,
it’d be interesting to see why your back of the envelope calcs differed, but 187 odd days for taking a reading every 10 minutes is pretty good. You just need to set a reminder to change the batteries.
Also I wonder how an ESP https://core-electronics.com.au/sparkfun-esp8266-thing-dev-board.html would compare. That would give you the possibility of using WiFi to save the data to a Pi and email a warning that the battery could be getting low.

Dave

2 Likes

G’day @dave50358, isn’t it curious?!
I think the major effect is my pessimistic estimates in the approximation. I was more concerned with guaranteeing a minimum mission-time rather than accurately estimating a maximum. So I built in some pessimistic estimates at each level which undoubtedly had a compounding effect.

  • The chosen battery capacity - I pulled a capacity estimate off a google search for a cell of a different brand.
  • The effective capacity - I (pessimistically) estimated I could only use a third of the battery capacity. That’s to account for the ATmega328 dropping out at an expected ~3.6V, when starting with a battery pack of only ~4.5V.
  • Power consumption at different voltages - With a full battery (high voltage) the circuit will consume more power than when the battery is nearly empty (low voltage). I measured power consumption at 4.2V which is pretty close to a full battery. By assuming the higher power-draw for all samples, rather than derating, I got a lower-accuracy but more conservative estimate for battery life.

There’s other sources of error of course - for example, I didn’t take a 4-wire measurement for voltage, there will be some loss in the test leads.

As for the ESP32, there’s a bunch of strategies to reduce power consumption on that device too - like turning off bluetooth and wifi radios unless needed etc. The Arduino port also has some pretty convenient sleep modes built-in, though if you’re using a power timer then perhaps that’s all moot. The power saving rabbit hole goes pretty deep and we’ve only just scratched the surface in this project :sweat_smile:

2 Likes

A wonderful project. The device is really useful for daily use.

Michael,
Without digging deeply, I don’t see those things being more than 20%, and you got a 500% difference.

Also at mA currents the voltage drop in the wiring should be minuscule (although the breadboard may introduce some loss) , so no need for 4wire measuring.
Dave

1 Like

Hi Michael

Really not required for voltage measurement. Using a 10MΩ meter the meter current at 5V would only be 0.5µA or 500nA. Pretty minuscule and can be ignored for this type of measurement. This 10MΩ should be considered when measuring voltage across high value resistors as it is effectively in parallel with said resistor.
I am pretty sure the 4 wire technique is used for accurate resistance measurement, particularly low values.
Cheers Bob

2 Likes

Hello, this is my first project and i keep getting “Error, couldn’t open data file” in the serial monitor.
The SD card, and air pressure sensor is located, the initial temp and humidity are present, followed by a line of measurements, and then I get the error message.

I’ve checked my wiring and run the SD card ID code, that all works fine, and the card is formatted to FAT32
The only thing I’ve changed is the DHT11 to a DHT22. I tried completely removing all mention of DHT from the code to see if it was the sensor.

Did anyone else have this problem? I’d really appreciate some help.

thanks,
V

1 Like

Hi Veronica,

Welcome to the forum!!

It looks like these two lines are the culprit:

  dataFile = SD.open(DATA_FILE_NAME, FILE_WRITE); // open with write permission
  if (dataFile) { // if we can access the file

The Arduino is having trouble starting that SD object with write permissions.

It might be the SD card lock on the side of the card (or adapter).
Or it might be something deeper, what happens if you try running some of the examples for the SD Card? (you shouldnt have to change your hardware at all).

We’re keen to help out!
Liam

1 Like

Hey Liam, thanks for the speedy reply!
The lock is off, I double checked it.
It runs the Cardinfo and NonBlockingWrite.

When I run ReadWrite, it again cant read the test text, and i get an error opening the example datalogger text.

It really doesn’t want to open things.

Hi Veronica,

How odd. Can you share some images of what hardware you are using? There may be some quirks in how those boards recognise files.

Hey Jack, sure no worries.
I’ve got a DHT22, MPL3115A2, an ard SD card modual, TPL5110 power timer (present not yet connected)


Can you post the output of the Card Info example please?

No worries, here it is:

21:44:09.585 -> Initializing SD card...Wiring is correct and a card is present.

21:44:09.649 ->

21:44:09.649 -> Card type: SDHC

21:44:09.681 -> Clusters: 1895936

21:44:09.714 -> Blocks x Cluster: 16

21:44:09.783 -> Total Blocks: 30334976

21:44:09.783 ->

21:44:09.783 -> Volume type is: FAT32

21:44:09.815 -> Volume size (KB): 15167488

21:44:09.815 -> Volume size (MB): 14812

21:44:09.846 -> Volume size (GB): 14.46

21:44:09.878 ->

21:44:09.878 -> Files found on the card (name, date and size in bytes):

21:44:09.944 -> SYSTEM~1/ 2024-08-01 21:42:54

21:44:09.977 -> WPSETT~1.DAT 2024-08-01 21:42:54 12

21:44:10.041 -> INDEXE~1 2024-08-01 21:42:58 76

Ln 39, Col 56

Arduino Uno

on COM5

3

Thanks Jack

It’s so odd that the card is recognised but you can’t write to it. Let’s try a few things:

  • Can you try a different SD card and see if you have the same issues?
  • Can you share an image of the top side of the reader so we can see what’s on the module?

I’ve tried two SD cards, the first was purchased for this project, the second older. Both work with the CardID.

I got another SD module today, the problem remains.
I tested the sensors, they are all working, and I checked for continuity of all my connections, no worries there.

With the serial monitor it will sample data from the sensors and stack it on the odd occasion, I’m unsure what causes this to happen, a data file will be written on the SD, but it’ll either be blank or corrupt.

Below is the normal situation:

with 18:42:01.038 → SD Card found

18:42:01.038 → Pressure Sensor found

18:42:01.071 → Initial Temperature: 17.90 °C Humidity: 59.50 %

18:42:01.873 → 17,0d4h15m,255,17.90,59.50,10.29,-131.50

18:42:02.672 → Error, couldn’t open data file

This is the SD module I’ve got

Hi @Veronica274861,

I’m wondering if there’s something strange going on with the formatting of the SD card.

It may be worth trying using a SD card formatting sketch such as the example one included with the SDFAT Library.