Below temperature circuits with leds - Page 1
Forum section: electronics / beginners

author: RobH
author_rank: Regular Contributor
timestamp: December 31, 2024, 05:00:56 pm
content: I would like just information about what is supposed to happen.I have seen couple of different said circuits which use leds, and I ended up building one using an LM35 and LM741. There are 2 leds, 1 red and 1 green and when the circuit is powered by 9v both leds are lit but the red one can be turned off.My question here is, if the temperature is below a certain figure does the red led come on, and should the green led stay off until the temperature reaches the set figure, say 20C, and then the red led goes off. is that how they supposed to work.If required I'll post the link to the circuit I have built, which is still in testing stage at the moment.Thanks

author: Zero999
author_rank: Super Contributor
timestamp: December 31, 2024, 09:17:39 pm
content: Sorry, my crystal ball has gone cloudy.Note that the LM741 doesn't work when its inputs are within 2V of the positive or negative rail, so both inputs need to be within 2V to 7V, when run off a 9V battery.Post a schematic.

author: RobH
author_rank: Regular Contributor
timestamp: December 31, 2024, 11:11:16 pm
content: As requested:https://www.gadgetronicx.com/temperature-controlled-led/I changed the CA3031 for LM741I changed BC107 to BC547,The above changes were made because I didn't have what the circuit called for, so I used equivalentsR3 is now 1KR4 and R6 are now 1KI am running it from a 9V bench supply Pin3 on IC1 is 0.209V, and Pin2 is 2.0VThe red led is off but the green one is permanently on with the current temperature at 20CThanks

author: PGPG
author_rank: Frequent Contributor
timestamp: January 01, 2025, 01:20:32 am
content: Quote from: RobH on December 31, 2024, 11:11:16 pmCA3031 can work with input voltage from -0.5V up, while LM741 from 2V up.As you write you have at pin3 about 0.2V. It is out of LM741 input voltage range.You can replace OpAmp with popular LM393 comparator (LM193, LM293, LM2903 - all are practically the same). It will work with inputs close to 0V.It has OC output so you need to modify driving Q1 a little, or probably even can do without Q1.

author: RobH
author_rank: Regular Contributor
timestamp: January 01, 2025, 11:27:27 am
content: Thanks for the reply, and my apologies, as I had forgotten that I did change the LM741 to a CA3130, doh!It was another temporary try out circuit I used a LM741, and the voltages on the respective pins 2 and 3 are different than on the CA3130. With the LM741, pin 2 is 1.8V , and pin3 is -0.07VSo, regarding my question about the leds, does 1 stay on below a set temperature, then goes off then another goes on etc. If not how do they work.Thanks

author: Zero999
author_rank: Super Contributor
timestamp: January 01, 2025, 11:48:21 am
content: It's possible to use the LM741 but the voltage on both inputs need to be within 2V of the supply rails.I've redesigned the circuit to work with the LM741.5V is too low for the LM741. Run it directly from 9V.Add a 10k resistor from the LM35's negative supply and the potential divider to 0V. The current though the LM35's negative supply pin is fairly constant (typically 56µA) over a large temperature range, so you can get away with it. This will set the voltage at both of the LM741's to about 2.6V. If better temperature stability is required then reduce R3 to 1k and add another 1k to 5V. Another option is to use a voltage reference such at the TL431 and another resistor to the output of the 7805. Now the positive of the LM35 also needs to be connected to 9V, because it needs a minimum supply voltage of 4V and with 2.6V at the negative and 5V at the positive, it would only be 2.4V.There's no need for those transistors. The op-amp is more than capable of driving the LEDs directly, if the forward current to about 5mA, which the op-amp should be able to handle. If using crappy old LEDs, reduce R4 and R5, but I wouldn't recommend going below 470R.

author: SteveThackery
author_rank: Super Contributor
timestamp: January 01, 2025, 01:30:15 pm
content: I think the OP is asking whatshouldhappen with the LEDs as the temperature changes.With reference to the original circuit, the output of the LM35 rises as the temperature rises.TEMPERATURE BELOW THRESHOLDAssuming that the LM35 output (connected to pin 3 of the comparator) is lower than the voltage you have set on pin 2, then the voltage on the comparator output (pin 6) will be close to ground. In fact it needs to be less than 0.6V so that it doesn't send current into the base of Q1. In this circumstance:1/ Current flows from the 5V rail through R4, D1, R5 and into the base of Q2, switching it on, so that current can flow freely from Q2's collector to its emitter. Thus current can flow from the 5V rail through R6, D2 and Q2 to ground,lighting up the green LED (D2).2/ The base current that switches on Q2 flows throughthe red LED, which is likely to glow dimlyas modern red LEDs are very efficient.TEMPERATURE ABOVE THRESHOLDWhen the temperature rises such that the input voltage to pin 3 of IC3 goes higher than the reference voltage on pin 2, the voltage on IC3's output pin (pin 6) switches high - that is, switches to a voltage just a little under 5V.This forces current into the base of Q1, switching Q1 on such that current will flow freely between its collector and emitter. This time, the current through R4 and D1 has an easier path straight to ground (via Q2) compared with having to go through R5 and Q2. Thus two things happen:1/ Current flows freely through R4, D1 and Q1, lighting up the red LED (D1) brightly.2/ No current flows into the base of Q2 (because it's all gone through Q1 to ground), switching Q2 off, and therefore no current can flow through R6 and the green LED. Thus the red LED glows brightly and the green LED is off.As you have already read, there are problems with this circuit, not least that the red LED will probably glow dimly even when it should be off. It also requires a comparator that will drive its output close to the -ve rail in order that Q1 remains completely off under low temperature conditions.Anyway, that is how the original circuitshouldbehave, which is what I think you were asking in your first post.

author: Zero999
author_rank: Super Contributor
timestamp: January 01, 2025, 02:04:23 pm
content: Which is somethinghe shouldbe able to figure out for himself.A a few of hints:The LM35 has a positive temperature coefficient: +10-mV/°CThe op-amp is configured as a comparator. Its output goes high, when the voltage on +input > -input.In the circuit linked to by the OP:Q1 turns on, when the op-amp's output goes high.When Q1 is off, Q2 is turned on, with the base current passing though: R4, D1 and R5.In the circuit I posted:D1 turns on, when the op-amp's output is low.D2 turns on, when the op-amp's output is high.

author: RobH
author_rank: Regular Contributor
timestamp: January 01, 2025, 05:41:47 pm
content: Yes I hoped it would work as expected, but it didn't. Initially I built the circuit to the schematic, but when powered up both leds came on and I couldn't turn either off by the pot. I then changed some of the resistors so that I could then turn off the red led. This is the current situation and the green led is on all the time.The red led is just off at 2.13V on pin2, and pin3 is at 0.213V , and the temperature is almost 21C---------------------------------------------------------------------------------------------------------------------------------------------------------------On the circuit which you provided here, if I have understood it correctly, I have not used a LM7805 as yet, because you said to run it off 9v. so I now have a 10k resistor on both the 2 outer pins of the 3K pot ,1 to 9v and the other to GND. In this situation the voltage on Pin2 is 3.62V. using a 3K pot, I can adjust the voltage from 3.62 upto 5.5V, and both leds are lit. The voltage on pin3 is now 0.169VThanks

author: Zero999
author_rank: Super Contributor
timestamp: January 01, 2025, 07:44:21 pm
content: The positive side of resistive divider (R1 & R2) should be connected to the LM7805's output. The negative side of R2, along with the LM35's negative pin, should go to 0V, via a 10k resistor. This is important because it keeps the voltages at both inputs well above 25V, with respect to the op-amp's negative rail.The fact that pin 2 is at 2.12V and pin 3 is at 0.23V, indicates that the LM35's negative pin is connected to 0V, not the R3, according to my circuit. Check all of the connections again.

author: RobH
author_rank: Regular Contributor
timestamp: January 02, 2025, 01:01:08 pm
content: I have now connected the LM7805, and rewired the circuit to suit. I have also checked it over as per your schematic, and hope I have it correct now.The voltages I get now are:Across LM35 GND and outer pin of 3k pot: -5.4VPin2 of U3 Adjustable between 1.9V and 3VPin3 of U3 8.5VFrom the OUT pin of LM7805 I get 5VD2 is on all the time while D1 is off all the time, with a current temperature of 19CI have attached a picture of my circuit and hope it is clear enough to see the wire connections, or any corrections I might have to makeThanks for your help and patience.

author: Zero999
author_rank: Super Contributor
timestamp: January 02, 2025, 06:32:17 pm
content: The negative voltage doesn't make sense, unless you've got the meter probes the wrong way round.Presumably the out of focus component with the red, yellow and black wires soldered to it, is the LM35. It has no negative connection, other than a capacitor, which will just charge up.

author: RobH
author_rank: Regular Contributor
timestamp: January 02, 2025, 07:42:02 pm
content: Yes the out of focus item is the LM35 on wires to lift it up in the air.Agreed, yes the negative voltage had me wondering why, but as I wired the circuit as per the schematic which shows a 10uf capacitor to the negattive side of the LM35. Should there be both that and a wire. Anyway I removed the capacitor and just used a wire to the negative of the LM35.Now that makes a big difference:From Negative of LM35 to the outer pin of the 3k pot, R2, I now get 2.54V on pin2, with both D1 and D2 lit, but D1 can be turned off by adjusting R2Also the voltage on pin3 is now 0.208V with a current temperature of 20.3C.

author: Zero999
author_rank: Super Contributor
timestamp: January 02, 2025, 08:56:36 pm
content: Quote from: RobH on January 02, 2025, 07:42:02 pmBut it's not connected to R3, so it can't possibly work. The capacitor will just charge up. The LM35 needs a DC path to 0V in order to work.Refer to the picture below. I've added the component idents and a marking to indicate pin one of the op-amp (please do this in future, it doesn't take long). Note the extra missing wire, shown in blue, connecting the LM35's negative to R2 & R2.Please check your wiring, then check it again, before asking further questions.

author: RobH
author_rank: Regular Contributor
timestamp: January 03, 2025, 05:37:27 pm
content: I have now added the wire from the negative of LM35 to R2The readings I get are:From LM35 GND to R2: 0VFrom Pin 2 of U3 between 2.3V and 3.2VFrom Pin 3 of U3 2.5V.The current temperature is 19.7C, so I can't help thinking something else is incorrect. There is only C2 in place with no GND wireThanks

author: Zero999
author_rank: Super Contributor
timestamp: January 03, 2025, 10:54:50 pm
content: Those voltages sound correct. Do the LEDs change state, as R2 is adjusted?

author: RobH
author_rank: Regular Contributor
timestamp: January 04, 2025, 09:19:15 am
content: Thanks, but no the leds don't change state when I adjust the voltage on PIn2. When the voltage on Pin2 is at 2.471V D1 is off and D2 is on. When I increase the voltage to Pin2 , to 2.487V, D1 comes on, but D2 stays on, but not full brightness, as it seems to dim somewhat.Also, as the temperature has increased by 0.6C, so does the output voltage from U3 decreased by about 0.25VThe current temperature is now 18.9C.Update:With the current temperature now at 19.5C, when I adjust the voltage so that D1 lights up and D2 is a little dimmer, the voltage on pin6 goes down from 7.47V to 2.63VI would be interested to know now, at what temperature D1 comes on and D2 goes off.

author: Xena E
author_rank: Frequent Contributor
timestamp: January 04, 2025, 11:49:38 am
content: The device you are using (741?) can't swing its output fully to the 0 volt rail whilst sinking current. If you want to have LEDs lit one at a time it won't be possible using that circuit.Hint: Consider making use of the different forward voltages of the LEDs to effect the switching.X

author: RobH
author_rank: Regular Contributor
timestamp: January 04, 2025, 12:28:15 pm
content: Quote from: Xena E on January 04, 2025, 11:49:38 amI am using a LM741, but what other device do you recommend then. I have LM1458, LM324, LM358, LM4562, LM339 and a CA3130Sorry, but how do I 'making use of the different forward voltages of the LEDs to effect the switching'. Please explain to an amateur .Thanks

author: Xena E
author_rank: Frequent Contributor
timestamp: January 04, 2025, 01:49:42 pm
content: When I'm home I'll sketch something for you to try, I assume you want the green LED to light when the output of the chip is low?X

author: RobH
author_rank: Regular Contributor
timestamp: January 04, 2025, 01:59:02 pm
content: Yes, I want the green led to light up at a set temperature and the red led to go off at that same temperature. But how do I set the required temperature of say 21C.thanks

author: Xena E
author_rank: Frequent Contributor
timestamp: January 04, 2025, 03:49:52 pm
content: Heres how to drive the LEDs from a 741Circuit and post edited for accuracy.The green LED will be lit when the output of the 741 is low, and the red when it is high.Using a comparator such as a 393 would have made your life so much easier, though this way it will work.Quote from: RobH on January 04, 2025, 01:59:02 pmYou will have to set the comparator circuit to toggle the LEDs when the output of the LM 35 is @ 210mV.Can you post an accurate diagram of what you have built so far, (not external links).X

author: RobH
author_rank: Regular Contributor
timestamp: January 04, 2025, 04:31:13 pm
content: Thanks for the drawing, and I don't have any 1N4147 diodes but just Zener diodes.What I have built , please refer to Reply N05 by zero999. It is the picture he did for me as a modification to the one I posted a link to which I built

author: Xena E
author_rank: Frequent Contributor
timestamp: January 04, 2025, 05:09:23 pm
content: I'll have to alter that sketch it should be 1N4148 diodesAny silicon signal or small rectifier diodes will work they're only being used to raise the turn on voltage of the LED so that only one is on at a time, for instance 1N4000 series would do fine, 2.7V Zener may be OK but remember the Cathode marked connection goes to Positive.A bag of 1N4148, 1N914, or similar are dirt cheap and always worth keeping by.As for the circuit I'm not sure about being able to use the LM35 like that without my checking the app notes, (Zero999 isn't often wrong), the problem is trying to use that arrangement and with a 741, which is an antiquated op amp, and isn't suited to single supply rail use. Have you not said you have already had it switching?Try the LED circuit and then go from there...

author: RobH
author_rank: Regular Contributor
timestamp: January 04, 2025, 05:57:24 pm
content: Just some observations from a brand new circuit , part from xero999 and part from yourself.I can get the green led to come on when I alter the pot to 2.9V on pin2. At the same time pin6 goes from 8.5V down to 2.77V.The red led does not light up at all.When the green led is on, I then get a negative voltage of upto -9V on the 1N1418 diodesOut of interest can I swap the LM741 for any of the op amps that I already have to improve it.Edit:I changed the UA741 for a CA3130EZ which I had, and was used in the original circuit.It hasn't made any difference to the red led not coming on, and still has a negative voltage.Thanks

author: Xena E
author_rank: Frequent Contributor
timestamp: January 04, 2025, 06:11:20 pm
content: Check your connections and polaritiy of the diodes and red LED carefully.Where are you getting negative votages from?X

author: Zero999
author_rank: Super Contributor
timestamp: January 04, 2025, 06:20:13 pm
content: Quote from: RobH on January 04, 2025, 09:19:15 amThe voltage drop on the LM741's output is higher than I thought,. Try adding a diode in series with D2.Quote from: RobH on January 04, 2025, 12:28:15 pmOr use the LM358. That avoids having to mess around with lifting the LM35's ground.

author: RobH
author_rank: Regular Contributor
timestamp: January 05, 2025, 11:12:47 am
content: Thanks for the new circuit, and I've now put it together.Observations:Both D1 and D2 are on all the time, and adjusting R2 does not turn either of them offTurning R2 down to 0V gives a reading of 0.204V from the LM35, which is just above what I would expect at a current temperature of 19CThe voltages on Pin1 of U3a is 5.28V and on Pin7 of U3b is 7.50VThe voltage at R1 and R2 is 0V, but can be adjusted.I've tried x3 LM358's in case 1 was faulty, but they were not.Again, thanks for your time and help.

author: Xena E
author_rank: Frequent Contributor
timestamp: January 05, 2025, 12:12:10 pm
content: This is intriguing.I spent a few minutes "breadboarding" the convoluted LED driver from 741 circuit I posted, and that worked as I expected.Now we are on a different circuit?OK, it's a wet horrible day outside I'm up with my chores, so I'll play along and do this one as well...Question: what is the forward voltage of the two LEDs you're using? (Measure across them when they are on).Can you post a photo of the latest circuit as assembled?X

author: Xena E
author_rank: Frequent Contributor
timestamp: January 05, 2025, 12:42:43 pm
content: OK.Zero999 circuit with the 358 works exactly as intended with the caveat that atexactlythe threshold point both LEDs are lit. That could be cured with a little hysteresis.

author: RobH
author_rank: Regular Contributor
timestamp: January 05, 2025, 12:54:47 pm
content: Well if the 'the convoluted LED driver from 741 circuit ' worked for you, I must have made some error somewhere but I have dismantled it now.Yes it's also very wet and horrible here with about 50cms of snow lying.The forward voltage of D1 is 2.71V and D2 is 1.95VPicture attached as requested. Please note that R5 was or is 100 ohm in the picture, but it is now 1K. I only realised when I looked at the picture close up!The voltage readings are correct for the R5 resistor now.Just saw your post about hysteresis, could you please advise on how littleThanks

author: Xena E
author_rank: Frequent Contributor
timestamp: January 05, 2025, 01:03:38 pm
content: Theres no connection to pin 4 of the 358 for a start...X

author: RobH
author_rank: Regular Contributor
timestamp: January 05, 2025, 01:53:46 pm
content: Oops, no there isn't but now there is, my bad, doh!!Now only D2 is lit. Also adjusting the pot doesn't change the voltage on Pin2 as it is constant at 0V.I am getting 0.216V on Pin3 from the LM35.If I use Pin1 for the output on zero999 circuit with a LM358, which pins are used for hysterisis. Or should I use Pin7.Out of interest, which led , D1 or D2, is lit for the temperature I want it.thanks

author: Xena E
author_rank: Frequent Contributor
timestamp: January 05, 2025, 02:16:49 pm
content: Check your wiring around the pot.D1 is lit when the LM35 is over set temperature, D2 is lit when the LM35 is is under set temperature.Please don't ask how to swap which colour led is lit

author: RobH
author_rank: Regular Contributor
timestamp: January 05, 2025, 02:31:39 pm
content: The wiring is ok round the pot, and it is because of the angle of the picture which makes it look like the wires are wrongly placed. Apologies for that.The voltage on Pin3 from the LM35 is 0.228V, which from what I read last week somewhere that the LM35 puts out? roughly 0.010V for each 1C, so 0.228V would mean its 22.8C, but it isn't. It is currently 20CHow do set a temperature for the LM35 , ie 21C, so D1 comes on and D2 goes off.thanks

author: Xena E
author_rank: Frequent Contributor
timestamp: January 05, 2025, 03:07:31 pm
content: QuoteThe black wire to 0V and the white wire both go to connection strip 9. Therefore are shorted out? Thats why you have 0V at the wiper.it is the only explanationQuoteTolerance of the device and your meter?QuoteAlready answered: get the circuit working and go from there.X

author: RobH
author_rank: Regular Contributor
timestamp: January 05, 2025, 04:55:02 pm
content: I made some alterations with the circuit:1st I swapped what I thought was a 3k pot , but measured as a 5k, for a 1k then added a 1k resistor to give 2k.Now the voltages are:Pin2, between 2.38V and 2.6VPin3 reads 0.223V at a current temperature of 20.2C. The said temperature is measured on or from a Davies weather station, which reads internal and external temperatures. Using a normal indoor digital thermometer, it says 21C, so I'll live with that so to speak.Also now, only D1 is lit and D2 is off, but I want to see what is lit when the temperature drops a few degrees.Yes I found where you answered about toggling the comparator. Googling it says to change the input voltage , VIN, which varies between 2.38V and 2.6V. is it a case of lower the voltage, then lower the temperature thresholdThanks

author: Xena E
author_rank: Frequent Contributor
timestamp: January 05, 2025, 09:23:07 pm
content: Quote from: RobH on January 05, 2025, 04:55:02 pmIf, you only have a 1k pot, just wire it as Zero999 diagram and change the R1 to 4k7.Again.The output LEDs will toggle from one to the other when the voltage at the pot wiper is matched by The LM35.X

author: RobH
author_rank: Regular Contributor
timestamp: January 06, 2025, 10:07:37 am
content: If 'The output LEDs will toggle from one to the other when the voltage at the pot wiper is matched by The LM35.', then that would mean changing the resistor value which I added to R2 somewhat, or changing R2 for a 5K or even a 10K pot.I say this because with a 1k resistor added to my R2, 1k, the voltage at pin3 is between 2.38V and 2.6V while the voltage on pin3 from the LM35 is just 0.202V with a current temperature of 19C.I then changed the 1K resistor from 1K to 2K, and the voltage at pin2 is now between 0.775v and 1.1V.Does that sound right or am I off track somewhere.Thanks

author: SteveThackery
author_rank: Super Contributor
timestamp: January 06, 2025, 11:17:05 am
content: @RobH: it's getting quite tricky to follow exactly where you are. Could you remind us which circuit you are using, and what the various component values are? Maybe repost the schematic, updated with the current values. Also, please put pin numbers on the LM358s. That will give is an easy reference point.Second question: do you have an oscilloscope?

author: Xena E
author_rank: Frequent Contributor
timestamp: January 06, 2025, 11:31:15 am
content: AgainQuote from: Xena E on January 05, 2025, 09:23:07 pm

author: RobH
author_rank: Regular Contributor
timestamp: January 06, 2025, 02:05:17 pm
content: Yes, I tried with the 1k pot and a 4.7K resistor, but not quite as the circuit. I put the resistor to GND and adjustment was very very fine, so much so the figures were jumping up and down too much. I then tried a 10K pot, but adjustment , again, was all over the place. Anyway, I've now wired it as per the circuit and it is much better, adjustment wise.The strange thing is , I've noticed today, is that while the LM35 is giving 0.209V and the current temperature is just 18C, if I adjust the input voltage to anything more than 0.184V D1 comes on and D2 goes off. So I have the voltage in , VIN, to 0.184V and D2 is on, which is what I want.thanks

author: SteveThackery
author_rank: Super Contributor
timestamp: January 06, 2025, 02:11:56 pm
content: Quote from: RobH on January 06, 2025, 02:05:17 pmSo does that mean it's all working now? Can you switch between the red and green LEDs just by adjusting the pot?

author: Xena E
author_rank: Frequent Contributor
timestamp: January 06, 2025, 02:17:41 pm
content: Quote from: RobH on January 06, 2025, 02:05:17 pmTFFT.Regards,X

author: RobH
author_rank: Regular Contributor
timestamp: January 06, 2025, 02:36:45 pm
content: Yes it is working as I can switch between D1 and D2 with the pot.Now I'm going to try other circuits which would? give the same result.Thanks again