1
\$\begingroup\$

I've been working on making a gardening system using an Arduino or an ESP32. To conserve energy, I will have the MCU sleep for long periods of time (I was planning on using pin-change interrupts to wake it up). It would be very useful to log sunlight and soil moisture data over time, but without having to wake up the MCU every 10 minutes or so to log it. So, I thought about storing or accumulating this data in a temporary storage area until the MCU woke up and logged the data (probably on a webserver).

I was thinking about using a simple solution, like analog electricity meters in houses, but I'm not sure if this is feasible. EEPROM also seems like an option, but that might be overkill.

So, is there a good method of simple short term storage I could use to lengthen the amount of time between when the MCU needs to log the data? Thank you for your help.

\$\endgroup\$
  • \$\begingroup\$ For Arduino Nano, sleep states current can be under 6 uA (you need some slight mods to it or build a bare '328), so I'm not sure I see any problem in waking the MCU every 10 minutes or so for just a few hundred uS. You would be out at the self discharge rate of almost any battery you choose to use. Storing data in EEProm would only make sense is you have lots of data, but if you only need a kbyte or so you could use Ram since it's maintained in sleep state. It's also easy to add an I2C EEProm to get lots of storage space if you really need it. \$\endgroup\$ – Jack Creasey Apr 8 '17 at 1:05
3
\$\begingroup\$

I made a temperature and humidity logger a while ago. It used an Atmega328P on a custom board. Logging is done to an SD card with a level-shifting interface board.

Temperature logger photo

That runs from 3 x AA batteries. I think I've only changed the batteries over once in the last 3.5 years.

The LED display is only occasionally used, to tell you the temperature right now if you press the red switch (plus other stuff like the date/time, the count of writes to the SD card, and the number of errors).

According to my calculations on that page when asleep it uses 6 µA, and averaging out the time taken to write to the SD card that adds 36 µA extra. Still, 42 µA is below the self-discharge rate of the batteries.

From time to time I pop the SD card out of its holder and download the resulting data.

The overall schematic is here:

Temperature logger schematic

Code and other details are available on the page I mentioned above.

| improve this answer | |
\$\endgroup\$
  • \$\begingroup\$ If @NickGammon's hand wired frightens you, you can get an Arduino Pro Mini and a Max7219 board from Ebay or Ali Express. Total should cost you less than $10 and save a lot of error potential in doing this type of wiring. And of course the addition of an SDCard give you essentially unlimited storage. \$\endgroup\$ – Jack Creasey Apr 8 '17 at 6:08
  • \$\begingroup\$ It was fun to do, but I quite agree. You can get clock boards too. I'm planning to do a proper circuit board when I get my CNC machine. \$\endgroup\$ – Nick Gammon Apr 8 '17 at 6:16
  • 1
    \$\begingroup\$ @JackCreasey - it mightn't be obvious from the photo, but that is actually one of those MAX7219 boards there. The chip is underneath. They are a bargain. The board, chip and LEDs from eBay are cheaper than the individual components. \$\endgroup\$ – Nick Gammon Apr 8 '17 at 6:21
  • \$\begingroup\$ Just as a hint, I use my CNC to make baseboards all the time, but I still use Arduino (Nano's mostly) boards as components. It reduces the amount of layout I need to do. I haven't laid out a full SMD board since I got my CNC 3 years ago. \$\endgroup\$ – Jack Creasey Apr 8 '17 at 6:26
  • \$\begingroup\$ Sounds like a great idea! I can't wait to try this. :) \$\endgroup\$ – Nick Gammon Apr 8 '17 at 6:42
1
\$\begingroup\$

If you want the absolutely lowest power method of logging data every so often, then you will want to carefully consider all of the necessary steps.

The lowest power CPU I know of is the MSP430 from TI (originally from a company in Germany that TI bought.) It can run a real-time clock on about \$1\:\mu\textrm{A}\$ and start back up from that sleeping state to full-speed operation in \$1\:\mu\textrm{s}\$. You do your tiny bit of work and then shut back down. There's nothing close that I know about. (I love Microchip because of how they support me [better than TI], but their "nanowatt" devices don't even come close.)

The next thing is storage. The absolutely lowest power writable, non-volatile memory I know about is FRAM (or FeRAM.) Luckily, TI has fielded some MSP430's with FRAM inside. So this makes things even better. The problem here will be the limitations in the amount of internal FRAM that you can achieve in current devices.

So the next problem becomes persisting that captured data to a larger persistent storage device. You've suggested the use of a webserver, I suppose thinking this might provide access to large scale flash storage. However, you could attach flash storage, as well, to the MSP430 w/FRAM and periodically to block write transfers from the FRAM to the flash storage device. These would consume power. But only so often as absolutely necessary.

On the other hand, you could consider Wifi communications. But transmitters and receivers take power, too. You may want to consider various devices for that purpose (and here, you could use an ESP32 that you'd activate from time to time using the MSP430 to do that) in order to transmit blocks to a process running on an internal, connected PC (or similar.) This option could be compared to the connected flash option I mentioned in the previous paragraph, for total energy per sample.

I don't think you can construct a lower powered device for doing the periodic data captures, though, than simply using an MSP430 with FRAM and its VLO or 32kHz clock. Any custom-designed device using COTS ICs are likely to consume more energy per sample. (Though I'd be interested to see an example that does better.)

| improve this answer | |
\$\endgroup\$
  • \$\begingroup\$ Thank you for your help, I'll make sure to look at the MSP430. \$\endgroup\$ – Anthony C Apr 8 '17 at 1:33
  • \$\begingroup\$ Suggesting two MCU's (to reduce power) seems a bit over the top and quite unnecessary for this type of simple application. \$\endgroup\$ – Jack Creasey Apr 8 '17 at 5:02
  • \$\begingroup\$ @JackCreasey I'd probably just buy an external FRAM, if needed. But I also think that these ESP devices are dirt cheap and work well for Wifi without requiring much knowledge, so I allowed for that aspect. That's all. \$\endgroup\$ – jonk Apr 8 '17 at 16:23
  • \$\begingroup\$ FRAM certainly has it's place where high speed is needed, but I'd posit not in a data logging application. It's expensive, and small data sizes compared to EEProm for chip mount or even SDCard for removable. \$\endgroup\$ – Jack Creasey Apr 8 '17 at 18:37
  • 1
    \$\begingroup\$ @JackCreasey yeah. I agree about the cost. But I don't have ANY data size info from the OP or any info about procedures the OP is willing to accept for transfers of that info. Let alone budget. Lacking that, neither of us can say much. \$\endgroup\$ – jonk Apr 8 '17 at 18:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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