motor affects temperature reading

When the motor is on, the measured temperature is 1 to 1.5 degree F lower than when the motor is off.

My DMM says the voltage of “A” (that powers the temp sensors and uC) decreases about 5 to 10mV when the motor is on (the last digit flickers…btwn 4.90v and 4.91v). A 13 mV drop would cause a 1 deg F decrease if the sensors weren’t ratiometric. But they are ratiometric, so that shouldn’t matter.

Here’s what I’ve done:

  • The motor and uC+sensors are on separate power supplies (whose grounds are all connected).
  • There is a capacitor at the motor.
  • There are decoupling capacitors immediately adjacent to the 328’s power input pins.
  • The power to the uC analog power pin and the temp sensors is from a LC filter.
  • The temp sensors are an analog-type ratiometric sensor (Analog Devices AD22100)
  • The temp sensors and motor are about four feet away from the uC
  • The temp sensors and motor are on a “star” ground (their grounds meet near where all other grounds meet).
  • Reported temps are an average of 64 readings, and they’re quite stable (vary about 0.5 deg F over an hour)

Not sure what else to do. Code is attached.

RootCellarDeployed4.ino (15.8 KB)

From the schematic it appears that you have sensors being powered from the AREF pin power, after the inductor. This is not a good idea, as noise is probably being injected into AREF via the sensor wiring, or the sensors themselves.

Reading an analogue temp sensor with default (5volt) Aref is never a good idea. Any variation in the 5volt supply will effect the temp readout.

Reading with internal 1.1volt Aref can be done with e.g. the LM35, but not with this sensor, because of the larger voltage swing.

Most Arduino board have a 3.3volt regulator. That could be used as reference. But it seems you are using a home-grown Arduino.

I see two options. 1) Add an external reference voltage (min 2.5volt for ~50C/122F), and use that in the code. 2) Ditch the analogue sensor, and use a digital one. Leo..

jrem - thanks for the idea - will give it a try. wawa - "any variation in the 5volt supply will effect the temp readout" should not be true for a ratiometric sensor

DaveEvans: wawa - "any variation in the 5volt supply will effect the temp readout" should not be true for a ratiometric sensor

It has nothing to do with the sensor. The A/D compares any input voltage to a reference voltage (default is VCC). If the input voltage OR the reference voltage changes, the A/D value will change. Leo..

The cool thing about ratiometric sensors is that their output voltage varies proportionately with input voltage. So if the sensor is powered from the same source as the ADC reference voltage (in my case the analog input voltage to the 328), then changes in the voltage don’t affect the ADC “reading.”

So if, for example, a ratiometric temperature sensor outputs 2.5 v when the temperature is “X” and the input voltage is exactly 5 v, then the Arduino’s ADC will output a count of 512. And if the input voltage droops to, say 4.8 v, then the sensor outputs 2.4v at temperature “X”, and the ADC will still output a count of 512. And the sketch will still output temperature “X”.

From the AD22100 datasheet: “Due to its ratiometric nature, the AD22100 offers a cost-effective solution when interfacing to an analog-to-digital converter. This is accomplished by using the ADC’s +5 V power supply as a reference to both the ADC and the AD22100 eliminating the need for and cost of a precision reference.”

FWIW, wheatstone bridges are ratiometric, too, and if powered from the Arduino analog input voltage will not be sensitive to changes in that voltage.

Ahhh, didn’t know they existed. Clever solution.
Double read and smoothing/averaging code could take care of the temp variation.

I guess you have connected sensor ground directly to a ground pin near the A/D.
So no other ground/supply current shares this wire.

The piezo buzzer and LED.
I doubt they draw <20mA together.
Maybe wise to use a transistor for the buzzer.
Buzzer peak currents could be several times the average current.
The diode should go across the buzzer, cathode to pin13.

You say the voltage dips, but is it clean? The ratiometric qualities you mention are only valid if the supply is clean. Yes, variations in voltage will tend to cancel out, but noise on the lines will not. You say there is a voltage dip when the motor is running, but motors can also cause lots of noise spikes in the supply lines.

jrem - unfortunately, moving the source of the sensor power to "before" the inductor made no difference.

wawa -

  • yes, the sensor ground wires are connected near 328 "analog" ground pin.
  • Also, thank you for the averaging/smoothing suggestions, but I'm currently happy with just averaging 64 samples. If the temperature is constant (by my liquid thermometer) and the fan is always on (or always off) during the sampling, the results don't vary by more than +/- 0.3 deg F or so - which is ok for my needs. It's just that I get different results when the fan is on, or off. A moving average or other means of smoothing would certainly take less time, but I'm not in a hurry to loop through the code.
  • The diode was an attempt to reduce the buzzer volume - it was too loud. I did a bunch of googling about the need for back-EMF diodes across piezo buzzers and didn't find anything very convincing. The small LED only draws a milliamp or two, and the buzzer draws about five mA, so I think I'm good there.

SS - they're wall warts. The 3A one that powers the motor had a no-load ripple of about 30 mV (p-p) if I remember correctly. I didn't test the 1A that powers the "Arduino" and sensors.

DaveEvans: I get different results when the fan is on, or off.

Do you use PWM for the fan, or just turn it on or off. Did you make a star ground for Arduino and fan supply at the souce pin of the fet. Do you also have this behaviour when the fan supply is unplugged. (trying to work out if Arduino switching and/or fan current is upsetting the readings).

I suppose, if everything fails, you could turn the fan off during the short sensor updates. Leo..

Thanks again, Wawa.

Well, I am using analogWrite with 0 and 255 to turn the fan on and off. Oddly, it works even tho' it's hooked up to pin 8, and the reference says PWM only works with pins 3, 5, 6, 9, 10, and 11. That might be because I'm just doing full on (255) and off (0). :) Using analogWrite is a hold-over from some other code. I should change it to digitalWrite.

Yes, all grounds are starred, including fet source.

I haven't tried unplugging the supply, since it works as expected when the fan is off. But I could give it a try.

Turning the fan off during reading would be a good approach. Currently I add a fudge factor that also seems to be working. Frustrating not figuring out the problem, but I have only so much time to "play."

I'm going to call it quits! Thanks for all the suggestions. +1 :)