Build a SHT40-based temperature and humidity monitor

SHT40-based temperature humidity monitor with a home-built wooden box

This is just another weekend project. I need a temperature and humidity monitor, instead of buying one from Ikea, I decided to make one with a Sensirion SHT40 sensor and a ATtiny824 MCU.

Here is the schematic, but I didn't create it with each of the components and a custom PCB from scratch this time. I used 5 ready-made modules to put it together. With except of ATtiny824 breakout board which I made myself a couple of years ago, the rest of 4 modules are bought from Aliexpress in the past.

"Schematic of SHT40-based temperature and humidity monitor"

The main PCB consists of the ATtiny824 module and SHT40 breakout module soldered on a prototype board, and then mounted on the back of LCD1602 display module.
"main pcb mounted on the back of LCD1602".

The Power Supply sub-system consists of a TP4056 Li-Ion charger and 18650 battery protection circuitry, and a SD6201-based boost converter. Both are soldered on a prototype board which is used as the base for a 18650 battery holder.
"TP4056 module and SD6201 boost converter soldered on the back of a prototype board which is used as the base of 18650 battery holder".

As I know nothing about 3D printing and mechanical design, and don't have a 3D printer either, so I make wooden box with pine board that I bought from Daiso for 200 yen.

Software

The code is trivia and is written in ATtiny824 bare metal style. The PIT is setup to wake up every 1 second to update a timeCount, if the timeCount hasn't reach to 60 seconds, it go back to power down sleep immediately. When the timeCount reached to 60 seconds (1 minute), it read the temperature and humidity go back to Power Down sleep mode. In addition to read the temperature and humidity data from the SHT40, the battery voltage is read via a voltage divider for monitoring when the battery would need to be charged.

The LCD1602.h and I2C.h are driver code that I wrote and can be re-used for other projects. It is in fact took longer to write those drivers than put together the main code. The I2C driver works from 10MHz clock speed onward, anything below 10MHz does not work with this driver.

The complete source is available at https://github.com/e-tinkers/sht40-temperature-humidity.

Battery Consumption

The power consumption is around 1.26mA, with a 18650 battery of 2200mAh capacity, it is estimated to last for about 72 days for a single charge. Among the 1.26mA, the LCD1602 consumed about 450uA, the rest is from the ATtiny824 and the SD6201. The MCU is running at 20MHz and consumed about 10mA during wake-up period, and this could be reduced by running at lower clock speed, the SD6201 boost converter can be further improved to reduce it leakage and quiescent current, but I'm happy with the 72 days battery life so I leave every module as is without any modification.

Resources

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.