This device is very similar to the one from Part III, even has an identical schematic. The only difference is the humidity sensor C2 (Honeywell HCH-1000). It is the cheapest sensor that I know. However, don't be fooled by its price. The sensor characteristic at constant temperature is linear! This allows to compute the humidity based on sensor capacitance and temperature without using conversion tables. I present a formula here that involves only integer operations. The device also draws just 0.8 μA at light and 0.35 μA in darkness (average values).
Schematic | Measuring temperature | Measuring humidity | ||
The sensor capacitance changes from approx. 300 to 360 pF as the humidity varies between 10% and 80%. Higher sensor capacitance benefits for decreasing the offset in capacitance measurement due to the PCB and μC pin parasitic capacitance. By using the system Maple I worked out the following formula for computing the relative humidity. The formula also involves sensor thermo-compensation. Note that this formula is only valid for using the sensor with C8051F99x microcontrollers, since the coefficients involved there are based on the CDC characteristics.
H(%) = (((A - A0)·125 + (T - T0)·136 + 256)) >> 9) + H0
Here A and T(°C) are measured CDC reading and temperature, and A0 is the CDC reading at temperature T0(°C) and humidity H0 obtained at calibration. The computed value of H should be truncated to be in the interval [0..99].
As in the device from Part III the light sensor can be omitted if its functionality is not needed. In this case uncomment line #62 in the main code humi4.asm. The PCB is put into 3"x2"x1" project box from Radioshack. All passive components are in 0402 package, excluding C7, which should be in 0603 package.
PCB front | PCB with LCD | Back view | ||
For calibration of the humidity sensor and the CDC block, set a break point at line #464 of the main code humi4.asm (instruction "mov A, CS0DL"). The code will reach the break point in about 10 seconds after being powered up. The reason for this delay was specified in the previous projects: it gives a chance to the debugger to recognize the μC before it goes to sleep. Now open the supplied calibration tool HCH1000.html in your web browser, read the value of CS0D register in the debugger and put it along with the current temperature (currently shown on the LCD) and humidity (measured by external reference hydrometer) into the corresponding fields of the HTML form. Click the Compute button and put the computed values HUMI_NOM, TEMP_NOM, and CS_NOM into lines 4-5 of the main code humi4.asm (thus updating the values presented there). Load the updated code into μC and you are done.
Last modified:Mon, Jan 23, 2023.