Improving power consumption on my DIY temp & humidity sensor

The goal of this project is simple, a device that reports temperature and humidity data on an interval to a MQTT server that can be read on my mobile device. The device need to run on 3V battery for ~3 months. However, it was disappointing that in real life testing, this device consumes more power than expected and it only lasts about a week-ish.

I need help on improving the power consumption so this device lasts longer. Any idea is welcome.

This is how it works on high level:

  • ATTiny85 wakes up every ~20 mins from sleep and turns on the sensor circuit (DHT22 and ESP-01S) and the LED indicator,
  • DHT22 and ESP-01S receive power, collect temperature and humidity data and connect to MQTT server for data transmission. This process usually takes about 6 to 8 seconds. Once data transmission is done, ESP-01S fires a signal to let ATTiny85 know that the job is complete, it can now turn off the circuit. As failsafe, if for some reason the process takes up more that 15 seconds, it forces the circuit to turn off.
  • Repeat

My thoughts:

  • I could remove the LED indicator but I would like to keep it if possible
  • I am not using the best transistor 2N3904 here
  • There are ways to make ESP-01S consumes less power but I would rather keep it physical modification free if possible
  • Maybe I don't need voltage convertor Pololu S7V8F3(coverts 3V to 3.3V), I heard both DHT22 and ESP-01S can run on 3V

Components:

  • ATTiny85 chip
  • ESP-01S
  • DHT22/AM2302 temperature and humidity sensor
  • Pololu S7V8F3 step up voltage convertor output 3.3V
  • 2N3904 transistor
  • 3V battery
  • Couple resistors
  • Couple bypass capacitors
  • 1 LED indicator

The diagram, schematic, and code(attached)

Attached code for both ATTiny85 and ESP-01S.

makeral-weather-station-timer.ino (2.17 KB)

makeral-weather-station.ino (7.22 KB)

Look into doing away with the step-up converter. It will be constantly consuming power, whether the AtTiny85 is asleep or awake.

Glorymill:
Look into doing away with the step-up converter. It will be constantly consuming power, whether the AtTiny85 is asleep or awake.

Thanks, I'll test it out.

  • ditch the converter
  • use 18650 battery (rechargeable, vmax 4.2 vmin 3.3, high capacity)
  • drop the voltage a bit with schotky diode (-0.3v~0.5 deppend on type), adjust Vbatt max to Vin max of Attiny
  • lower the led brightness by raising the resistor value

Hi,
Can you forget about the fritzy circuit diagram and draw it with pen(cil) and paper, laying it out so that ALL those wires do not cross at odd angles and your have pins properly labelled.

Thanks.. Tom... :slight_smile:

During times of no/low power use, the attached devices are powered. Pretty much if there is a power input and a ground connected to a device it is, unless somehow put in a no power or low power mode, still consuming power.

Get use to the idea that an LED to let you know power is available is a waste of power.

All the LED's and resistor networks with power on one end and ground on the other, are drawing power.


It might be worth considering a power up device scheme upon ESP8266 wake up. Say, for simplicity, ESP8266 wakes up, ESP8266 enables a relay to power devices, ESP8266 waits a few moments for devices to do their power up thing, ESP8266 completes its setup up, reads sensors, does the MQTT thing, removes power from the devices, and goes back to sleep.

I switched to a BME680 for its ability to give an AIQ and discovered the BME680, with the Adafruit Library, operates in a low power mode when not taking a reading. The power draw during non-reading times of the BME680 is so low that I did not apply a power on off circuit to the device.

You may be able to use a MOSFET to remove power from the external sensors.


With a 20 minute off time, you might consider using a solar cell, a LiPo, and an all 3.3V system.

It is not ideal and does have its own issues, but a TP4056 can recharge a LiPo battery and supply a project with power. You'll have to get used to the idea of changing out the battery once or twice a year. A 12V 20 or 10Watt solar cell can power a 5V switching regulator that is fed to a TP4056. The TP4056 can supply 1 amp, and no more, to recharge the battery and power your MCU. I'd use a 3300mAh LiPo.

There are electronic issues that will be present that will reduce the LiPo battery life but the physical environment will be the real killer of the battery. The LiPo cannot be allowed to freeze. Which means it has to be insulated. The LiPo cannot be allowed to get too hot, remember that insulation to prevent it from freezing? Using a 12V solar cell/TP4056/LiPo is not a hands off solution but will work.


I switched over to a hands off solution by taking out the TP4056 and LiPo battery. I replaced the TP4056 with a PWM charge controller and the LiPo with a LifePo4 8Ah battery. I did upgrade to a more weather resistance 12V to 5V buck converter. The LiFePo4 battery works down to -40F and is rated for 2000 deep cycle charges, a bane of LiPo's.


With the 3300mAh battery my cycle time was sleep for 5 min, wake, do the thing, go back to sleep. With the 8Ah LiFePo4 my sleep cycle time is once every minute.

Hi,
Sorry but that Fritzy schematic was unreadable.
Here is a schematic taken from the Firtzy picture.
Layout makes your schematic so much more readable, even a hand drawn schematic would have been better.
PS, I added R3 as you need a base current limit resistor with a BJT.

Tom.... :slight_smile:

wow. your schematic design was okay,
you already had component disabler with transistor,
but change the transistor with mosfet would be great
gate of mosfet draw almost 0 current no need for resistor at gate.

so your big problem was your supply, replace your supply with 18650/Li-Ion/LiPo battery
those batt had bigger capacity

I would suggest you start by listing power consumption, both powered and in sleep mode for each device.
once you start to list and identify the biggest losses, you will find the bits that need to go, and the bits that should be changed.

you have the LED powered directly, why not flash it with one of the micro-controllers ?

the ATTiny85 has a deep sleep current as low as 2 micro-amps
the ESP deep sleep is 20 micro-amps

ideally the WiFi will be sucking more power in the brief time running than the rest of the bits do sleeping.
you should be able to achieve a point where your battery life depends more on how frequently you send the signal than anything else, er.. everything else.

calculate the power use if just the running of the WiFi and compare to an RF module.

my first thought was to use the ATTiny and an RF device and send back to the nearest device with mains power.

================

a note on your schematic. drag stuff around till you eliminate most of the lines crossing other lines. getting them close so it does not look like massive expanses between components is a good thing, but as you can see getting things aligned in a more meaningful manner makes problems much easier to find.

TomGeorge:
Hi,
Sorry but that Fritzy schematic was unreadable.
Here is a schematic taken from the Firtzy picture.
Layout makes your schematic so much more readable, even a hand drawn schematic would have been better.
PS, I added R3 as you need a base current limit resistor with a BJT.

Tom.... :slight_smile:

You're amazing, can I ask what program do you use for schematic? I know Fritzing is awful.

rzk:
wow. your schematic design was okay,
you already had component disabler with transistor,
but change the transistor with mosfet would be great
gate of mosfet draw almost 0 current no need for resistor at gate.

so your big problem was your supply, replace your supply with 18650/Li-Ion/LiPo battery
those batt had bigger capacity

Can you recommend a mosfet model?

Hi,
Google ExpressPCB download
It is free and simple to use, the only catch is the PCB part of the CAD does not produce a file that most PCB manufacturers can use.
So if all you want is a schematic editor then this will be fine.

Tom... :slight_smile:

azhao6060:
Can you recommend a mosfet model?

BSS138 or irf3205, those mosfet that i mostly use.
but you can check your nearest store, ask for "N-channel Mosfet with datasheet Vgs on can active at 3 v"

+1 on blinking the LED if that's a change you can physically make. Also, 47 ohms seems awfully low for the LED resistor - use the highest value that you can still see.

You might want to check whether there is any current flowing on the data line that connects the ATTiny85 and the ESP-01 when the transistor is off. There shouldn't be, but the ESP side will rise to 3.3V, so any path to ground through the ATTiny85 could result in current flow.

rzk:
BSS138 or irf3205, those mosfet that i mostly use.
but you can check your nearest store, ask for "N-channel Mosfet with datasheet Vgs on can active at 3 v"

I did some research and will be getting the 2N7002 logic level N-channel mosfet to test it out. I think it will work. Thanks

azhao6060:
I did some research and will be getting the 2N7002 logic level N-channel mosfet to test it out. I think it will work. Thanks

cooll!!,

A few thoughts:

You should probably take a closer look at the data for your regulator: It has a minimum Vin of 2.7v which is a bit close to your 3v battery, which won't last as long as it could. Suggest you move to 4.5v if you're using a 'normal' battery pack.
The regulator has a SHUTDOWN input which you could use instead of your transistor switch. Use the Attiny to switch the regulator. Note that the SHUTDOWN input has a 100k pullup to Vin which could usefully be removed if you do this, otherwise you waste 45uA at 4.5v

I don't know how the DHT22 compares with (eg) a BME280 but I suspect it's slower & higher current.

If you are able to, assign a static IP address to the ESP8266 & it will connect much more quickly than with DHCP.

The suggestions regarding your LED are sensible. Lose it if you can, or use a larger resistor & flash the LED. Or use the LED on the ESP8266? You can remap the UART as GPIO & control it.

You could use a Attiny412 which is cheaper(?) & slightly lower power - but it's surface mount...

You could also try a different approach? It's quite difficult to make WiFi devices low powered. Consider using (eg) a 433MHz system and use Open MQTT Gateway to collect & forward your sensor data, especially if you're planning to use more than one sensor.

Hope this helps