Basic circuit with temp sensor

I'm trying to build a circuit to display a light when a temp sensor gets to a particular temp that I can set.

The sensor I need to use connects to ground and changes its resistance depending on the temp it is about 2K5 at room temp, 5K at freezing point but the values that are most important are 40 degrees C and above where the resistance drop below 1K.... The normal range will be about 800ohms for 40 degrees down to 100-150ohm ar 90-100 degrees.

I have built a circuit to turn a light on using a 2n2222 before but I've ended up burning out several components trying to work this out. The voltage I need to work with is 12-14 volts (this is a car water temperature fan control once the light works)

The circuit I made is (although I am using a 470ohm resistor and LED in place of the bulb just at the moment).

I am assuming it is because of the low resistances, the 5K variable resistor has been 1K, 2K and 3K as well !!!

Once this works I will be activating an opto couple to set a pin high on an arduino but this is the bit I'm having an issue with.

The problem:

hanges its resistance depending on the temp it is about 2K5 at room temp, 5K at freezing point but the values that are most important are 40 degrees C and above where the resistance drop below 1K.... The normal range will be about 800ohms for 40 degrees down to 100-150ohm ar 90-100 degrees.

So, you need some "logic" which a simple base-bias change to an NPN cannot manage easily.

Add in an ATtiny or a mega328 Arduino for the logic element... Loads of code on web: search "Arduino thermistor", but here is a little tutorials to give you the basics:

There is Arduino code available to do what you want in two ways:

  1. lookup tables
  2. Steinhart-Hart equations
    Steinhart–Hart equation - Wikipedia

Pick one. Copy the sample code, edit as needed. Remember, when controlling a transistor from an microcontroller output, the sink/source current necessary to flow in the base to bias the transistor On/Off will be proportional to the Collector current. Personally, I would use FETs.

Ray

mrburnette:
The problem:

hanges its resistance depending on the temp it is about 2K5 at room temp, 5K at freezing point but the values that are most important are 40 degrees C and above where the resistance drop below 1K.... The normal range will be about 800ohms for 40 degrees down to 100-150ohm ar 90-100 degrees.

So, you need some "logic" which a simple base-bias change to an NPN cannot manage easily.

Add in an ATtiny or a mega328 Arduino for the logic element... Loads of code on web: search "Arduino thermistor", but here is a little tutorials to give you the basics:
Overview | Thermistor | Adafruit Learning System

There is Arduino code available to do what you want in two ways:

  1. lookup tables
  2. Steinhart-Hart equations
    Steinhart–Hart equation - Wikipedia

Pick one. Copy the sample code, edit as needed. Remember, when controlling a transistor from an microcontroller output, the sink/source current necessary to flow in the base to bias the transistor On/Off will be proportional to the Collector current. Personally, I would use FETs.

Ray

Thanks Ray but to be honest it shouldn't really need a micro processor, I'm sure it's just me not quite understanding the ratio of resistances etc feeding the transistor. If it needed the logic of an arduino to make the decision then I could do that but I was hoping to avoid it. Also I'm working at 12-14 volts so would again be better avoided.

I'm sure it's just me not quite understanding the ratio of resistances etc feeding the transistor.

This shows why a simple single bipolar transistor cannot be used:
http://www.physics.csbsju.edu/trace/NPN.CC.html

You want an On/Off lamp... The thermistor-resistor cannot bias the transistor into saturation and take it into cut-off without going thru a linear region which will cause the lamp to glow from bright to dull... Essentially, you are building s 12V lamp dimmer.

Ray

You would be better off using an LM358 op-amp and use it as a comparator. You'd want to introduce some hysteresis though as you would find that the output flutters and the switching point, unless the change in resistance was fairly swift. Failing that use a proper comparator chip but be aware that their outputs tend to be open-collector.

As he said... the transistor will not snap on/off.

You have a couple of options, use an IC with a schmitt trigger (eg a not gate, nand, and etc)

But I'd not bother, grab another transistor tie the emitters together to gnd via a 1k or so resistor and create a schmitt transistor circuit, this will ensure a clean transition.

You would be better off using an LM358 op-amp and use it as a comparator.

grab another transistor tie the emitters together to gnd via a 1k or so resistor and create a schmitt transistor circuit, this will ensure a clean transition.

Yes. All of the above will work. But, using a $1 tiny85 eliminates all of this and allows you to create the set-point and the hysteresis and any other parameters you may want now or in the future. The reason I recommended the Arduino approach (other than this is the Arduino forum) is the fact that some things just scream uC. IMO, this is one. I'm a EE and my transition to software was an absolute next-evolutionally experience.

There are many EE forums on the internet that are heavy into designing discrete circuits for creating such circuits.

http://www.electronic-circuits-diagrams.com/forum/

To the Op:
If you want to use discrete circuits, which is perfectly adequate for this job, then do yourself a favor and use SPICE to design the hardware circuit. There are many freely downloaded versions, but I really like the ease of this online version which also has a great library of examples:
http://www.falstad.com/circuit/

Just my opinions...

Ray

My apologies, I thought he said he didn't want to go that route. :frowning:

I'll leave it to the experts in future. Sorry if I stepped on any toes.

PS, I, too, would use a Tiny myself :slight_smile:

My apologies, I thought he said he didn't want to go that route. smiley-sad

I'll leave it to the experts in future. Sorry if I stepped on any toes.

PS, I, too, would use a Tiny myself smiley

NO TOES damaged! I was just expressing my opinion and an explanation why I suggested the software approach. I was not being critical of your suggestion. The Op is looking for a component approach which is fine.

If it needed the logic of an arduino to make the decision then I could do that but I was hoping to avoid it.

Keep the suggestions coming, they were appropriate for the Op's question and desires.

Ray

Thanks everyone, I thought it would be a simple job like with a light detector circuit.

The idea is that at 87 degrees C (for example) the temperature sensor might be at 300 ohms resistance my plan was that by adjusting the variable resistor you would create an output voltage high enough to trip the transistor

eg..

Obviously R2 CAN swing from virtually zero to 5K but the only useful values are sub 1K anything over 1K would always be OFF / 0v for the Vout.

I've abandoned the original plan now and.........

I've decided to stick an Arduino in there now so using a 12K will give me a range of 0 to 5V across the range of 0 to 6K for the temperature sensor which I can then feed into A0. I can then stick a 10K variable resistor across 5v/gnd into A1 and write the simple software to adjust the value of A0 to use as a switch point, doing that will allow me to give an upper/lower range to switch ie +0.050 avoiding rapid on off switching when it is close to the switch point.

Except a single transistor does not "trip", it amplifies.

A single Op Amp or Comparator with a little positive feedback can be set up as a schmitt trigger with adjustable trigger points and trigger width. Or use an ATTiny and be able to adjust it simply in software.

polymorph:
Except a single transistor does not "trip", it amplifies.

A single Op Amp or Comparator with a little positive feedback can be set up as a schmitt trigger with adjustable trigger points and trigger width. Or use an ATTiny and be able to adjust it simply in software.

I had a pile of PCBs made last year which have a 10K pot going to one analogue in. Just wired a pot onto A0 so I can test the process and write the software. Should be able to get it working in a few hours now..

Thanks