I'm working on a humidity controller which also controls the temperature inside a chamber.I'm done with the hardware (though i'm not the one behind the design)and which was originally designed with a 12 bit external ADC and an 89s52 uc and I replaced both with PIC 16F877A uc and I use the 10 bit internal ADC.

Other hardware details are (I can provide the schematic though it seems cumbersome).enter image description here

  • temperature sensor -PT100
  • humidity sensor - SY-HS-220 (datasheet)
  • +Vref for ADC - 1.235V and -vref =0;

I roughly checked the voltage across the 2 ADC channels by replacing the sensors with a 500 ohm pot (not concerned about the errors at this point) and got the following figures

proposed temp | voltage @ ADC

  1. 5 oC--------------1.650v
  2. 6 oC--------------1.660v
  3. 80 oC-------------2.480v

proposed humidity | voltage @ ADC

  1. 30% (990mV)--------0.098V
  2. 31% (1023mV)-------0.101V
  3. 32% (1056mV)-------0.104V
  4. 33% (1089mV)-------0.107V
  5. 34% (1122mV)-------0.110V
  6. 40% (1300mV)-------0.128V
  7. 90% (2970mV)-------0.29V

    I want to use this hardware for the following requirements

    • Temp. measurement - 5-80 oC, 0.5 oC resolution
    • Relative Humidity - 30-90%, 1% resolution

And my concerns are

  1. Should I have to change the reference voltage to 2.5V as I can see the maximum voltage to be measured is 2.48? Or that voltage is out of a mistake since the original hardware is designed with 1.235V

    • is the voltage at the ADC in(of temp sensor) adjustable so as to make it within 1.235V (so I think better performance) by some minor hardware changes (like changing a resistance value to change gain of amp)
  2. are my requirements achievable with a single ADC configuration as I'm concerned about the rough figures I got (ADC input values for temp and humidity are not comparable or that too a mistake?) ?

    • for the temperature I could measure only with 1 oC in steps as the RTD chart (For European Curve, Alpha = .00385, ITS-90)was provided with 1 oC increments. To measure 0.5 oC resolution is it OK if I divide the change in voltage for 1 oC increment by 2 (assuming the curve is linear, or not!?)
  3. How to decide efficiently the sampling time of ADC (considering the facts that the sensors respond slowly, transient voltage fluctuations in the line etc.)

  4. Finally how ADC values are converted to equivalent process values.? (Excuse me if the title of question matches here only)

    • By a table look up? (in my case 150 values(for temp) + 60 values(Rel humidity) ) or can I use some calculation ? (if yes, how to get a linear relationship between the ADC values and process values) .which method is efficient in terms of accuracy?
  • \$\begingroup\$ Uhh, 990mv is 0.99V. 2970mV is 2.97V. Something is definitely wrong in your setup. \$\endgroup\$
    – Passerby
    Commented Oct 5, 2013 at 6:12
  • \$\begingroup\$ @Passerby yes, I know the conversion between mV and V. what I have given are the values observed at the ADC input for a voltage across the sensor. voltage at ADC need to be same as that across the sensor as it goes through series of op amps, right? \$\endgroup\$
    – raforanz
    Commented Oct 5, 2013 at 6:26
  • \$\begingroup\$ Oh okay, as long as its expected to act like that. \$\endgroup\$
    – Passerby
    Commented Oct 5, 2013 at 6:52
  • \$\begingroup\$ The way I've used to measure a PRT into a PIC is to accept that you need to re-linearize (in code) because of the inherent equation of the PRT then, feed it via a resistor from 3.3V (same voltage used for internal ADC ref as PIC ADC) amplify it then into the PIC ADC input. Your circuit uses the PIC internal reference and an external reference and the error could be significant. If you feed the PRT like I've suggested you make a ratiometric ADC measurement that precludes any reference discrepancies. \$\endgroup\$
    – Andy aka
    Commented Oct 5, 2013 at 11:14

1 Answer 1


1) Change R8/P1 to get the voltage range you want for the temperatures you want to measure.

2) Set P2 higher to match the values to the range of your ADC.

3) Set sampling time no higher than X times the time constant of your system including sensors. Find a good number for X depending on the requirements of the system. You may however want to average a number of rapid samplings to reduce noise/add bits.

4) A combination of lookup table and interpolation usually works well. Build an excel sheet to show the error of the approximation - massage it until it works for your application.

  • \$\begingroup\$ Did this answer your question? \$\endgroup\$ Commented Oct 9, 2013 at 9:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.