Using 0-10V Lighting Control as signal to relay switch

bertus

Joined Apr 5, 2008
22,277
Hello,

Perhaps a strange idea.
Do you want to have a state where none of the pumps is on?
This could be done using two window comparators.
One window comparator from 0 to 4 volts for pump 1.
And one window comparator from 6 to 10 Volts for pump 2.
If the voltage is between 4 and 6 Volts none of the pumps will be activated.

Bertus
 

Thread Starter

maropolinas

Joined Dec 23, 2019
22
All of this engagement is really cool. Thanks!

@MisterBill2 ok makes sense, I have to digest that design, but it seems straightforward enough. The application is this: I have an aquarium that I want to refill either with fresh water due to evaporation (small amounts several times per day; the frequent case) or with salt water for automated partial water changes (large amount once or twice per day; the less frequent case). To do this, I was thinking to use an existing device I have which automatically tops off evaporated water (it has a pump and water level sensor) by connecting a new, second pump to that device. When that device senses a low water level, it's either because of evaporation or because I've activated a third pump that removes water from the tank for an automated water change. If that third pump was recently activated, then I programmatically send a signal from one of the 0-10V dimmer lines to the relay to activate the salt water pump and deactivate the fresh water pump. Once the aquarium is refilled with salt water, the existing sensor will turn off power to the pumps. Then, the dimmer signal will programatically turn off after a fixed amount of time that is a bit longer than how long it normally takes to refill the tank, thus reactivating the fresh water pump for the next time it needs to refill due to evaporation. Other approaches welcome.

@bertus sounds intriguing! Although I can already otherwise control the outlet connected to the pump, being able to do it with the 0-10V dimmer line would free up one of those outlets, which is convenient. Most of the day, "pump 1" will be active, so I'd want to make sure that sending no signal (0v) will keep pump 1 active instead of having to rely on a signal being on to keep the pump active. I'll read more about window comparators.

@ElectricSpidey it's a fair question. I could programatically control two outlets connected to two pumps, but because I want to use the same one water level sensor for both pumps, turning off one device would have the effect of turning off the sensor that should deactivate the other pump. I'm also thinking about ways to connect the water level sensor directly to my controller and then control the pumps with the outlets as you've suggested.
 

Tonyr1084

Joined Sep 24, 2015
7,900
Hello,

Perhaps a strange idea.
Do you want to have a state where none of the pumps is on?
This could be done using two window comparators.
One window comparator from 0 to 4 volts for pump 1.
And one window comparator from 6 to 10 Volts for pump 2.
If the voltage is between 4 and 6 Volts none of the pumps will be activated.

Bertus
This is what I was thinking.

With a relay it takes so many volts/amps to click it in and will hold down to so many volts/amps before it drops out. Taking a common 12 volt relay it can take about 75 to 80 percent of its rated voltage to click in (turn on) and will hold down to (I think) somewhere around 50% before it drops out. So controlling a pump through a relay in the manor the TS is thinking means that the pump stays off until the voltage reaches about 9 volts. Once on it will stay on until the voltage drops to around 6 volts. The TS wants the pump to run until the voltage is approaching zero volts. A relay just isn't going to do that.

Now, if you need a relay to control the higher power requirements of the pump motor - you can do that with comparators. Using a voltage divider network (two resistors to set a low limit very close to zero volts - but not zero volts) then the comparator can turn on a transistor that then turns on the relay. That's the only way I see this running the pump as the signal voltage comes up above zero volts; say about 0.5 V to energize the pump. As the signal voltage varies through the range the pump continues to run until and/or unless the signal voltage drops below 0.5 V.

And Merry Christmas (you filthy animals). (Just kidding about the last part. Line from "Home Alone")
 

Thread Starter

maropolinas

Joined Dec 23, 2019
22
The TS wants the pump to run until the voltage is approaching zero volts
@Tonyr1084 I'm not sure I quite follow but I'll control the signal voltage as being either ~10V or ~0V (not in gradations) and expect the pump to be on when the signal is at/around 10V and off when at/around 0V. So I don't think a 75% activation voltage and 50% drop out voltage on the relay will be a problem for me?

The big change would be adding a resistor in series with the base connection to the transistor, in order to limit the base current. And it occurs to me that also there should be a resistor between the base and the emitter of the transistor to assure that it switches off when the control signal drops to zero, since I have no clue about the sourcing impedance of that control voltage. A suitable transistor would be a TIP29 or a TIP31, or some equivalent type. They should work just as well at 12 volts as at 24 volts. You will need to look in a transistor data sheet to find the connections and the base current needed for saturation in the on condition, so that you can correctly size the series base resistor. Also include the current through the 1000 ohm (1K) base pull-down resistor.
So there you have the circuit, total parts cost should be less than $2 usd. DigiKey is a reliable source of parts, but they may charge for such a small order. Probably any local electronics part store should be able to sell the parts, although they may need to cross to a transistor type that they have in stock. You probably will not need to use a heat sink with that transistor type, but beware that the tab is usually common with the center lead.
@MisterBill2 Ok I think I get it and made the following diagram (live link) of what I've understood. I'm quite unsure of the calculations and whether the 12V really goes to the COM of the relay. Feedback generally on this diagram and the calculations very welcome. I'd still have to find the actual transistor to use, but this at least would give me the template of calculations. Please forgive the many conventions of circuit diagrams I'm certain to have broken as these concepts are all new to me.


And Merry Christmas (you filthy animals). (Just kidding about the last part. Line from "Home Alone")
haha! merry christmas to all and thank you!
 

MisterBill2

Joined Jan 23, 2018
18,508
@Tonyr1084 I'm not sure I quite follow but I'll control the signal voltage as being either ~10V or ~0V (not in gradations) and expect the pump to be on when the signal is at/around 10V and off when at/around 0V. So I don't think a 75% activation voltage and 50% drop out voltage on the relay will be a problem for me?


@MisterBill2 Ok I think I get it and made the following diagram (live link) of what I've understood. I'm quite unsure of the calculations and whether the 12V really goes to the COM of the relay. Feedback generally on this diagram and the calculations very welcome. I'd still have to find the actual transistor to use, but this at least would give me the template of calculations. Please forgive the many conventions of circuit diagrams I'm certain to have broken as these concepts are all new to me.



haha! merry christmas to all and thank you!
YES, that is the circuit that I was describing. The only revision I suggest is changing the value of R1 to 430 ohms, because that is a standard value, while 440 is not. And with the voltage rating of the transistors and the relatively slow switch off of the transistor you will not need a diode on the relay coil.
 

Wolframore

Joined Jan 21, 2019
2,610
you need a diode (parallel) across the relay coil with the anode to the positive and cathode to the negative side, unless there’s one built into the relay. Without this diode you will burn out your transistor. You can go with a smaller transistor. 20-30 mA is in the General purpose range. Check out the 2N2222.
 

MisterBill2

Joined Jan 23, 2018
18,508
you need a diode (parallel) across the relay coil with the anode to the positive and cathode to the negative side, unless there’s one built into the relay. Without this diode you will burn out your transistor. You can go with a smaller transistor. 20-30 mA is in the General purpose range. Check out the 2N2222.
Wolf, I deliberately selected a higher powered transistor, with a higher voltage rating and a higher current rating, for this application with a slower switching off time so as to avoid needing that diode. Also, the transistor selected is mechanically simpler to deal with and only costs a small amount more. On many occasions it is better to allow a bit of margin instead of selecting a part that only just meets the assumed requirements. Sometimes reliability and robustness are more important than saving a few cents. I am fully aware that is in direct opposition to the way consumer stuff is designed, but really, for an application where reliability is important it does matter.

AND, in a system where the output voltage is an analog value, the rate of voltage change is much slower, making the inductive spike MUCH smaller.
 

Wolframore

Joined Jan 21, 2019
2,610
if reliability matters, I would put that diode in... TO-220 package for switching a little solenoid is like using a V8 on a lawnmower. Inductive kickback from a collapsing coil can be over -100V from that little coil. It's not about over-sizing the components, it's about good design and knowing what is happening.

Basically opening that circuit causes an airgap to occur and with an immense resistance across, as you know V = IR and that current stored in the coil needs to dissipate so it reverses and the voltage rises until you ruin your transistor. Try it... it's fun... if not, you're degrading the transistor and it will eventually fail. TIP29 is only rated for 40-100 depending on which version you got. As the component resistance at off is quite high, the voltage will keep climbing until it punches through.
 
Last edited:

Thread Starter

maropolinas

Joined Dec 23, 2019
22
So it sounds like adding the diode isn't going to hurt. Kindly see below (or link). Also I switched in 2N2222A because that's available at an electronics place nearby. The spec sheet on it shows Hfe @ 150ma of 100, which significantly increased the size of R1 to 1,156Ω (so I rounded to 1,200Ω which my store has in stock). That doesn't sound right though? And how do I know what wattage to pick for the resistors? If I use (10V - 0.75V) * (1200/1000) I get a crazy number.

 

ElectricSpidey

Joined Dec 2, 2017
2,779
The value of your pull down resistor is too low.

And you need to use a gain of ten to twenty to get a 222 into saturation.

Change R2 to 10k and R1 to 1k.
 

MisterBill2

Joined Jan 23, 2018
18,508
With a an Hfe of 100 and a collector current of 140 ma, the base current would be 1.4 ma, not much. A bit of excess base drive will assure adequate saturation, and you need to look at the minimum Hfe, not they typical or average value, so that it will work with a worst case transistor. So the 1.2K resistor will be close enough, and you can use that for the base pull-down as well and only need one value for the project. (Brown red red.) AND STILL, either of the transistors that I suggested are physically much more rugged and durable.
 

Wolframore

Joined Jan 21, 2019
2,610
I’ve re-read the post and I agree With MrBill I got mixed up with you guys claiming 30 mA coil current. Those Bosch styled mini relays can take anywhere from 150-300 mA to trip especially when they’re aftermarket. Also don’t rely on Hfe it’s not a good idea, when transistors heat up the beta changes, when the current goes up or down the beta changes. It’s generally a good idea to saturate by 3x what you would think.
 

MisterBill2

Joined Jan 23, 2018
18,508
I’ve re-read the post and I agree With MrBill I got mixed up with you guys claiming 30 mA coil current. Those Bosch styled mini relays can take anywhere from 150-300 mA to trip especially when they’re aftermarket. Also don’t rely on Hfe it’s not a good idea, when transistors heat up the beta changes, when the current goes up or down the beta changes. It’s generally a good idea to saturate by 3x what you would think.
THAT is another reason to choose a transistor able to handle more power than the best case condition. Ten cents of overdesign is far cheaper than $50 of rework. And being able to report "No Problem" is much better than "We are Doomed."
 

Thread Starter

maropolinas

Joined Dec 23, 2019
22
Hm so I got the the 2N2222A transistor, 10KΩ and 1KΩ resistors (1/4W), and 1N4004 diode since a local electronics store had those in stock and I was excited to give it a shot. Unfortunately, it didn't work out! But I have a feeling it's more than because the transistor is underpowered. To test it, I wired the relay so a pump was powered when the relay coil wasn't energized. Then I connected an alternating 0V/10V signal at 3 second intervals. Instead of the pump turning on and off every 3 seconds, it stayed on the whole time. I took these measurements when it was wired up and plugged in with the signal voltage alternating between on and off:
  • Voltage going into R1 with signal off was 0.83V and with signal on was 9.96V
  • Voltage going out of R1 with signal off was 4.80V and with signal on was 9.75V
  • Voltage across the C and E sides of the transistor was 11.70V when off and 12.00V when on
  • Voltage across the relay coil was 0.06V when off and 0.37V when on

Sounds like I wired something wrong? I checked ten different ways. But regardless, it sounds like I should:
  1. Switch to a TIP-29 transistor
  2. Assuming its Hfe=100@140ma, replace the resistors with 1.2K (1/4W)

Thoughts on the voltage measurements above? Great to see the back and forth; I'm having fun learning from you all.
 
N-channel FET. e.g https://www.digikey.com/product-detail/en/vishay-siliconix/IRFD024PBF/IRFD024PBF-ND/812487

Designing with one is a little different. They have a very low on resistance, so they don't generally get hot.
The Vgs voltage turns the FET on, It has limits.
Vgsth - Vgs threshold is at what voltage the FET begins to conduct. For this one it's between 2 and 4 V
You generally need about 100 ohms in series with the gate and say 100K from the gate to ground.
The 100K absorbs the leakage current.
 

Phil-S

Joined Dec 4, 2015
238
Trusted brands?
Omron is always a good start.
Finder, Schrack as well.
If you can't find a single pole relay to suit your requirements, you can always double up by using both poles in parallel on a DPDT to increase the current switching capacity.
 
Top