This design is even less expensive than the one described in Part II due to a cheaper humidity sensor C2. Because of a lower LCD load the average current consumption is also lower and does not exceed 0.8 μA. The device has just one LCD on which the values of temperature and humidity alternate with a 2 sec period.
Schematic | Measuring temperature | Measuring humidity | ||
The temperature is measured by a Microchip TC1047A sensor with analog interface. The sensor output voltage depends on its die temperature as follows: V(mV) = 10·T(°C) + 500. The voltage is measured by integrated into the microcontroller 10-bit ADC with 1.65V on-board reference. Hence, for the ADC code A one has: A = 1023·V/1650. Combining these formulas we obtain a formula that involves only integer operations (division by 1024 can be implemented by using the right shift operation):
T(°C) = A·165 / 1024 - 50
The sensor turned out to be a pretty accurate instrument allowing to measure temperatures with ±1°C accuracy without any calibration. To save power the sensor is turned on only for the time of temperature measurement. Experiments showed that it has about 5 msec setup time after being powered up.
The humidity sensor reading requires more work, though. The sensor has no electronics and is just a capacitor whose capacitance depends on the air relative humidity. This dependency is pretty complicated and is expressed by a polynomial of degree 3, see the sensor datasheet. The sensor capacitance varies between 160pf and 190pF as the humidity changes from 10% to 90%. To measure the capacitance we used the Capacitance to Digital Converter (CDC) of the microcontroller. The gain of its input amplifier is set to 1x, which allows to measure capacitance up to about 500 pF. This way, even by choosing a 12-bit resolution we get 245 CDC codes to distinguish 81 values of humidity in the range specified above.
The algorithm implemented in the CDC block is similar to successive approximation method widely used in ADCs. Experiments showed that it takes 10 μsec to compute 1 bit of the CDC code and a delay of at least 3 μsec is necessary between the bits. The CDC block has numerous settings that allow its precise tune-up. The entire measurement takes about 180 μsec, during which the μC must not be in a sleep mode. So, we place it into the suspend mode instead with automatic wake-up upon completion of the conversion.
The CD4043 LCD driver is capable to display digits only. Therefore, for displaying the units in the rightmost LCD entry a special "driver" based on DD4 is used. The PCB is designed with system Eagle. The device also turns off in darkness, provided by photodiode VD1. It is mounted on a separate small board which is lifted over the main one to improve the sensor light contact. The PCB is embedded into 4"x2"x1" plastic enclosure from Radioshack.
PCB front | PCB back | Back view | ||
As noted above, to achieve most accurate readings we only need to calibrate the humidity sensor and the CDC block of the μC. This is done in 2 steps. All code development and μC programming is done by using the same tools as described in Part II. In the first step one loads project Calibr.wsp into the μC and puts a breakpoint in line #19 of the code calibr.asm. Then let the μC run to the break point and check the value stored in CS0D register. Open the supplied configuration tool HS1101.html in your web browser and put the CS0D value and the corresponding humidity value measured by a reference hydrometer. Optionally, in the second step solder a 150pF 1% capacitor instead of the sensor and check the value of the CDC register as the code calibr.asm reaches the break point. Put all values in the HTML form and click the Compute button. The computed values CS0_MIN and CS0_RANGE should be placed in lines 4-5 of the main code humi3.asm. Also put the computed humidity conversion table to the end of this code, thus replacing the existing one there. Load the updated code into the μC and enjoy the results.
Last modified:Mon, Jan 23, 2023.