diy thermometer sensitivity

I have a need to measure temperature accurately from 78.0 C to 79.0 C (eventually I'll need to turn on a solenoid valve for cooling water at 79 C and turn it off at 78 C).

I saw this on the web:

formatting link

and I happen to have an Arduino on me. I read about how a 2N3904 can function as a temperature sensor if you tie the base and collector together, so I did that instead of placing an order and waiting for a thermistor to arrive.

A friend said to put the 10k resistor on the +5V line, then have the transistor below that, then tie the emitter to ground. Did that. A wire goes from the B-C-resistor junction to the ADC input on the Arduino.

It works. The serial port monitor tells me that for ice water, the 10-bit ADC value is 141. Boiling water from the microwave gives me 105. Room temperature at 23 C gave me 132.

I made a best-fit line with my OpenOffice spreadsheet and had the Arduino calculate the temperature. But now the sensitivity seems to only be 3 degrees. Temperature will jump even on gradual heating by 3 degrees.

I would like to expand the range from 105 to 141 somewhat (10 bits should get me

0 to 1023, right?)

I tried substituting 500 ohms for the 10k resistor (5V/500 ohms = 10 mA, should be ok) but still didn't get much improvement in sensitivity.

Any suggestions?

Thanks!

Michael

Reply to
mrdarrett
Loading thread data ...

For my furnace thermostats, I ended up taking many readings and averaging them, to "increase" the sensitivity. This works for me because I realized that the noise in the readings was proportional to the actual temperature (i.e. if it's actually 78.25 degrees, it will read 78 most of the time and 79 some of the time, etc).

Reply to
DJ Delorie

Oh ok, I'll keep that in mind. Thanks! The temperature changes within seconds; maybe I just have to take more samples... every few milliseconds or so

Reply to
mrdarrett

(eventually I'll need to turn on a solenoid valve for cooling water at 79 C and turn it off at 78 C).

as a temperature sensor if you tie the base and collector together, so I did that instead of placing an order and waiting for a thermistor to arrive.

below that, then tie the emitter to ground. Did that. A wire goes from the B-C-resistor junction to the ADC input on the Arduino.

value is 141. Boiling water from the microwave gives me 105. Room temperature at 23 C gave me 132.

calculate the temperature. But now the sensitivity seems to only be 3 degrees. Temperature will jump even on gradual heating by 3 degrees.

me 0 to 1023, right?)

be ok) but still didn't get much improvement in sensitivity.

As DJ recommends, over-sampling and then averaging will probably help. On the other hand, a diode-connected transistor doesn't behave quite like a thermistor. Linear has a good app note on this over at .

On the other, other hand your current empirical approach can do the job nicely if you get enough points to fit a low-order polynomial that the Arduino can handle -- or just to accurately define your threshold values and not worry about converting the A/D values to a temperature. As far as increasing your overall sensitivity, try sticking an op amp between the sense point and your A/D. That's often a good idea anyway, to buffer the sensor from the A/D input impedance. You can adjust the gain and offset of the op amp circuit to spread your range of interest across the input range of the A/D. If you're a little rusty on how to do that, read Chapter 4 of "Op Amps for Everyone", a free download at Note that the freebie is the 2002 edition. There are later editions but this is still a good book and it's, well, free!

Reply to
Rich Webb

entually I'll need to turn on a solenoid valve for cooling water at 79 C an d turn it off at 78 C).

r

unction as a temperature sensor if you tie the base and collector together, so I did that instead of placing an order and waiting for a thermistor to arrive.

Well you'll have to calibrate it somehow though.

sistor below that, then tie the emitter to ground.  Did that.  A wire g oes from the B-C-resistor junction to the ADC input on the Arduino.

bit ADC value is 141. Boiling water from the microwave gives me 105.  Roo m temperature at 23 C gave me 132.

calculate the temperature.  But now the sensitivity seems to only be 3 d egrees.  Temperature will jump even on gradual heating by 3 degrees.

get me 0 to 1023, right?)

, should be ok) but still didn't get much improvement in sensitivity.

The thermistor idea is OK. You can get 0.1 degree C thermistors for (maybe) $10 and 0.2 C for less. You'll want to think about the error sources in your measurement. (How 'good' does the +5V have to be? What about the 10k ohm resistor?)

I've got a table for a 10k ohm (room temp.) thermistor, it doesn't go up to 79 C, but at 59C the resistance is 2580 ohms and 2488 ohms at

60C. (to give you an idea of the sensitivity.) You'll do a bit better if the second resistor is closer in value to your thermistor resistance at your desired temperature. To improve sensitivity put it in a bridge with an instrument amp after the bridge and adjust the gain and bridge resistors to fill the span of your ADC.

George H.

Reply to
George Herold

(eventually I'll need to turn on a solenoid valve for cooling water at 79 C and turn it off at 78 C).

function as a temperature sensor if you tie the base and collector together, so I did that instead of placing an order and waiting for a thermistor to arrive.

transistor below that, then tie the emitter to ground. Did that. A wire goes from the B-C-resistor junction to the ADC input on the Arduino.

ADC value is 141. Boiling water from the microwave gives me 105. Room temperature at 23 C gave me 132.

calculate the temperature. But now the sensitivity seems to only be 3 degrees. Temperature will jump even on gradual heating by 3 degrees.

me 0 to 1023, right?)

should be ok) but still didn't get much improvement in sensitivity.

Great! Thanks!

I've never used an opamp before. This will be fun. =)

Michael

Reply to
mrdarrett

Ice bath (0 C), boiling water (100 C)... then again I used tap water not di stilled, and I'm probably 70 ft above sea level... eh, good enough. Least- squares trendline in OpenOffice and... voila.

ansistor below that, then tie the emitter to ground.  Did that.  A wire goes from the B-C-resistor junction to the ADC input on the Arduino.

0-bit ADC value is 141. Boiling water from the microwave gives me 105.  R oom temperature at 23 C gave me 132.

no calculate the temperature.  But now the sensitivity seems to only be 3 degrees.  Temperature will jump even on gradual heating by 3 degrees.

ld get me 0 to 1023, right?)

mA, should be ok) but still didn't get much improvement in sensitivity.

Say... what *would* the resistance of a 2n3904 be at room temperature, with the base tied to the collector? I tried to put my DMM in series to measur e the current with the resistor there, hoping to calculate R=V/I, but for some reason the Arduino refused to work this way (looked like an open circ uit to the Arduino).

Ok, I will try that.

Thanks!

Michael

Reply to
mrdarrett

distilled, and I'm probably 70 ft above sea level... eh, good enough. Least-squares trendline in OpenOffice and... voila.

transistor below that, then tie the emitter to ground.  Did that.  A wire goes from the B-C-resistor junction to the ADC input on the Arduino.

ADC value is 141. Boiling water from the microwave gives me 105.  Room temperature at 23 C gave me 132.

calculate the temperature.  But now the sensitivity seems to only be 3 degrees.  Temperature will jump even on gradual heating by 3 degrees.

get me 0 to 1023, right?)

should be ok) but still didn't get much improvement in sensitivity.

base tied to the collector? I tried to put my DMM in series to measure the current with the resistor there, hoping to calculate R=V/I, but for some reason the Arduino refused to work this way (looked like an open circuit to the Arduino).

It's not "resistance", it's a Vbe of the transistor, ~0.7V at room temperature, constant current, -2mV/°C change versus temperature.

...Jim Thompson

--
| James E.Thompson                                 |    mens     | 
| Analog Innovations                               |     et      | 
| Analog/Mixed-Signal ASIC's and Discrete Systems  |    manus    | 
| San Tan Valley, AZ 85140   Skype: Contacts Only  |             | 
| Voice:(480)460-2350  Fax: Available upon request |  Brass Rat  | 
| E-mail Icon at http://www.analog-innovations.com |    1962     | 
              
I love to cook with wine.     Sometimes I even put it in the food.
Reply to
Jim Thompson

As someone said, the articles always used to tell you to use ice cubes and boiling water to define those points, something you can easily replcate at home. But then what's the linearity between those points? Some schemes were better than others, and it's been so long.

But making a thermometer is actually different from a switch that turns on at a given temperature. You might as well get a good thermometer, and then adjust the trigger in the homemade sensor to switch at that point. Turn up the heat until the thermometer reads what you want, then adjust the trigger so it switches at that point. Then you don't have to fuss about calibrating the sensor, or worry about whether it's linear over the same range.

Michael

Reply to
Michael Black

(eventually I'll need to turn on a solenoid valve for cooling water at 79 C and turn it off at 78 C).

as a temperature sensor if you tie the base and collector together, so I did that instead of placing an order and waiting for a thermistor to arrive.

below that, then tie the emitter to ground. Did that. A wire goes from the B-C-resistor junction to the ADC input on the Arduino.

value is 141. Boiling water from the microwave gives me 105. Room temperature at 23 C gave me 132.

You're only using a fraction of the ADC range.

A Vbe multiplier would help.

+5-----R1-------+------+--- to ADC | | | | R2 | | C +----B | E | | R3 | | | | | gnd gnd

The collector voltage will be about 0.6 * (1 + R2/R3) which can be scaled up to, say, 3 volts at 80C.

You can Spice this. R1 might be, say, 5K and R3 maybe 10K.

I'd put a capacitor across R3 so the transistor doesn't rectify stray RF.

As noted, signal average to remove ADC noise.

--

John Larkin         Highland Technology, Inc 

jlarkin at highlandtechnology dot com 
http://www.highlandtechnology.com 

Precision electronic instrumentation 
Picosecond-resolution Digital Delay and Pulse generators 
Custom laser drivers and controllers 
Photonics and fiberoptic TTL data links 
VME thermocouple, LVDT, synchro   acquisition and simulation
Reply to
John Larkin

(eventually I'll need to turn on a solenoid valve for cooling water at 79 C and turn it off at 78 C).

as a temperature sensor if you tie the base and collector together, so I did that instead of placing an order and waiting for a thermistor to arrive.

transistor below that, then tie the emitter to ground. Did that. A wire goes from the B-C-resistor junction to the ADC input on the Arduino.

value is 141. Boiling water from the microwave gives me 105. Room temperature at 23 C gave me 132.

calculate the temperature. But now the sensitivity seems to only be 3 degrees. Temperature will jump even on gradual heating by 3 degrees.

me 0 to 1023, right?)

should be ok) but still didn't get much improvement in sensitivity.

As another approach the dedicated temp. chips are very cheap and would fill your needs.

Rheilly

Reply to
Rheilly Phoull

distilled, and I'm probably 70 ft above sea level... eh, good enough.  L east-squares trendline in OpenOffice and... voila.

transistor below that, then tie the emitter to ground.  Did that.  A w ire goes from the B-C-resistor junction to the ADC input on the Arduino.

e 10-bit ADC value is 141. Boiling water from the microwave gives me 105.  Room temperature at 23 C gave me 132.

duino calculate the temperature.  But now the sensitivity seems to only b e 3 degrees.  Temperature will jump even on gradual heating by 3 degrees.

hould get me 0 to 1023, right?)

10 mA, should be ok) but still didn't get much improvement in sensitivity.
r

ith the base tied to the collector?  I tried to put my DMM in series to m easure the current with the resistor there, hoping to calculate R=V/I, bu t for some reason the Arduino refused to work this way (looked like an open circuit to the Arduino).

Yeah What Jim said,

Here's a link to diode forward voltage vs temperature... (Lots of stuff you don't need there, but you can look at the first figure.)

formatting link

You'll need to drive the diode with a current source. Part of the problem with the diode is if you want to sense a 1 degree difference that's only a 2mV change in signal level.

A bridge is nice because it also reduces the 5 volt supply stability requirements.

George H.

    ...Jim Thompson
      |    mens     |
    |     et      |
 |
    |

ide quoted text -

Reply to
George Herold

ventually I'll need to turn on a solenoid valve for cooling water at 79 C a nd turn it off at 78 C).

function as a temperature sensor if you tie the base and collector together , so I did that instead of placing an order and waiting for a thermistor to arrive.

nsistor below that, then tie the emitter to ground.  Did that.  A wire goes from the B-C-resistor junction to the ADC input on the Arduino.

-bit ADC value is 141. Boiling water from the microwave gives me 105.  Ro om temperature at 23 C gave me 132.

Umm, a silly question. Is this to 'gain-up' the transistor Vbe voltage with transistor as temp sensor? Or to 'gain-up' a thermistor stuck in as R2?

I was first thinking the later... but then changed my mind.

George H.

Reply to
George Herold

should be ok) but still didn't get much improvement in sensitivity.

Won't 10 mA cause some self heating?

Reply to
Michael A. Terrell

(eventually I'll need to turn on a solenoid valve for cooling water at 79 C and turn it off at 78 C).

function as a temperature sensor if you tie the base and collector together, so I did that instead of placing an order and waiting for a thermistor to arrive.

transistor below that, then tie the emitter to ground.  Did that.  A wire goes from the B-C-resistor junction to the ADC input on the Arduino.

ADC value is 141. Boiling water from the microwave gives me 105.  Room temperature at 23 C gave me 132.

It multiplies Vbe of the transistor. Vbe changes about 2.5 millivolts per degree C, and you can multiply that by, say. 5:1 and still be in the ADC range.

LM34 is a nice temp sensor, 10 mv per degree F.

--

John Larkin                  Highland Technology Inc 
www.highlandtechnology.com   jlarkin at highlandtechnology dot com    

Precision electronic instrumentation 
Picosecond-resolution Digital Delay and Pulse generators 
Custom timing and laser controllers 
Photonics and fiberoptic TTL data links 
VME  analog, thermocouple, LVDT, synchro, tachometer 
Multichannel arbitrary waveform generators
Reply to
John Larkin

should be ok) but still didn't get much improvement in sensitivity.

It might. I touched the transistor and wondered if it was getting warm, but maybe it was just my imagination.

I wasn't brave enough to tie the transistor base and collector directly to

+5V... I didn't want to ruin my Arduino.

Thanks for the advice, everyone! My head is spinning. So many things to try.

Michael

Reply to
mrdarrett

...

A follow-up silly question... is the temperature-sensing transistor R2?

Thanks for the circuit John!

Michael

Reply to
mrdarrett

(eventually I'll need to turn on a solenoid valve for cooling water at 79 C and turn it off at 78 C).

function as a temperature sensor if you tie the base and collector together, so I did that instead of placing an order and waiting for a thermistor to arrive.

transistor below that, then tie the emitter to ground. Did that. A wire goes from the B-C-resistor junction to the ADC input on the Arduino.

ADC value is 141. Boiling water from the microwave gives me 105. Room temperature at 23 C gave me 132.

calculate the temperature. But now the sensitivity seems to only be 3 degrees. Temperature will jump even on gradual heating by 3 degrees.

get me 0 to 1023, right?)

should be ok) but still didn't get much improvement in sensitivity.

Yes, I was starting to wonder if the best approach would be to simply bite the bullet and pay the $2 for the thermistor.

But the methods everyone suggested will probably get me to where I need to go.

Thanks!

M
Reply to
mrdarrett

Use a DS18B20 => digital output and .25 degree C accuracy out of the box (if you buy genuine from someone like newark, mouser or element 14)

Reply to
David Eather

The sensor is the transistor itself, the Vbe junction drop multiplied by

1+R2/R3. All the resistors are ordinary resistors.

If 1+R2/R3 is 5, the collector voltage will be roughly 3 volts at 80C, dropping about 12 or so millivolts per degree C, 5 times the usual Vbe change with temperature.

Cute, but a tacky way to measure temperature.

--

John Larkin                  Highland Technology Inc 
www.highlandtechnology.com   jlarkin at highlandtechnology dot com    

Precision electronic instrumentation 
Picosecond-resolution Digital Delay and Pulse generators 
Custom timing and laser controllers 
Photonics and fiberoptic TTL data links 
VME  analog, thermocouple, LVDT, synchro, tachometer 
Multichannel arbitrary waveform generators
Reply to
John Larkin

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.