What I'd like to do is create a circuit that will turn on a light when the temperature gets above a certain point. The temperature doesn't have to be really accurate. It can be off by 5 degrees or so. Essentially the light would turn on when it gets hot. Obviously this is pretty easy to do with the Arduino but here's the catch. I want to do it without using the Arduino and I want to do it as cheap as possible.
So here is my idea on how to achieve this.
According to my understanding the TMP36 gives off a certain amount of voltage for the signal pin depending on the temperature. My thought process was to reduce the voltage using a resistor given off by the tmp36 signal pin so that it would be at the exact right amount to turn on a P2N22222AG transistor. So when the signal hit the P2N22222AG base and the transistor switched it would enable a light. My assumption is that I would have to experiment with different resistors to get the light to turn on at the right temperature.
So... Is this the best way to do it. I'm trying to make the circuit as cheap as possible because I want to have a few of these around the house and I don't want to spend a lot of money building them.
Thanks in advance for your help
There are some additional details that need to be considered before anyone can give you good advice, such as:
How is this going to be powered? Battery or Wall-wart? The power source will greatly influence the options you have to solve your issue via analog or digital means.
What is the power draw of the light (volts/amps) and do you want it simply to turn on/off once a threshold has been met?
If accuracy is not important, any manual thermostat will do what you're asking it to. Old style mercury units simply close a contact whenever a set point is reached and modern replacements don't need the mercury. You can then do something with that signal or use it to drive a low-power bulb.
You need a "comparator" for this.
Transistors like the 2N22222 don't turn on because of a voltage, they turn on because of current. Trying to manually tune a circuit to turn on at a specific voltage is doomed to failure.
Connect the output of the comparator to the base of your transistor. Connect one input to your temperature sensor. Connect the other input to a potentiometer and you can dial the temperature where the comparator triggers.
Comment: How is this going to be powered?
Response: A 5v battery is what I plan to use. Although it would be nice to shrink the power needs down more if it could handle it. But 5v is fine.
Comment: What is the power draw of the light (volts/amps)
Response: I haven't really decided on which light to use. I'm more at the conceptual phase of whether I'm even on the right track. I'd probably build a test circuit out of a single led just to test it. They I could adjust things from there.
Comment: do you want it simply to turn on/off once a threshold has been met?
Response: Yep. When the temperature gets hot enough I want a light to turn on.
Comment: Old style mercury units simply close a contact whenever a set point is reached and modern replacements don't need the mercury.
Response: I hadn't considered that although I probably should have clarified that I was looking for a small and cheap circuit. My understanding is mercury units are larger. But I'll definitely look into that as well.
Comment: You need a "comparator" for this.
Response: Thanks I'll look into this.
Comment: Transistors like the 2N22222 don't turn on because of a voltage, they turn on because of current. Trying to manually tune a circuit to turn on at a specific voltage is doomed to failure.
Response: Ah. Good to know. Glad I'm running it by you gurus.
Sounds to me like you will have to choose your power pack carefully and / or make some choices re: the light source to allow continuous lighting while using a battery pack as a power source. Some of the more efficient LEDs are perfectly fine as a light source down to 1mA or so. A comparator would do the trick, and NTC varistors other than the TMP36 may also be cheaper and good enough for your application based on a +/-5*C spec . I'd consider a lower battery voltage (i.e. 2x 1.5V nominal) since that would limit the drop-down resistor needed to illuminate the LED.
Thermistors are cheap. You can find some temperature control example circuits here...
http://www.vishay.com/docs/29053/ntcintro.pdf
Hi,
A look at comparator chips is on the ArduinoInfo.Info WIKI HERE:
There are links to a tutorial and some circuits...
So using the comparator I got the circuit to work. It works fine with the 3.3v off the arduino. However, I used a potentiometer as the comparative voltage to the tmp36. I'd like to change that so that it is a fixed voltage. Unfortunately, I have hit somewhat of another conceptual road block.
According to my understanding I have the following options for doing a fixed voltage. (In the cheap and small range)
Option 1: I could use two resistors to create a current divider. This would achieve the objectives of being cheap and small.
Problem: I plan to hook the circuit up to a battery. So, according to my understanding, as the voltage drops in the battery over time the amps out of the current divider is going to drop as well. As such, this doesn't really provide a fixed voltage over time.
Option 2: I could use a zener diode.
Problem: According to my understanding this would have the same issues as a current divider as voltage changes on the battery.
Option 3: I could use a voltage regulator
Problem: Perhaps this is the best option but I have some concerns regarding it. First, the little research I've done implies that a voltage regulator requires at least 2 volts above the required fixed voltage. So if I was looking for a fixed voltage of something like 0.85 v then i would have to have a battery that does 3 v or more. Which is fine. But I got so excited over the fact that I was using so little voltage that I decided to play a little game to see how little voltage I could use to make the circuit work. It would be a shame if the only reason that I was using 3V was because I had to use the voltage regulator which would output 1V and then I would have to reduce that down just a little bit more.
Another issue is that the voltage regulator can give off a lot of heat which has me concerned that it might affect the TMP36 sensor. This issue probably isn't that big of an issue. It just crossed my mind.
So... guru's what other options might I have missed that could give me a fixed voltage. Or did I make a mistake in my understanding from above?
I think you're mistaken on #2. The point of using a zener diode is that, like a voltage regulator, its 'regulated output' stays relatively constant, as long as the input voltage is higher than the breakdown voltage of the zener diode. Such diodes are frequently used in voltage reference circuits. Some comparators also include voltage references to make them easier to use and less prone to the very issue you raise.
So, creating a stable power supply is not as much an issue of whether it can be done, but at what cost (in terms of component cost vs. power consumption, vs. board space vs. temperature stability, etc.). So a zener approach might work well, but I'd seriously consider a comparator with an internal reference first - the power consumption is likely lower. Simply head over to digikey, search for a linear comparator, and filter for units with built-in voltage references. The least expensive (SOIC) single channel unit is around $0.50 (TSM931-TSM934). THrough hole versions (DIP) that work well in breadboards start around $2.75.
Cheers.