For the purposes of experimentation and learning, I have constructed a circuit that uses a pair of 100 ohm 2 watt power resistors (in parallel for 50 ohms) to gently warm up a Microchip MCP9701A active thermistor.

Here's a picture of the physical arrangement:

The circuit implemented on a breadboard

The odd looking contrivance on the left is the thermistor sandwiched between the two resistors and wrapped in copper tape to aid in thermal coupling and to add a bit of thermal mass.

The circuit diagram

An ATtiny85 is used to read the thermistor using an ADC pin, and to report the values in Celsius over a serial port link to my PC. It also controls when the resistors are being driven as heaters. This is done by a 2N7000 n-channel MOSFET.

The system is fed by 8 volts into the screw terminals on the right, then an L7805 regulator (with a 1.5 ampere output capacity, far more than necessary) provides a very stable 5 volts for the heater, the microcontroller and the thermistor.

The system can turn on the FET and the resistors warm up correctly and draw 100 mA as expected.

The code to read the thermistor is working well, and it agrees very well with an external thermocouple (within 0.3 °C or so,), at least when the heater is turned off.

The problem is that when the heater is on, the thermistor instantaneously reads high by about 5 °C, and then when the heater turns off again, it goes back to reading the correct temperature. This all takes place in less than 1 second. I stress that this is an instantaneous effect because it is clear that the thermistor immediately disagrees with the external thermocouple, even though both are closely bonded to the copper tape. The thermal mass of the heater, tape and thermistor has not had time to warm up or cool down by that much.

Something weird is going on.

My first thought was that the 5 volt power rail was sagging under the load of the heater resistors. My oscilloscope showed that this is not the case, and the 5 volt rail is absolutely rock solid (that large axial 100 µF 25 V capacitor seems to be doing its job.)

I measured it at the 7805's output pin, the microcontroller's VCC pin and the thermistor's VCC pin. All were smooth and didn’t show any disturbance from the heater resistors.

I checked for any short circuits and there were none, especially near the copper tape construction. The circuit draws 18 mA when the heater is off and 118 mA when it's heating. Indeed, all of the features of the system work well in isolation, but when the heater is on the temperature readings are immediately skewed.

What could be causing this odd problem?

New Information:

I have noticed what appears to be a capacitive coupling between the heater resistors and the self-adhesive copper tape I'm using as thermal ballast! Here's a scope measurement of the high-side of this effect:

Oscilloscope trace of the capacitive. 1 ms/div

This high-going pulse coincides with the heater turning off, and there is another similar spike (low going) that goes along with the heater turning on, which makes sense. The pulses take about 1 millisecond to dissipate.

But, if I take a wire and short this floating copper tape to GND then the scope shows that this spike has gone (as I'd expect). Yet the thermistor still has this 5 Celsius skew!

So I removed the grounding wire from the copper tape and tried adding a 5 millisecond delay between turning the heater on and taking a thermistor measurement. That solved the problem of the skewed results!

It looks like this capacitive coupling in the tape is causing something odd to happen in the circuit, which can be circumvented by waiting for it to dissipate. Closer inspection of the ADC line does show a tiny disturbance of around +100 mV (well done, @SamGibson!).

So I guess now the question is: how do I rid myself of this glitch in the ADC signal? Perhaps a suitable capacitor to GND to smooth it?

Note: Thank you to all who commented and gave answers. I really appreciate your help a great deal. I understand the problem now and I can work around it. I have learned a bit about how to properly arrange power rails and grounding, and it seems like the capacitive effect on the copper tape was a symptom rather than a cause! No worries; I can continue my project and go on to add a PID controller.

  • 1
    \$\begingroup\$ Wossname - Hi, That's an interesting problem. (a) IIUC from the datasheet, a 5 deg. C change should be a 100 mV change in output voltage - yes? Do you measure that voltage change directly at the device output using a scope, when the heater is enabled? (b) (I know this next part may be difficult) Have you (can you) show that the effect is not thermal conduction, by slightly moving everything which touches the device away from it and repeating the test? (So move the resistors slightly sideways, lift the copper tape etc. so that nothing touches the TO-92 package.) Thanks. \$\endgroup\$
    – SamGibson
    Mar 5, 2023 at 16:22
  • 1
    \$\begingroup\$ Does the code simply turn on the heat, or is it using PWM? \$\endgroup\$
    – JRE
    Mar 5, 2023 at 16:23
  • 1
    \$\begingroup\$ Also, what is the ADC VREF source set to? \$\endgroup\$ Mar 5, 2023 at 16:24
  • 3
    \$\begingroup\$ Are you using the same wire for the heater ground as for the temperature sensor ground? \$\endgroup\$
    – JRE
    Mar 5, 2023 at 16:24
  • 1
    \$\begingroup\$ I agree with SamGibson. You have to take a divide and conquer approach. First step is to measure the voltage directly at the output of the MCP9701A and verify that your temp sensor is responding correctly to the temperature change (increase). If that shows the temp sensor is OK, I would then feed a variable voltage - maybe from a pot - into the ADC input of the ATTiny85 and verify that the 'Tiny85 is converting and reporting the voltage correctly. \$\endgroup\$
    – SteveSh
    Mar 5, 2023 at 16:42

3 Answers 3


Before you read the rest of my answer, put a 100 Ω resistor in series with the gate.

These problems are almost always caused by layout. Determine the current paths for each device. They should not overlap. They can touch at the right place.

Because the gate drive and the sensor share a common ground at the MCU, the return current from the gate is likely causing a ground bounce. All the devices share a common power ground making this tricky.

The power should be distributed as follows:

  1. The input VCC,GND should go directly to the regulator and filter capacitors.
  2. From there, 5V,GND directly to the high current heater 5V to resistors and GND to the FET source.
  3. Keep the current loops as small as possible. The heater components should be as close to the 5V regulator as possible All wires short and fat. THe higher currents should return to the input first.
  4. The MCU ground should be placed as close to the mosfet source as possible. This path must take the high gate current spikes required for pwm operation.
  5. The sensor ground must be tied directly to the ADC/MCU ground to reduce ground bounce. The sensor 5V should come directly from the MCU 5V. Do everything possible so that the sensor has its own return path to the MCU.

Now, you do all this and the problem still exists. The gate return current and the sensor return current still share the same path inside the MCU althugh it is short the bonding wires are small diameter.
The only option is to reduce the current required by the gate. You can buffer the gate current with a transistor. An optocoupler will separate the ground paths, but the diode will require current through the MCU ground pin.

  • 1
    \$\begingroup\$ Thank you for this. I reckon the problem is most likely due to improper layout as you suggest. The original incarnation of this circuit was done on an old breadboard - you can imagine how bad that was! I'm happy that I understand the problem now and I realise that it's entirely manageable. As @TimWilliams said, I should be using a more forgiving method for reading and averaging the measurements. I'll continue the project, knowing that it has a few small issues and I'll develop a simple PID controller program for it. Cheers. \$\endgroup\$
    – Wossname
    Mar 5, 2023 at 20:11

Probably the biggest problem in the system is common mode voltages on the ground plane. You can troubleshoot this if you get a multimeter that can accurately measure millivolts and put one probe on the thermistor ground and another on the ADC circuit. If there is a potential difference then that is probably your issue.

Another thing is if you have the return current from the heater going on the same ground as the thermistor sensor then you definitely will have an issue. The current return path from the heater should be separate from the analog subsystem. Both the grounds can be connected together at the connector or at a voltage regulator

  • \$\begingroup\$ Currently the ground wire for the thermistor is connected directly to the GND for the heater. To be specific it's closer to the heater GND than to the voltage regulator's GND. Perhaps if I move that wire to be close to the regulator, would that help? \$\endgroup\$
    – Wossname
    Mar 5, 2023 at 17:56
  • \$\begingroup\$ The currents from the heater which are 100ma travel back though the ground wire, the ground wire has 10 to 100mohm of resistance estimated, could be more. That would make around 10mv of offset in the sensor. Whatever you do you want a good solid ground system you want the current to not run through the sensor and the ADC ground. Another thing you could do is that an entirely different voltage regulator for just the heater \$\endgroup\$
    – Voltage Spike
    Mar 5, 2023 at 18:58

How do I rid myself of this glitch in the ADC signal?

It could be a transient caused by the rapid turn on and turn off the heater control FET. I would modify your heater control circuit so it turns on and off more slowly. Maybe an RC between the gate and drain (though this will increase the dissipation in the FET)?

Note that if this is the cause, it's only going to be a bigger problem when you go to a PWM scheme to control the heater.

Oh, and do what Tim Williams recommended. Average or otherwise filter multiple ADC readings to give you a voltage/temperature value to use. This is a common approach used in telemetry systems.


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.