5
\$\begingroup\$

I'm trying to understand this temperature sensor circuit I came across on a room Air-Conditioner controller (Want to build one myself).

The sensor is an NTC type thermistor (15k at 25 deg C). What I collect is that the NTC along with R2 form a voltage divider, the output of which is fed into the ADC input of the microcontroller.

  1. What are C1 and C2 for? Do they form RC filters along with the thermistor? If that is the case, then the cut-off frequencies are 106.1Hz and 1.06Hz? These appear to be very low.
  2. What is R3 for? Is it limiting the current? If ADC input pins are high impedance, why limit the current?
  3. Do R3 and C3 form another RC filter? Then again the cutoff frequency is 3.386kHz. And there's nothing apparently operating at that frequency on the board. (The micro controller is connected to a 4Mhz external crystal and the board is powered by 230V/50Hz mains).

Thanks.

\$\endgroup\$
  • 6
    \$\begingroup\$ A 3 Mpixel image for a 6 component schematic, seriously???? And which scaled down for the webpage isn't even readable.. \$\endgroup\$ – stevenvh Sep 5 '12 at 5:29
  • 1
    \$\begingroup\$ Err...oops? :-P Fixed that. I exported that from Fritzing (downloaded this morning and spent much time looking for a thermistor symbol) and had been careless enough to overlook that. Thanks. \$\endgroup\$ – Sohail Sep 5 '12 at 9:20
  • \$\begingroup\$ @stevenvh: Are you paying by the kilobyte or something? :) It was only a 100 KB image. \$\endgroup\$ – Chris Laplante Sep 5 '12 at 16:35
  • 1
    \$\begingroup\$ @SimpleCoder - It's not about the filesize, it's about image size. It was almost 3000 pixels wide, which is enough to see individual carbon atoms in the resistor, yet it was unreadable when scaled for the page. The smaller image OTOH is readable. And the 100 k is over the 'Net, in my browser's memory it's 3 MB. \$\endgroup\$ – stevenvh Sep 5 '12 at 16:44
  • \$\begingroup\$ OK, fair enough. \$\endgroup\$ – Chris Laplante Sep 5 '12 at 16:47
4
\$\begingroup\$

Yes, the 10 µF gives a low cutoff frequency, but your calculation isn't right. First you don't calculate for C1 and C2 separately; if they're parallel they act as one single capacitor. For the calculation the 100 nF C1 can be ignored, it's only 1 % of C2 and that will have a tolerance of 20 % or so anyway. And due to Thévenin you have to see the NTC and R2 in parallel, so that's 7.5 kΩ. The cutoff frequency is then 2 Hz. The second section formed by R3 and C3 has a much higher cutoff frequency, but is your power supply that noisy?

enter image description here

I would dump R3, C2 and C3, and just keep C1. Use the microcontroller to average a number of readings; a moving average filter is a low-pass filter too, is dead easy and it doesn't need any components. Olin would suggest an IIR filter (for Infinite Impulse Response), which uses less memory, but is less intuitive. Besides the moving average filter won't need 100 bytes; 5 or so is already fine.

\$\endgroup\$
  • \$\begingroup\$ "Dump...C2" ? He said this was a circuit he found in a commercial product. I was told when young that a commercial product was designed by making it "right", then removing components one by one until it no longer worked, then replacing the last one you removed. ;-) To the extent that there is any truth in this, the manufacturer must have found that they really did need C2. Of course, we don't actually know what's going on at the micro controller in the present design; you may be proposing a new design rather than improving the existing one. \$\endgroup\$ – mickeyf Sep 6 '12 at 4:21
  • \$\begingroup\$ @mickeyf - Yes, commercial designs are usually cost-optimized, but some designers and designs are better than others. I've worked for a company which made 300 % profit on simple consumer products, and they wouldn't care about the 5 cent extra cost even if they only thought it would improve design quality. \$\endgroup\$ – stevenvh Sep 6 '12 at 4:54
  • \$\begingroup\$ @mickeyf - This company seems to be the kind that stevenvh mentions. I tried replacing a 470uF electrolytic capacitor (connected after an LM7805 regulator) with a 47uF and the board worked just fine. But yes, I've seen some other boards too that probably have been built the way you described. :-) \$\endgroup\$ – Sohail Sep 7 '12 at 10:18
  • \$\begingroup\$ @stevenvh - But the NTC and R2 have only one common terminal. Would they still be considered to be in parallel? I don't think the supply is noisy. If this helps, it's like this; A 230V-12V step-down transformer -> an IN4007 rectifier bridge -> 2200uF electrolytic -> LM7805 regulator -> 470uf electrolytic. The IIR filter looks a little too um, 'involved' for me. I think I'll try the 5 number moving average method. Thanks! \$\endgroup\$ – Sohail Sep 7 '12 at 10:29
  • 2
    \$\begingroup\$ The other end of the NTC is connected to a DC voltage source (5V) and the other end of R2 is connected to ground. For the purposes of AC circuit analysis, the DC power supply is considered to have zero impedance, so these two points are effectively connected together, putting the two components in parallel. \$\endgroup\$ – Dave Tweed Sep 7 '12 at 11:04
7
\$\begingroup\$

All of the answers so far seem to be assuming that the pin on the microprocessor is an ADC input. If that's how you're planning to proceed, that's fine.

However, your original question is about the components in the original circuit. In my experience, "white goods" (household appliances) use the absolute cheapest control circuit implementations they can get away with, and I think it's likely that the micro they chose doesn't have a hardware ADC.

There are ways to measure an analog value using just a comparator, or even just using the threshold voltage of an ordinary digital input pin. The software alternately drives the pin low for a variable amount of time, and switches the pin to input mode and checks to see whether the voltage has crossed the threshold. You can infer the analog value from the width and/or the number of pulses required to keep the input near the switching threshold.

This method could easily account for all the components you see. For example, R3 could serve to limit the current into the pin when it is driven low.

\$\endgroup\$
  • \$\begingroup\$ Good point, I hadn't thought of that. +1 \$\endgroup\$ – Olin Lathrop Sep 5 '12 at 15:37
  • \$\begingroup\$ Same here; another upvote. BTW, this is how the joysticks worked on the original IBM PC line. Also, a 'scope on the running item would confirm this. \$\endgroup\$ – gbarry Sep 5 '12 at 17:35
  • \$\begingroup\$ Oh yes, that's how it is. It is PIN 27 on the Free scale MC68HC908GT8 which can be configured as an ADC input according to the datasheet. I would have never imagined doing something, um, 'exotic' like this! I think I should stick with the on-board ADC type (as a novice). But I'll save your method for later and maybe pass it on as a 'major design improvement' :-P. Thanks! \$\endgroup\$ – Sohail Sep 7 '12 at 10:07
4
\$\begingroup\$

You will get a more correct and complete answer than mine, but the short answer is "yes and no". When you see a low value (100nF) and a high-ish value (10µF) capacitor electrically in parallel, it is a filter in a sense, but it may be more meaningful to think of it as a "bypass". The idea is that you are effectively shorting out any non-DC component to ground, so that it does not impact your reading.

In a theoretical capacitor, reactance decreases as capacitance increases. This might lead you to think that the 100nF cap was contributing nothing of significance and could be left out. In the real world, the physical construction of capacitors is such that larger values do not in fact necessarily pass high frequencies as well. Electrolytics in particular, which are what you're likely to find when you get to several microfarads and upwards, don't work at all well at high frequencies either.

In practice, each of these capacitors is better at passing higher or lower frequencies, and by working in combination do a better job than either one would by itself. You may see that they are physically connected as closely as practical to the component they are bypassing, so that wiring or circuit traces are less in play. You can think of it as a filter, but it is not a "tuned" filter, rather a very broad band one. The 100nF cap at the input pins serves the same function.

\$\endgroup\$
  • \$\begingroup\$ There's also an 'R' and I came across the term 'RC filter' for this kind of a circuit (the cut-off frequency for which is given by 1/(2*piRC)). But lets call it a bypass anyways. Yes I see the ideal vs real capacitors thing from the image provided by Gaporetni below. But what bugs me is the (apparently) low cut-off frequencies that the circuits are bypassing. On what basis do I size the capacitors? \$\endgroup\$ – Sohail Sep 5 '12 at 9:53
3
\$\begingroup\$

The 100 nF caps are there to remove any noise spikes (real or imagined). The 10uF electrolytic looks like overkill. In fact, if it has any leakage (as electrolytics sometimes do), it will upset the readings.

Temperatures are usually measured once per second or even less often, so a filter with a 1 Hz cutoff still doesn't affect the results significantly, if at all.

The 470 ohms in series isn't normally needed. It is there in case something abnormal happens, such as the microprocessor pin being driven as an output, for example. It does form another RC with the 100nF cap, but the signal has already been filtered to death by the 10uF cap. Unless there a long wire between R3 and the rest. In that case, another filter could help, but then why not put all the filtering at the input pin?

\$\endgroup\$
  • \$\begingroup\$ Thanks. I get the reason for the 470 Ohm. I think I'll do away with the 10uF and use the 470 Ohm(or similar) in an RC close to the microcontroller (the sensor wire ends even before C1). What cutoff frequency to consider is the question now. But I run the risk of being moderated in asking it here :-) \$\endgroup\$ – Sohail Sep 5 '12 at 10:17
2
\$\begingroup\$

Yes, you have a resistor divider that produces the voltage, then actually two poles of R-C filtering. This would be a little easier to spot if the components were shown in a different order on the schematic. Redraw it in your mind with R2 immediately to the right of the thermistor. That can be thought of as a Thevenin voltage source with the impedance being the thermistor in parallel with R2. With the thermistor in the middle of its range it is 20 kΩ. That in parallel with R2 is 8.6 kΩ.

This resistance followed C2 to ground forms a R-C low pass filter. Actually the capacitance value is C2+C1, but C1 is tiny relative to the tolerance of C2 that you can just ignore it for this purpose. C1 is there to shunt high frequencies, like radio stations picked up by the wire.

The -3 dB rolloff frequency of the R-C filter is:

  F = 1 / (2 π R C) = 1 / (2 π 8.6kΩ 10µF) = 1.9 Hz

Temperature won't change at a rate of 2 Hz, so this will squash a lot of random noise but not interfere with the desired signal.

After this, there is another low pass filter formed by R3 and C3. However, note its rolloff frequency is much higher at 3.4 kHz. Apparently the designer thought there might still be some high frequency noise getting onto the line from somewhere. Possibly the physical connection to the left of R3 is long, and then R3 and C3 make some sense if they are close to the microcontroller. This filter does nothing with the real signal, but will filter out spikes and high frequencies picked up from elsewhere, like capacitive coupling from other parts of the circuit radio transmissions, etc. If the intent was to protect the processor from spikes, I would have made R3 larger, within the limits of the source im

\$\endgroup\$
  • \$\begingroup\$ @stevenvh: I'll leave your TEX modification, but I deliberately structured it so that it wasn't necessary. TEX displays slowly, triggers various other bad display behaviour, and dumps large numbers of files in the temp directory. It is much better to stick to plain HTML whenever possible, which I thought in this case it was. \$\endgroup\$ – Olin Lathrop Sep 5 '12 at 15:34
  • \$\begingroup\$ OK, I'll remember that for next time, and roll back. Personally I find TeX better readable and I don't notice much difference in speed. And my temp directory: I haven't checked that in eons, must contain a zillions files by now. Go figure how much I think about that :-) \$\endgroup\$ – stevenvh Sep 5 '12 at 15:41
  • \$\begingroup\$ @Olin - Yes the redrawing makes it clearer. I just drew it in the order they appeared on the PCB track. Actually all of the components are fairly close to the controller. The thermistor has a long-ish (450mm) cable though. About R3, I'm considering doing away with it and try the software (moving average) method stevenvh suggested above. Would retain a 100nF ceramic to keep the controller from listening to the radio :-). Thanks! \$\endgroup\$ – Sohail Sep 7 '12 at 10:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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