This spring I did some tests with a data logger based on an Arduino Nano microcontroller. The Nano Logger is very convenient because it requires little or no soldering and can be easily reconfigured, but it is not ideal for unattended long-term field deployment because it does not use battery power efficiently.
Above: The Arduino Pro Mini is one of the smallest and simplest Arduino boards. It has the same processor, memory, and clock speed as an Arduino Uno or Nano, but lacks a USB port.
To extend the field life, I replaced the Arduino Nano with an Arduino Pro Mini. The Pro Mini can run at 3.3 volts instead of 5 volts, and it does not have a USB port or the associated power hungry serial chip. Including a real time clock (RTC) that can wake up a sleeping processor, this logger should be able to outperform the Nano Logger.
Above: The main components of the Mini Pearl Logger. The three PCBs are (L to R) RTC, Pro Mini, microSD board. The toothbrush thing is an I2C hub which allows multiple sensors to be connected. An detachable RGB LED (bottom) can indicate operational state if the LEDs on the PCBs have been removed to save power.
Ed Mallon's Cave Pearl Logger uses a similar combination of components, and Ed has done extensive testing to extend the field longevity to more than a year. I have not yet applied all of the Cave Pearl Logger's hardware and software magic, and hope to try some of them incrementally.
Above: Seventeen wires must be soldered to the Pro Mini (one is missing here) and four more connect the RTC. Each sensor needs another four wires. It's a lot of soldering, but it's very straightforward to connect everything up.
For my first iteration I did not disable the LEDs on the boards, so two bright LEDs are on all of the time burning power. I assembled the logger without replacing any resistors or adding a voltage divider. So this was a minimalist version of the Cave Pearl Logger which has to be called the Mini Pearl Logger.
Above: Example wiring diagram for the Mini Pearl Logger. The indicator LED is optional but is handy to confirm that operation is normal in the field before deployment. It can then be unplugged.
Above: A simpler wiring diagram for the Mini Pearl Logger. One or more I2C sensors can be connected to the pass through I2C lines on the real time clock board.
I modified one of Ed Mallon's basic sketches to log data from three temperature sensors (MCP9808) and one barometric pressure, temperature, and humidity sensor (BME280). The sketch puts the processor to sleep between data saves. The MCP9808 sensors were also put to sleep individually. The microSD board was not explicitly put to sleep, so I don't know if it is burning lots of power all the time. If anyone can discern that from the sketch below, please let me know.
Above: The assembled and working Mini Pearl Logger. The sensors are not yet attached.
I tried out the logger in the compost pile, but I did almost everything wrong. The three MCP9808 temperature sensors were placed in long PVC tubes and inserted toward the center of the pile, and the one BME sensor was next to the pile. But I forgot to change the sampling interval from one minute to something more reasonable. And I didn't notice that the MCP9808 sensors were not being read properly, so I didn't get any data from the hot center of the compost pile. And the four AAA batteries lasted only about 55 hours which was disappointing, but collecting no data for 55 hours is probably better than collecting no data for a week.
Above: The Mini Pearl Logger is in the Nalgene bottle and three 70cm PVC tubes are inserted into the pile (black film vials cover the tube ends). A BME280 sensor and the indicator LED are outside the bottle, so I put a rain cover over it.
I'm not sure if the short battery life was primarily due to the SD card using power or to the two board LEDs using power. I figured out the MCP9808 failure (a delay of 0.25 seconds between waking and reading the sensor is sometimes not enough) and I deployed the device again with the sampling interval at 10 minutes. I guess it will last several days now.
Above: The logger saved data from the BME280 sensor next to the compost pile, so I got 55 hours of temperature, humidity, and pressure data.
I made a second logger, so I plan to disable the LEDs on the boards (apparently easy to do with a soldering iron), and see how long it lasts. I think there are some other tricks I need to learn to extend battery life. With luck, it will eventually take a very long time to learn if my incremental changes improved longevity.
Above: These are the parts included in the Mini Pearl Logger Kit at the KAPtery (plus some wire). [Update: a different microSD board and card are now included in the kit.]
I have a few extras of the components for this logger, so if you want to try assembling one and see how long you can make it log data, I can send you a kit for $19.00.
Here is the working sketch I am using on the Mini Pearl now: __ Mini_3MCP_0.2.txt
I almost fell over laughing at the name of this post (and am a bit jealous that I did not think of it...) Your logger should be running for much longer time. Remember to clip off the LED's or they burn more power than the rest of the logger combined. Also, you only need a voltage regulator on the SD adapter board if you are using a 5v Arduino. SD cards work fine without reg&level shifter on a 3.3v promini board, and that saves alot of power.
Take a look at the way I put the bare bones units together: https://edwardmallon.wordpress.com/2017/06/19/arduino-data-logger-2017-build-update/
The screw terminal expansion shield provides a nice base to hold the pieces together in a tight package that ought to fit inside your nalgene. Also note that I only used tape for the first few of them, now I use epoxy putty ($5 a tube at the local hardware store) to hold the boards together very rigidly.
Reply to this comment...
Log in to comment
I disabled the LEDs and deployed the Mini Pearl Logger in the compost pile again. The batteries lasted 6.5 days instead of 2.3 days. So I guess that really isolates the SD card and board as the energy hog. I am using that big Catalex microSD board in the photos above instead of the smaller boards that you are using. I also used a 4GB uSD card (it says SanDisk but who knows). I guess that combination is so bad that it drains the batteries in a week.
So I have ordered some of the little microSD card boards that you use with the four separate resistors. Also ordered some smaller microSD cards. Until they arrive, is there anything to try with the SD boards I have? Is there any way to disable or bypass the level shifter or regulator on the boards I have?
I am also confused about sleeping the SD card board. My sketch uses your code to explicitly sleep the processor:
LowPower.powerDown(SLEEP_FOREVER, ADC_OFF, BOD_ON);
Do I need other code to sleep the SD card/board? I used your code to pull up the SPI pins:
digitalWrite(chipSelect, HIGH); //pullup the CS pin digitalWrite(MOSIpin, HIGH); //pullup the MOSI pin digitalWrite(MISOpin, HIGH); //pullup the MISO pin
How does the SD card know to sleep?
I can't wait to get the new components and try to beat 6.5 days.
Temperature data from two MCP9808 sensors in the middle of a compost pile that was cooling off. The LEDs on the Arduino Pro Mini board and RTC board were disabled. The batteries powering the Mini Pearl Logger lasted about 6.5 days which is more than twice as long as they lasted when the LEDs were present, but not long enough.
Is this a question? Click here to post it to the Questions page.
Reply to this comment...
Log in to comment
I found that pulling up the three lines usually helps the cards sleep faster. Unfortunately this is completely controlled by the sd controller circuitry so you dont really have direct control over it.
Generally, when you put the arduino to sleep with the lowpower library (or any other method) good SD cards should auto-sleep within one second of those three lines going high. However I struggled mightily at the beginning with a whole bunch of crappy sd cards that would not sleep properly. Now I stick to 128 & 256mb Sandisk cards, which you can only buy used from eBay, and half of the ones you do get are fakes with high sleep current. The best option is to just try a few and see which ones work best. I have also had good luck with MUVE music sd cards, which were given away with the cricket music service, but they are weird because they are 4gb cards with 3gb hidden by crickets music encryption. (so they sell cheap on eBay because no one wants them) However they were made by Sandisk, so they usually sleep ok. I've also seen cards wake up with bad voltage regulators, where rail noise keeps waking them up even though the main board is asleep.
Generally a ds3231, SD & promini combination should sleep at around 0.25mA or less.
Reply to this comment...
Log in to comment
Login to comment.