I’ve redesigned my Arduino weather station to incorporate a P-channel MOSFET to switch power to the peripherals on and off to hopefully save battery life. The ATmega328P always gets 3.3v, but then uses Sleepy() to conserve power anyway, but the DHT11, BMP085, DS18B20 and nRF24L01+ get powered off when not in use. Oddly enough the voltage seems to drop to 0.7v rather than 0v completely, but I guess no current flows.

I had to change my code a little to re-initialise the radio once per loop and control the MOSFET from a digital pin: download.

I tidied up the veroboard a bit – pink wires are 3.3v constant for the ATmega, red wires are controlled by the MOSFET, black is GND, blue is data:

img

I hard a hard time finding a through-hole MOSFET than worked at TTL voltage (the FQP7P06 I first tried only worked properly at CMOS 5v) but I eventually settled on the NDB6020P which can be switched using as little as 2.5v.

I’m currently calibrating the DHT11 and keeping an eye on how long the battery lasts, so for the moment the weather station is in the house rather than the shed, here’s some results (its also tweeting using Python/C++ on the RaspberryPi, I didn’t need to update them):

img

Update: it seems that turning the peripherals on and off is making the readings from them more reliable, as the BMP085 and DS18B20 readings are almost identical and the DHT11 is within one degree – given that it uses integers this is as near as it will get.

Update 2: the weather station has been running on 2xAA’s for over 12 days now, without the MOSFET it would last under 8 days.

Update 3: the board eventually stopped after 30 days, although since then I’ve been having problems with it stopping even though the battery is not dead – perhaps a range problem…. Anyway I’ve added the boards.txt definition I used below:

atmega328bb.name=ATmega328 on a breadboard (3.3v, 8 MHz internal clock)
atmega328bb.upload.maximum_size=30720
atmega328bb.upload.protocol=usbasp
atmega328bb.upload.using=usbasp
atmega328bb.bootloader.low_fuses=0xE2
atmega328bb.bootloader.high_fuses=0xD8
atmega328bb.bootloader.extended_fuses=0x07
atmega328bb.bootloader.path=atmega
atmega328bb.bootloader.file=ATmegaBOOT_168_atmega328_pro_8MHz.hex
atmega328bb.bootloader.unlock_bits=0x3F
atmega328bb.bootloader.lock_bits=0x0F
atmega328bb.build.mcu=atmega328p
atmega328bb.build.f_cpu=8000000L
atmega328bb.build.core=arduino
atmega328bb.build.variant=standard