PIC 12F675 ADC Circuit understanding: Input signal impedance.

Thread Starter

Raymond Genovese

Joined Mar 5, 2016
1,658
I am struggling trying to understand the input impedance of the signal to a PIC12f675 ADC. The circuit works fine as far as I can tell, but I want to know more or maybe I just want some assurance that things are working the way I think that they are and because of the way I think that they are working. Can someone please render an opinion or otherwise help me understand?

12f675 Test 500x.jpg

The input to the PIC ADC comes from an HIH4020 voltage out, humidity sensor. The output is fed directly to AN0 on the PIC

Both chips are powered by the same 5V source and the 12f675 does not have a separate Vref.

The data sheet for the HIH4020 does not give a value for the output impedance (Vout). It does have a figure (FIGURE 8. TYPICAL APPLICATION CIRCUIT) showing a minimum load of 80kOhm between OUT and GND (0V). Am I correct in assuming that this is representative of the impedance of the output signal?

I feel like I have done some due diligence reading about the issue (including some AAC Forum threads), but do not have the level of comfort that I would like.

My reading includes some extensive info on the ADC in the 12f675 data sheet which includes the statement of a maximum recommended input impedance of 10K – presumably qualified by ...if you want to achieve something near maximum sampling frequency.

From the data sheet, EQUATION 7-1: ACQUISITION TIME

Tc=CHOLD (RIC + RSS + RS) In(1/2047)
Tc=- 120pF (1kΩ + 7kΩ + 10kΩ) In(0.0004885)
Tc=16.47μs

With that value for Tc, Tacq =19.72μs

Tacq includes an amplifier settling time and a temperature coefficient and I am keeping those values as is from section 7-1. If I substitute 100kΩ for Rs, I get a Tacq=149.56 μs. The 100kΩ is from the 80kΩ in the HIH4020 data sheet with some wiggle room added.

I have tested the software extensively and I don’t want to bog things down with a code listing at this point, but I can describe some of the testing.

I sample the ADC once every 100 milliseconds.

The code sets GPIO5 high (turns on an LED) when the 10 bit ADC value is at least as high as value 1 but no higher than value 2 (these values are programmable in the code).

I calculate a step value of 5/1024=.00488V.

Test example: using a 10k pot, 5V on top, GND on the bottom, a meter attached to the wiper. Set the pot to give 2.3V. Set the threshold values in the code to 470 lower value and 472 upper value. 2.3v=471 ADC value and I allow +/- 1bit (sometimes +/- 2 bits).

Connect the wiper to AN0 on the pic and run the program. The LED lights. Turn the pot the slightest bit and no LED and so on.

Test example with the HIH4020: Read Vout with a meter at ambient indoor humidity, which normally will not change much in a few minutes. Then, program lower and upper values as per pot example above. It too works as expected.

So, my testing indicates that things work pretty well. My questions are basically, is it working well for the reasons I described or am I missing something fundamental? Can you use a higher source impedance signal to the ADC and compensate with a very slow sampling rate (i.e., just give the internal cap more time to charge) or does this introduce other factors that I should be aware of?

Finally, this is for an eventual project for a humidity-controlled fan. It is a simple three-chip project but it needs to work outside of my bread board and work reasonably well. It does not, however, require a tremendous degree of accuracy. I want to avoid adding an op-amp to condition the signal unless it is absolutely necessary.

Thoughts appreciated.
 

ericgibbs

Joined Jan 29, 2010
8,848
hi Raymond,
Reading the HIH4020 d/s, I would not read the output impedance as being 80k, it is the minimum load resistance to ensure operation within the d/s specification.
I would add a 10K from the HIH output to 0v and connect the HIH output directly to the ADC input..

E
 

Thread Starter

Raymond Genovese

Joined Mar 5, 2016
1,658
hi Raymond,
Reading the HIH4020 d/s, I would not read the output impedance as being 80k, it is the minimum load resistance to ensure operation within the d/s specification.
I would add a 10K from the HIH output to 0v and connect the HIH output directly to the ADC input..

E
Thanks for responding.

I originally did NOT interpret the 80k as the impedance. I thought it was a pull down to offer stability, especially if the sensor was at some distance. I think I used something like that on an LM35 some years ago.

Whether I included the 80k resistor (I am testing with an 82K) or left it out - it made absolutely no difference in performance using the circuit and software as described.

I wrote Honeywell and simply asked them what the output signal impedance was.....

"Can you please tell me the output impedance of the Vout on the HIH4020-001 and the HIH5030-001? I can not find that figure in any data sheet. I think that it is relatively low, but for consideration of limits of the ADC used and possible signal conditioning, I would like to know the actual figure. Thanks very much, Ray"

The response was simply, "Thank you for your interest in Honeywell Sensing and IoT." Then they attached the figure from Typical Applications showing the minimum load and red circled the minimum load. No other text in the response other than the database entry for my inquiry.

To be precise, they attached the analogous figure in the HIH5030 data sheet (Figure 10 in that data sheet). I had asked about both the 4020 and 5030. The 5030 data sheet shows the minimum load at 65K, but basically, it is the same functionality as the 4020 and I have tested both chips.

So, I still am lacking confidence. But I can test your 10k suggestion.
 

ericgibbs

Joined Jan 29, 2010
8,848
hi,
If you have a scope it would be interesting to measure the waveform at the input of the ADC during the pre/during/post sampling periods.
As you have calculated, the ADC voltage source is charging the 120pF via the Rtot of ~18K.
If the source impedance is high I would expect to see a slight dip at read time, that is why I suggested a 10k load.

One method used is to have say, a 10n capacitor from the ADC input to 0V, the cap is charged from the HIH and when a sample is taking place the charge of the 10n is transferred to the 120pF.

I see that the response time is in the order of 5secs, so it would not be meaningful to sample faster than 1 sec rate.

I do have some LTSpice plots I did some time ago for a PIC's ADC response, please say and I will post them.
E
 

Thread Starter

Raymond Genovese

Joined Mar 5, 2016
1,658
Thanks, I would like to see the plots if you get a chance - maybe I will learn something, plus, I like plots :) Yes, I need a scope and I don't have one....yet.

I have been thinking more about the issue and I think I may be looking at it wrong. The 80k value is the minimum load that the 4020 wants - I suppose it is also the minimum resistance, they don't specify. This is what you had said in your initial response and I think it is correct.

The load represented by the PIC ADC appears to be sufficient. The voltage values I get from the 4020, measured by a meter are essentially the same as what I get measured by the PIC ADC. If the 4020 had trouble driving the load, I would see a voltage drop. It's also why adding a resistor from Vout to ground seems to have no effect. Moreover, if I convert the ADC voltages to RH values, they are inline with other digital humidity sensors I have around here. Of course, I am not looking at a complete plot of RH, but it behaves as I would expect and jumps if I breathe on it and then settles back in a few seconds. Bottom line, I will keep looking to understand it more, but I think that connecting the 4020 Vout directly to the ADC is ok to do. It seems to work just as it should, at least with my sampling rate.

On that last point, in my experience, there is always some variability between humidity sensors. Once, I tested some (including a 5030 with temperature compensation) against a sodium chloride solution as a standard. Most were about where they should have been (give or take a couple % max), but one was off by maybe 10-15% as I recall.
 

ericgibbs

Joined Jan 29, 2010
8,848
hi RG,
This image is a LTSpice simulation of a PIC's ADC input/sampling
The source impedance is stepped from 1R to 10000R, in 2500R steps.

It would be interesting see some results from your project when its up and running.

E
 

Attachments

Thread Starter

Raymond Genovese

Joined Mar 5, 2016
1,658
Nice. I think I understand some of it and I recognize the model from DS33023A (Fig 23.3). I see the differences in red from changing Rs but I somehow expected to see dips in red after each sample. There is no effect on the cap after sampling? Seems like you could just wait for an initial charge period and subsequent sampling could be as fast as you want. My understanding is admittedly weak.

Let me ask something basic for my problem. The 80K in the HIH4020 is representing a drive specification - right? That Vout signal can only drive a load of 80K or greater without degrading the signal (voltage drop).

If that is true, than how can I calculate the load that the PIC AN0 is presenting to the HIH4020? That's what I really want to know - right?
 

ericgibbs

Joined Jan 29, 2010
8,848
Let me ask something basic for my problem. The 80K in the HIH4020 is representing a drive specification - right? That Vout signal can only drive a load of 80K or greater without degrading the signal (voltage drop).
hi,
I would say that is correct, btw one d/s says 65k and another says 85k.???
I would connect the HIH directly to the ADC0 input, I do not see a 10u to 15uSec charge time being a problem for the HIH.

The only way to be sure of having a load greater than 85k would be to use a high impedance buffer amplifier, IMO that would be an over kill.

EDIT:
Have been trawling the web for HIH Apps.
Arduino users have posted some connection info.
https://learn.sparkfun.com/tutorials/hih-4030-humidity-sensor-hookup-guide
 
Last edited:
Without all of the other stuff presented here:

Sensor is ratiometric to supply voltage. IS IMPORTANT

It means don;t use a fixed reference voltage.

==

Max output current really does say what the minimum load the sensor can tolerate on the output. Given accuracy and all that other stuff.

Settling time means wait 70 mS before trying to read it. e.g. Not right after you apply power. In some power saving applications, you might just do this. Readings every 5 minutes and turn the sensor off for 4 ish. Saves power.

==

The input Z of your A/D might be handles with setting pull ups or pull downs, but most likey it's external. The lower the combined output Z means the effect of parasitic capacitance can be ignored. You still have settling time of the A/D in addition to the settling time of the sensor.

If you had an bunch of 1 M sensors and your were multiplexing these with a 10M input Z something would not be right. If the sensors were 100 ohms and you had a 10 M A/D, the sensor would be settled but the A/D maybe not.

One rule to remember is that with an RC filter, the output is 95% of the final value after 5 time constants. R in ohms and C in second ==> seconds.

Stray capacitance is a problem when you try to push things. Cable has capacitance. It's very annoying at high frequencies.
STP or shielded twisted pair is generally pretty good for signal transmission. The shielding helps remove RFI and twisting helps remove RFI.

The twisting doesn't work UNLESS the signals are balanced. Signals + and - relative to ground. So, a 10V signal would be transmitted as a -5 and 5 V signal. When some EMI bully comes around it couples it''s interference positively in one wire and negatively in the other, thus no or little interference.

In the first order look at stray stuff as RC filters and time constants and pay attention to settling time. The former is mostly from what you add/program and the latter are device specifics.

Many times the max output has to be determined from a graph. It will differ by voltage. You can;t put 10V into 0 ohms. In fact, you can't have 1e-1 Amps flow through 0 ohms. Zero doesn't exist, but...

Let's use a really common example. An op amp is connected with a vos of 1 mV and a wire having 1 milliohm resistance. Ohms law says 1 amp will be generated. It can really mess stuff up. That bias current of 1e-12 amp needs something to drop across.

Adding any series resistance adds noise. Bigger R, bigger noise. Lower Temperature, lower noise. So tradeoffs are made for protection and noise because OP amps are not ideal.

We need bypass capacitors because PC traces have inductance and our circuit has large rise and fall times. So, here's reality again; a square wave is composed of the sum of an infinite number of odd harmonic sine waves including the fundamental.
 

Thread Starter

Raymond Genovese

Joined Mar 5, 2016
1,658
Without all of the other stuff presented here:

Sensor is ratiometric to supply voltage. IS IMPORTANT

It means don;t use a fixed reference voltage.
Thanks much for the input.

In this design, I don't see why you are saying not to used a fixed reference voltage because the sensor is ratiometric. The output of the HIH4030 is proportional to its Vin - that is what ratiometric means to me. Vin for the HIH4030 is 5V. The PIC Vdd is the same 5V. The ADC on the pic uses the same 5V for Vref. I don't see any problem with this at all. What am I missing here?

I have added a .1 cap from Vin to gnd at the sensor - should have done that in the beginning.
 
From the PIC datasheet:

The voltage reference
used in the conversion is software selectable to either VDD
or a voltage applied by the VREF pin.

If you applied 5 V from a reference chip to Vref, the output would not be correct.
reading the value from Your DMV requires both VDD and Vout, preferably at the same time.*9*``
VDD can vary with temperature and time and the reference needs to vary the same way.
VDD could be 5.1, 5.05, 5,95 and everyone's happy.
 

Thread Starter

Raymond Genovese

Joined Mar 5, 2016
1,658
From the PIC datasheet:

The voltage reference
used in the conversion is software selectable to either VDD
or a voltage applied by the VREF pin.

If you applied 5 V from a reference chip to Vref, the output would not be correct.
reading the value from Your DMV requires both VDD and Vout, preferably at the same time.*9*``
VDD can vary with temperature and time and the reference needs to vary the same way.
VDD could be 5.1, 5.05, 5,95 and everyone's happy.
I think I understand your point, but from my original post "Both chips are powered by the same 5V source and the 12f675 does not have a separate Vref." So, with regard to this issue I don't see a problem and, as stated, I am not using a separate Vref.

But, you are also saying that my fixed voltage can vary somewhat anyways, and that the reference needs to vary in the same way (which it would, because both Vdd to the PIC and the reference to the PIC ADC is from the same source) - Yes, I agree.

That is, I get that and I can see how it is important IF I were not using a single 5V supply for Vdd and Vref.

It seems excessive that a decent 5V regulated supply would vary from 5.0 to 5.95, but even so, this is what I calculate the changes to be: -

The calculation of RH is going to be dependent on Vin so those changes will definitely have an effect on Vout. But for the application, you set a humidistat value - let's say, for example, 70%

VOUT=(VSUPPLY)(0.0062(sensor RH) + 0.16), typical at 25 ºC

So, 70% RH with Vin of 5.0 (and remember, Vin and Vdd and DAC ref are all the same source).
Vout=2.97V
The DAC will read Vout as a 10 bit value 608 (2.97/.00488)

So, with a 5.0V, 608 is the 10 bit value to use to set the humidistat value in the PIC. When the DAC reads 608 or more, turn on the fan. Ok, so now what happens when Vdd, DAC Vref and Vin vary as you say...

70% RH but with a Vin of 5.05
Vout=2.9997V
The DAC reads the Vout as a 10 bit value 608 (2.9997/.00493)

70% RH but a Vin of 5.95
Vout=3.5343
The DAC reads the Vout as a 10 bit value 608 (3.5343/.00581)

Even in the worst case variability that the 5V supplies wanders to 5.95V, the representation of 70% RH is, essentially unaffected. Maybe it is just my misunderstanding of reading "fixed reference voltage". If the Vdd voltage varied and the Vref voltage did not, there would be errors, I agree with that. But the schematic and the text show a single 5V supply for Vdd, Vref and Vin and I don't think that it is a problem.

Again though, sincere thanks for the input and I read all of it.
 
You understand it. A lot of people don't. The automotive world uses a lot of these type of radiometric sensors.

If you wanted to throw a voltmeter on it and scale it. That doesn't work because it's not 0 to 5V represent x and Y humidity.

You got it! I just wanted to make sure you knew the difference.

Here http://www.omega.com/temperature/pdf/EWS_WALL_MNT_ALL.pdf is a sensor scaled from 1 to 5 V and thus not ratiometric.
 

Thread Starter

Raymond Genovese

Joined Mar 5, 2016
1,658
To follow up on this issue:

To Honeywell's credit, they addressed the impedance issue in the course of several emails, including forwarding an email to a specialized tech there...a portion of one is attached below and a shout out to Cory and Honeywell for willingness to engage a customer regardless of "size" - It is appreciated.

"Hello Ray,
I hope you are well. Here is the note on impedance seen by your DAC:

When you provide a 5 vdc voltage to the sensor, the source current starts flowing through the sensor circuit. The source current is typically around 50 micros with 5 vdc excitation. The load/resistor helps stabilize the sensor output. For instance, without the load, the sensor output may be not be consistent for 10 readings taken sequentially at the same humidity and temperature conditions.

Since, you are interfacing the sensor to a DAQ input, the DAQ will see this “specific load + any resistance offered by the electronic circuitry of the sensor” as the total load.

Feel free to contact me with any other questions concerning this matter. Enjoy the rest of the day!
"
@ericgibbs note the similarity with your simulation at the first run or two and what the tech is saying can happen - I thought that was interesting.

Bottom Line for me is that it is too difficult (for me) to calculate the impedance that the sensor presents to the DAC and I don't care to add a unity gain op amp. I think it works fine for some applications as is, but those analog sensors are not individually calibrated and, in my opinion, are likely not as accurate out of the box as their digital counterparts - they also should be temperature compensated.

I'm glad I did the project, but I have changed to a digital sensor that also provides temperature and is about the same price.
 

ErnieM

Joined Apr 24, 2011
8,005
After having spend some 10 to 15 minutes looking into the Honeywell device thru its spec sheet I must say I have no zero none idea what load it requires.

HW does provide several nice looking performance figures until you realize these a re 1) typical curves, and B) completely unspecified as to what load they use to make these measurements.

As far as saying 80K is the minimum "load," does that have any meaning? A 10K resistor will draw more current than an 80K resistor, so it is a larger load. Of does "load" mean the resistance itself?

Ray, glad you found a replacement.
 
As far as saying 80K is the minimum "load," does that have any meaning? A 10K resistor will draw more current than an 80K resistor, so it is a larger load. Of does "load" mean the resistance itself?
The "load" is the resistor and min and max get twisted here. e.g. 8 ohms is a LARGER LOAD than 10 ohms. An 8 ohm load draws more power.
 

Picbuster

Joined Dec 2, 2013
979
I am struggling trying to understand the input impedance of the signal to a PIC12f675 ADC. The circuit works fine as far as I can tell, but I want to know more or maybe I just want some assurance that things are working the way I think that they are and because of the way I think that they are working. Can someone please render an opinion or otherwise help me understand?

View attachment 132999

The input to the PIC ADC comes from an HIH4020 voltage out, humidity sensor. The output is fed directly to AN0 on the PIC

Both chips are powered by the same 5V source and the 12f675 does not have a separate Vref.

The data sheet for the HIH4020 does not give a value for the output impedance (Vout). It does have a figure (FIGURE 8. TYPICAL APPLICATION CIRCUIT) showing a minimum load of 80kOhm between OUT and GND (0V). Am I correct in assuming that this is representative of the impedance of the output signal?

I feel like I have done some due diligence reading about the issue (including some AAC Forum threads), but do not have the level of comfort that I would like.

My reading includes some extensive info on the ADC in the 12f675 data sheet which includes the statement of a maximum recommended input impedance of 10K – presumably qualified by ...if you want to achieve something near maximum sampling frequency.

From the data sheet, EQUATION 7-1: ACQUISITION TIME

Tc=CHOLD (RIC + RSS + RS) In(1/2047)
Tc=- 120pF (1kΩ + 7kΩ + 10kΩ) In(0.0004885)
Tc=16.47μs

With that value for Tc, Tacq =19.72μs

Tacq includes an amplifier settling time and a temperature coefficient and I am keeping those values as is from section 7-1. If I substitute 100kΩ for Rs, I get a Tacq=149.56 μs. The 100kΩ is from the 80kΩ in the HIH4020 data sheet with some wiggle room added.

I have tested the software extensively and I don’t want to bog things down with a code listing at this point, but I can describe some of the testing.

I sample the ADC once every 100 milliseconds.

The code sets GPIO5 high (turns on an LED) when the 10 bit ADC value is at least as high as value 1 but no higher than value 2 (these values are programmable in the code).

I calculate a step value of 5/1024=.00488V.

Test example: using a 10k pot, 5V on top, GND on the bottom, a meter attached to the wiper. Set the pot to give 2.3V. Set the threshold values in the code to 470 lower value and 472 upper value. 2.3v=471 ADC value and I allow +/- 1bit (sometimes +/- 2 bits).

Connect the wiper to AN0 on the pic and run the program. The LED lights. Turn the pot the slightest bit and no LED and so on.

Test example with the HIH4020: Read Vout with a meter at ambient indoor humidity, which normally will not change much in a few minutes. Then, program lower and upper values as per pot example above. It too works as expected.

So, my testing indicates that things work pretty well. My questions are basically, is it working well for the reasons I described or am I missing something fundamental? Can you use a higher source impedance signal to the ADC and compensate with a very slow sampling rate (i.e., just give the internal cap more time to charge) or does this introduce other factors that I should be aware of?

Finally, this is for an eventual project for a humidity-controlled fan. It is a simple three-chip project but it needs to work outside of my bread board and work reasonably well. It does not, however, require a tremendous degree of accuracy. I want to avoid adding an op-amp to condition the signal unless it is absolutely necessary.

Thoughts appreciated.
Hi Ramond,
the pic will load a capacitor used to measure the input voltage.
Time to load this capacitor is depending on the impedance and the connected voltage.
This implies that a serial resistor to input of 900K and a resistor of 100K parallel to 100nF to ground will taker a longer time to reach its full load.
It's like building a separate source ( voltage over the capacitor).
I used this to measure DC up to 30V but be aware that more time is needed (10 to 0ne divider).
If you measure the DC input impedance ( 1/2 voltage method) you will end up about the 250K approx.

Picbuster.
 
Top