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.
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.
.
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.
.
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, it read the temperature and humidity once every 1 minute and 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 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.