Electronics Projects

Low-power temperature and humidity meter. Part II.

This is a shortened translation from Russian of my article submitted for publication to Радио (Radio) magazine.

After building my previously described temperature and humidity sensor I realized that it would be practical to have such a device in every room, including cellar, laundry, closets, etc. Unfortunately, the SHT15 sensor used in that design is too expensive for reproduction. So, I decided to apply a less expensive one and make the device even lower power. The average current consumption of the new unit is below 1 μA, so powering it CR2032 battery should last for about 10 years.

Schematic Front view Back view

Hardware

The humidity sensor used in this design is Honeywell HIH-5030. It is a further development of the HIH-4000 series and is capable to work from 3V. The LCD driver is based on CMOS drivers CD4043 that draw only 40 nA in static. The 22 Hz symmetric waveform for driving LCD is generated by a multivibrator on CD4047. Its low power consumption is provided by a high-value resistor R4, so that the driver ICs DD2-DD6 all together draw about 0.6 μA. Loading data into the driver ICs is accomplished via its A,B,C,D ports followed by a strobing signal LE.

The temperature is measured by a built into the μC temperature sensor, which is well suited for measuring temperature with a ±1°C accuracy. Both temperature and humidity are measured with a 2 sec period. For the rest of time the μC is put into a deep sleep mode with waking-up from a built-in 32-bit timer SmaRTClock running at 16.4 kHz. In the sleep mode the μC with the running timer draws about 0.3 μA. It should be mentioned that the temperature sensor is light sensitive and needs about 1 ms to set up, while the setup time is nearly 0 in darkness. The μC is running at 20 MHz, hence the measurement takes just several dozens of microseconds, so the μC current consumption in the active mode does not noticeably contribute into the average.

Note that it makes no sense to perform measurements and drive the LCD in darkness. For further energy savings the device is turned off as the ambient light intensity drops below a certain threshold. The light is sensored by photodiode VD1, generating about 0.4V at sun light, which makes the light sensing circuit very sensitive. The photodiode is connected to the built-in comparator consuming about 0.4 μA when active. The comparator is turned on every 2 sec in darkness for checking the light conditions. Since checking the comparator status takes just a dozen of microseconds, the average current consumption in darkness drops down to 0.35 μA, that is in a factor of 3. During the day the lighting conditions are checked after every 256 measurements, i.e. every 8.5 minutes.

The device is assembled on a PCB designed with system Eagle. The battery and several wire jumpers are placed on the back side of the PCB, check the images above. The chassis is formed by 3/4" aluminum profiles, on which the PCB is mounted via 1/4" standoffs. The side walls of the enclosure are made of 3/4" L-shape aluminum profiles. The from and back panels are cut of 3mm plexiglass. Capacitor C1 should be in 0805 package, the other passive elements should be in 0402 one. If there is no need to turn the device off in darkness, the photodiode VD1 can be omitted. In this case one should uncomment line #59 in the code with instruction "smjp loop". This way no light condition check will be performed.

Software

Although the humidity sensor datasheet contains all needed data for conversion of the ADC readings into the humidity value, the formula we use here is modified for integer operations as follows:

H(%) = ((((A·16 - 2480)·(2392 + 5·T(°C)) + 18) >> 10) + 128) >> 8

Here A is the ADC reading and >> is the right shift operation. The constants involved into this formula are selected to provide a difference in value with the original formula from the datasheet of ±1 for 10% ≤ H ≤ 90% and 0 ≤ T ≤ 50°C. Moreover, for room temperatures both formulas match in 75% of cases. The humidity sensor turned out to be pretty accurate, its values differ from SHT15 on ±2% without any calibration. The code averages 16 last humidity measurements and 8 last temperature ones.

However, the build-in temperature sensor requires some calibration. The datasheet of C8051F9xx contains some info on sensor calibration in 1 point, which was not sufficient for accurate temperature measurements. For better results the sensor should be calibrated in 2 points as follows. First, load the code temp.asm from project Temp.wsp attached below and let the device run for about 10 minutes. Write down the ADC reading shown on the display and the corresponding temperature measured by a reference thermometer (possibly a digital one). After that put the device and the reference thermometer into your fridge (but not freezer) for at least 30 minutes and write down another pair of the ADC reading and temperature. Next, open the supplied file HIH5030.html, enter the readings into the corresponding fields of the form, and click the Compute button. Put the computed values INDEX_CORR and INDEX_MAX into lines 3 and 4 of the main code humi.asm. Also put the computed table at the end of this code, thus replacing the existing table there. This calibration results in a difference of temperature reading with the reference thermometer not exceeding ± 1°C.

The calibration and the main codes are written on assembly language and developed in Silicon Labs IDE available from the company website (www.silabs.com). As of today (Aug. 15, 2011) the installation version of this tool lacks the INC file for F98x devices, so please take this file attached a place it into the INC folder of the system. The μC was programmed by using the DEBUGADPTR1-USB tool.

Note that entering of the μC into the deep sleep mode has a number of particularities compared with other families of microcontrollers, see [2] for details. There is a real danger that the programming tool could loose a connection with μC. To prevent this we introduced a 10 seconds delay at the beginning of the code, which should be sufficient to establish a communication between the debugger/programmer and the μC upon powering it up.

References

  1. Chew M.T., Gupta G.S. Embedded Programming with Field-Programmable Mixed-Signal μControllers. Second Ed., 267pp.
  2. Optimizing Low-Power Operation of the C8051F9xx, Silicon Labs Application Note AN358, 2010.

Downloads


Last modified:Mon, Jan 23, 2023.

04028