This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Interfacing MSP430 to analog AC-rated humitidy resistive sensor HCZ-H8 - any ideas?

Dear Sirs,

I need to connect mentioned HCZ-H8 humidity sensor to MSP430-based system.

In brief:

HCZ-H8 is a resistive AC-rated sensor ( http://www.fenghua.com/pdf/humidsensor/HCZ-H8.pdf ). To measure the humidity using the one, you should power it with a sinewave 1kHz, 1Vrms, pure AC without DC component, to obtain it's impedance |Z|. The sensor is resistive, not capacitive, so the main goal of AC supply is not to degrade the sensor with DC. 1KHz is used as it's datasheet already contains calibration table "impednace-humidity" @ 1KHz .

The similar sensor is well described in this document: http://www.produktinfo.conrad.com/datenblaetter/175000-199999/182630-da-01-en-Feuchtesensor.pdf

I'm going to solve my problem this way:

1)Set voltage of current sinewave's step (1KHz) using DAC

2)Pass DAC output through the filters (remove DC)

3)Split filtered sine between:

a)ADC CH0 directly

b)Humidity sensor  then to ADC CH1

4)From CH0, CH1 calculate |Z|

5)From tables obtain humidity

 Am I on the right way? Any ideas how to make this in a simpliest way?

Regards,

Ilia V. Davidov

  • Ilia Davidov said:
    The sensor is resistive, not capacitive, so the main goal of AC supply is not to degrade the sensor with DC.

    Hmmm, if it is resistive, AC is equivalent to pulsed DC and the sensor is degraded in any case with the RMS value of the AC signal. If you appy 1VAC RMS, you could as well apply 1V DC.

    Anyway, the approach looks good so far.

    Some things to be added: for simultaneously sampling both, the applied and the resulting voltage, you need an ADC that supports simultaneous sampling.
    If you use an ADC10 or ADC12, the samples are take one after another (also for most devices with an SD16, only the devices for energy metering support simultaneous sampling).
    And if you're already samling one after another and have to calculate the time shift, you can as well just sample the result, as it was you who created the input signal with the DAC, so you KNOW the input voltage (calibration provided).
    It makes things a bit easier.

    For resistive sensors, however, I would go a different approach: set up a small constant current source that can be switched on and off by an MSP port pin. Every millisecond switch it on, take a sample of the resulting voltage across the sensor, then switch it off again, to avoid sensor heating. if your current source forces 1mA through the sensor and the voltage reading is 1V then the sensor resistance is 1kOhm.

    I guess the calibration table takes the sensor heating caused by the measuring voltage into account. but only for a given environment temperature. To simulate it, calculate the power applied to the sensor under the the conditions of the calibration table, and apply a constant current that causes the same power loss on the sensor. The readings should be equal. Then the current source does not need to be switche on and off (except to save power, but then the first readings after turnign it on again will be inaccurate) and things are even easier: read teh voltage and convert it into a temperature by a table.

     

  • Thanks a lot, Jens-Michael,

    I'll think about your approach - I like it :)

    Some words about sensor degrading:

    It seems (I'm not sure) that the problem is not sensor's heating - it looks like sensor becomes "polarized" after long-term DC appliance. If pure AC (without DC) is applied, the summary "polarization" gets 0: after one half of period it polarizes "positive" the next half of a period it "depolarizes".

    I think that in your approach 1mA of DC periodically applied to the sensor will not degrade it too much as it will self depolarize during the period of inactivity.

    Also some words about simultaneously sampling:

    As I understand (may be I'm wrong) the momentary input voltage (DC for a small period of measurement) will be a constant for both direct and indirect  channels, as the DAC output will synchronously change only after both measurements are finished (will be implemented in software). Is this approach acceptable (in theory)?What is it's weak side?

    Regards,

    Ilia V. Davidov

     

     

  • Ilia Davidov said:
    it looks like sensor becomes "polarized" after long-term DC appliance.

    Okay, that's a possibility. I don't know why a resistive sensor might become polarized, but it might have electrochemical reasons (e.g. the water molecules being separated to H and O2, and for a DC compoenent this will give an uneven distribution of the two on the electrodes- if there is such a thing).

    Ilia Davidov said:
    I think that in your approach 1mA of DC periodically applied to the sensor will not degrade it too much as it will self depolarize during the period of inactivity.

    Or you can apply inverted pulses.However, AC power supply reauires either a negative voltage somehow generated (the DAC will only generate positive voltages relative the MSp GND) or the device provided with a virtual ground that is effectively a stabilized voltage hovering in the middle of the measurement range. This consumes power.

    Ilia Davidov said:
    as the DAC output will synchronously change only after both measurements are finished

    IIRC, Ithis remark was referring to the setup with a DAC generated waveform. It's noteasy to generate a sinusodial wave generation of a fixed frequency if you set a value and then sample it and then set the next, in this order. (this would rather be done with a timer interupt that controls the DAC output, or a timed DMA transfer), but I on't think it's necessary to keep a sinusodial waveform and timing at all. But then, if you just apply a voltage and then measure, you already know the voltage you applied.You only need to sample the result. If you worry about possible calibration issues: sampling two voltages would be from two different input channels, and calibrations differences between the two channels would affect your result too.

    If you apply the current pulse, then of course you have all the time until the pulse ends (which you control) to take the two samples. But where to get the second sample from? You do not apply a voltage, you apply a current. So there is only one voltage to be sampled: the product of current and sensor impedance.
    You could add a base resistor and measur eboth values, voltage over base resistor and voltage over both (as the same current flows through both). Then the relation of the two measurements goves the resistor impedance in relation to the base reistor value. It will eliminate the variation of the current source, but for an absolute result, it will require a calibrated base resistor.

  • Thanks a lot for attention to my problem, Jens-Michael :)

    Jens-Michael Gross said:
    you can apply inverted pulses

    I was also already think about this, may be this will be my way.

    Jens-Michael Gross said:
    sampling two voltages would be from two different input channels, and calibrations differences between the two channels would affect your result too

     Thanks a lot :) This really was a problem for me :) Now I'm OK :) I've realized that sampling twice is wasting of resources without any benefit. Even more - total accuracy of this sensor is too low (less than 10% for full scale of relative humidity (RH)), so it's not needed to measure it with a great precision.

    At this moment I have some unsolved points:

    1)Is it a good idea to  directly measure signal from sensor using ADC? The problem is that sensor has a logarithmic characteristics, so we need too wide dynamical range to measure it's signal with acceptable accuracy for the full scale of possible humidity. For T=+20C, for example, the resistance changes from 5KOhm (80% RH) to 14MOhm (20% RH). So, for constant 1mA source this will give us 5V to 14KV!!! (it's not easy to implement such source, IMHO)

    2)May be it's a good idea to implement some external hardware, based on OpAmp, as noted in mentioned PDF (please take a look at it)? Also AC generation may be implemented via hardware. I've also found some strange thing there: they say that the error depends on frequency, and the more frequency - the less accurate result will be. But the calibration results are presented for 1KHz, while the AC source used in reference schematics is "outlet" - 50/60Hz.

    Waiting for ideas :)

    Regards, Ilia

     

  • Ilia Davidov said:
    Is it a good idea to  directly measure signal from sensor using ADC?[...]the resistance changes from 5KOhm (80% RH) to 14MOhm (20% RH). So, for constant 1mA source this will give us 5V to 14KV!!!


    Well, for 0.1µA it would be in the range of 0.5mV to 1.4V. ;) You didn't write which MSP you want to use, but if it is one with an ADC12 or SD16, well, it's not really a problem (except that the input current of the port pin might have a too large influence on the signal, then a JFET-OpAmp should be added). The ADC12 has a resolution of (for a reference of 1.5V) 0.366mV, so well, 80% and 70% could be easily detected :)
    However, you're right, some external hardware would do wonders here. But then you cannot rely on your calibration table anymore, as the hardware to 'delogarhitmize' the sensor resistance will likely add so much linearty error, that your readings are, well not much more than improved guessing. In fact, with 10% base precision, I guess I can estimate humidity almost as good with my nose :)

    Ilia Davidov said:

    Sorry, the server cannot be found. A typo? Ah, I see, it has to be conrad.de and not conrad.com.
    Well, using anOpAmp and diodes for delogarithmizing the signal is a common approach, but one not with much precision. And really complex too. But the best approach if you don't want to deal with the logarithmic range. For reasonable results, individual calibration might be necessary, though.

    Ilia Davidov said:
    they say that the error depends on frequency, and the more frequency - the less accurate result will be. But the calibration results are presented for 1KHz

    Possibly the worst case. Results are better flor lower frequency and then go suddenly haywire when it comes to DC. I didn't have the time to read through the whole document. It's much too large and also too bad quality to read and understand it in reasonable time (they definitely need a better OCR software for their scanned documentation - or put more effort into the conversion process).

     

  • Thanks for your help.

    I've decided to check both methods and then report the results:

    1) MCU driven 1mkA source of pulsed bipolar DC & directly connection to MSP430 (may be via OpAmp as a buffer)

    2)External circuit as noted in this PDF, p.46 :  http://cds.linear.com/docs/Application%20Note/an67f.pdf . The schematics is:

    Jens-Michael Gross said:
    In fact, with 10% base precision, I guess I can estimate humidity almost as good with my nose :)

    I'll forward this wise thing to my customer ASAP :)

    The problem is a total cost of solution: if the amount of external ICs will cost more (or equal, or even a bit cheaper) than "normal" calibrated digital sensor with I2C interface - it's not good solution. As I've understood, resistive sensors are good for controlling of known presetted value of humidity, but not for measuring. As I need to measure the humidity, it's may be a better solution to use capacitive sensors.

    BTW, I've seen (in some datasheets)  modules based on resistive sensors, so called "Signal Conditioners", that provide semi-linear (or known) Vout(RH). Unfortunately, I can nowhere find their schematics, but on photo we can see one IC (may be ASIC, of course), and a couple of discrete elements. Does anybody know ther schematics?Please share it to me, if possible...

     

     

  • Ilia Davidov said:
    I'll forward this wise thing to my customer ASAP :)

    My nose is not for sale :)

    Ilia Davidov said:
    As I've understood, resistive sensors are good for controlling of known presetted value of humidity, but not for measuring.

    Indeed, despite of the logarithmic nature, you can easily adjust a hardware to generate a certain trigger point (just chose a resistor that has the 'desired' value, put a voltage on both and compare them with an OpAMP). If you chose this second resistor to be an adjustable one with also logarithmic characteristic, you can easily build a humidity regulator for cheap money.
    But due to the large value range, a measurement is rather difficult and you'll either need high-quality components (the A/D) or a rather complex de-logarithmizing circuit.

    We had a similar problem with NTC temperature sensors. They have an exponential characteristic (not linear nor logarighmic). By adding top and bottom resistors, we were able to straighten a part of the temperature curve to be fairly linear in the range of interest (-5 to +70°C). It required, however, an OpAMP for impedance changing and some more circuitry to be supply-voltage independent.

    Maybe a capacitive humidity sensor would indeed be better suited for this project.

  • Hi Jens-Michael,

     

    "Maybe a capacitive humidity sensor would indeed be better suited for this project."

    Do you have a sensor reference of such type "capacitive humidity sensor"

     

    Regards,


  • Thanks for the info, ilia.

    In my statement, I was just referring to you mentioning them.
    Personally, I have never used one nor evaluated one for possible use.

**Attention** This is a public forum