# Need to find a way to do different functions basedon incoming voltage

Discussion in 'General Electronics Discussion' started by ddb12, Mar 7, 2015.

1. ### ddb12

4
1
Mar 7, 2015
Hello.
I am working on a circuit, that could have either12vdc or 24vdc being applied. I need to be able to have the circuit energize a red led if12 vdc, or a green led if 24 vdc is applied.

I have been searching Digi-Key and the internet for some ideas on this, but have not foundanything that would work.

Any suggestions or recommendations would be greatly appreciated.

Thank you.

Darcy

2. ### davennModerator

13,833
1,950
Sep 5, 2009
hi there
welcome to EP

a couple of comparator circuits may do the trick for you
there are comparator circuit ideas on google and several that turn on a LED for a given voltage
you would need to combine 2 of them one for 12V and one for 24V

that's one idea for you

Dave

Last edited: Mar 7, 2015
Arouse1973 likes this.
3. ### hevans1944Hop - AC8NS

4,616
2,156
Jun 21, 2012
Connect a relay with a 24 V DC coil and SPDT contacts to your circuit that supplies either 12 V DC or 24 V DC to the relay coil. Also connect the common contact of the SPDT contacts to this source of power. Now, if 12 V DC is applied to the relay coil it will be insufficient to energize the relay, so connect the red LED (through a current limiting resistor appropriate for 12 V and the LED current) to the NC contact on the relay. If 24 V DC is applied to the relay coil, it will be sufficient to energize the relay, so connect the green LED (through a current limiting resistor appropriate for 24 V and the LED current) to the NO contact on the relay. Voila! You're done.

4. ### ddb12

4
1
Mar 7, 2015
I had seen the comparators mentioned before, however, i had passed them over as i only have 1 power source. Now that i have do ne more looking at the comparators, i bwlieve that they may be thr answer that iwas looking for. Willhave to wait until Monday to pick up more parts to test it out.

davenn likes this.
5. ### ddb12

4
1
Mar 7, 2015
Hevans1944 - i have seen to often devices that are supposed to run on 24vd, run on 12vdc (not very well). While a relay would be the simpliest solution, to high of a chance of a false trigger of the relay.

6. ### Colin Mitchell

1,417
313
Aug 31, 2014
12v or 24v
This circuit turns on a red LED when 12v is present or the green LED when 24v is present:

Arouse1973 likes this.
7. ### hevans1944Hop - AC8NS

4,616
2,156
Jun 21, 2012
Ummm. How does the circuit turn off the red LED when 24 V is present?

8. ### Colin Mitchell

1,417
313
Aug 31, 2014
"How does the circuit turn off the red LED when 24 V is present?

The microcontroller does that, along with the comparator.

9. ### hevans1944Hop - AC8NS

4,616
2,156
Jun 21, 2012
Well, your decision then. Reliability should always be the first concern. I have seen too many circuits that "almost" work "most" of the time.

I've not seen any relays with 24 V DC coils that pull-in at 12 V DC, but plenty will stay pulled in at that voltage or lower, which could cause a problem if the voltage changed from 24 V DC back down to 12 V DC. Depends on the relay construction. Maybe I've never encountered a 24 V DC relay that pulls in at 12 V DC because I never operate relays at other than their recommended coil voltage.

So, it looks like you do need a comparator circuit. Please let us know how that worked out, after the parts you ordered arrive and you get an opportunity to try it. Post a schematic too if you can. We're all here to learn from each other.

10. ### Colin Mitchell

1,417
313
Aug 31, 2014
What an absurd solution to use a 24v relay.
Where were you when they invented the TRANSISTOR ?????

11. ### davennModerator

13,833
1,950
Sep 5, 2009

What microcontroller ? -- none has been mentioned

12. ### davennModerator

13,833
1,950
Sep 5, 2009
I think it would definitely be worth experimenting with

13. ### hevans1944Hop - AC8NS

4,616
2,156
Jun 21, 2012
I was telepathologically involved with nuclear weapons in 1947 when the transistor was invented, having inspired the development of the atomic bomb three years previously while still in the womb, an attempt to free my father from a German POW camp. Fortunately for Dad, George Patton's Third Army liberated him and thousand of others, but by then the cat was out of the bag so we proceeded to test against Japan. No transistors necessary, but plenty of 24 V relays were involved.

davenn likes this.
14. ### ddb12

4
1
Mar 7, 2015
Hello. Just letting you know tbat I based my final design on the one that Colin presented. The only change I made., was to use a 18 volt zener instead of the 12volt. Asx most 12 volt power supplies actually put out around 13.5 volt, I figured that making the division at 18 volt would give the most reliable results.

Thank you for the assistance

15. ### hevans1944Hop - AC8NS

4,616
2,156
Jun 21, 2012
Never mind. I see the TRANSISTOR (a modern invention in no way related to RELAYS) shorts out the red LED when the green LED is on.
Good call, @Colin Mitchell.