Background: I'm working on a new weather station project to replace my old one. The new circuit eventually have an anemometer (3 rotating cups with magnet + reed switch type), a rain gauge (see-saw bucket with magnet & reed switch) and wind direction vane (magnet + 8 reed switch + 8 different resistors). The brains will be an atmega328P and a RFM95 LoRa transceiver. It will run for (hopefully) a long time on batteries, perhaps 3xAAA or 3xAA NiMh or 1x18650 Li-ion.
For the moment, I am just prototyping with the atmega and the anemometer on breadboard. I am trying to minimise the current draw while still monitoring the anemometer. I have it down to 2.5mA, but would like it to be considerably lower. Will post code this evening.
The atmega is running at 3.3V using 8MHz internal clock and I am saving power by disabling timer1, timer2, SPI, UART, TWI, and using SLEEP_MODE_IDLE. Maybe I could disable BOD and WDT also, not sure if that would make a significant saving at this point. I am leaving timer0 enabled so that millis() works and the chip wakes every 1ms, enables an internal pull-up, polls the anemometer pin, disables the pull-up and goes back to sleep.
I can get much reduced current draw by using SLEEP_MODE_POWER_DOWN and using the watchdog to wake up, but the minimum watchdog period is 15~16ms, which would not allow polling of the anemometer frequently enough for high winds. The anemometer's reed switch closes and opens twice per revolution and 1 revolution per second corresponds to 2.4Km/hr wind speed. To cope with 120Km/hr winds, corresponding to 50 revolutions per second and 200 reed switch openings & closings per second, I need to poll at least once every 5ms. I am also concerned that relying on the watchdog timer for long term (e.g. 15 mins) timing of the anemometer. Is it less accurate/stable than the main internal clock? I would guess so.
So, how can I further significantly reduce current consumption down from 2.5mA?
I have been considering reducing the clock speed to 1MHz, but suspect I may have to do this dynamically at run time so that I can revert to 8MHz when its time to use the LoRa transceiver to transmit sensor readings to TTN.
Before anyone suggests it, yes I have been reading Nick Gammon's excellent guide to power saving and trying to apply those techniques.