detecting when a 24v pump turns on

Hi all!

I'm trying to detect when a 24v pump comes on. It has an automatic float switch, and is driven from the same power source as my processor, which is an ATMega 328P. The processor is powered by a 5V onsemi LM2576 regulator, and the 5v and 24v circuits share the same GND through this.

I'd like to not have to run a separate wire out where the pump is, and then install a separate float switch. I'd like to just detect when the internal switch of the pump has come on. by detecting when current flows in the wire running out to the pump.

Can i just add a resistor to the 5v circuit in series with a diode and a fuse, above the pump, so that when the pump comes on, it sends my 5v to ground, but uses the current from the 24v circuit to power the pump? This seems totally wrong to me, as the 24v would be pushing back against the 5v in my poor tiny brain, which would then be stopped (hopefully!) by the diode from killing the processor.

I'm assuming it would be much more sensible to use an optocoupler, with the 24v driving the LED anode side, and my little 5v circuit just whizzing to ground and pulling the pin low when the 24v circuit is made. All optocouplers seem to be 5v LED side to me, so can i run an optocoupler through a voltage divider somehow, to reduce the current and voltage, in a way that it only comes on when the 24v pump switch comes on?

I feel as though i might be missing something really obvious, to get a safe, user proof way of getting this 24v circuit to trigger my 5v circuit within my enclosure. preferably with only one wire running from that enclosure to the pump positive or negative wire.

Many thanks in advance, you guys have all been amazing through this. This is my first post, so i hope I get it right! Gonna try to upload a kiCad thing now..... oh, i've managed to upload them, but can't figure out where to put a voltage divider in the optocoupler example! urfff... I'll try drawing it on paper again....

resistor and diode to GND.pdf (19.2 KB)

optoisolator sensor.pdf (19 KB)

-24V in the electronics world is 24V lower than 0V.
Could you change that to 0V ?

You don't have to put everything close to each other. The readability of the schematic is important, not how many space you need.
You may use a GND symbol for every ground.
Please don't put a GND symbol upwards, pointing into the sky.

I don't know what the diode and resistor do in the first schematic.
Two resistors as a voltage divider is probably good enough. Search for "voltage divider".
A optocoupler is also good, but not in the way you have drawn the second schematic. You need the optocoupler input to detect the voltage over the motor.

Thanks Kopel,

I'll have a look again at the schematics in a minute and adjust them. The diode in the first schematic is mainly because there would be a terminal after it, and i would want to prevent somebody putting 24v reverse voltage in (including myself!) With a resistor to try to avoid the motor drawing current in parallel through the processor rather than its 24v source.

I'll re-draw them now...

thanks again for the info.

Neither of those circuits will work. In one case, the voltage you're sensing is always at 24v, and in the other case it is always at ground. These will remain constant regardless of the state of the pump.

Here are two approaches that should work. I am assuming the pump is a 24v DC pump. To some extent the preferable approach will depend on your physical setup and what parts you can easily access. In the second circuit, R is a sense resistor which should be chosen large enough to give a detectable output but not so large as to affect the pump's operation. The value will depend upon the current draw of the pump. You do not want to try for a 5v output here, that would be too much drop and would affect the pump. 100 mV would be more appropriate, which means using an analog input on the microprocessor. Also understand that the pump current will be highest when it is just starting up.

S.

pumps.gif

pumps.gif

Hi Kopel and srturner,

I've realised that part of my problem is that the pumps i would be sensing are unknown and automatic, so there is no way of getting between the switch and the motor, and no way of knowing what size a resistor would be needed if i were to put one in series.

My intention with the first schematic (re-drawn and attached to this reply) is that the 5v pin is pulled to ground when the automatic switch turns the motor on. I have put a resistor in series there to limit the amount of current drawn through the pin, and would presumably have to add a much bigger pull up resistor than the internal one to compensate for this, but I can also see that I'm not going to see ground on that side of the motor as you kindly point out srturner!

With the second schematic (which I'm very dubious about, but have modified in this reply) my intention is sort of the same, in that current could flow through the LED of the optocoupler once the motor had switched on, with that current and voltage reduced by a voltage divider. Perhaps this is just adding an unnecessary component though? In my mind its kind of an ammeter without a shunt, which just isn't going to work is it?!

optocoupler sensor.pdf (20.2 KB)

pullup sensor.pdf (19.1 KB)

srturner:
Here are two approaches that should work. I am assuming the pump is a 24v DC pump. To some extent the preferable approach will depend on your physical setup and what parts you can easily access. In the second circuit, R is a sense resistor which should be chosen large enough to give a detectable output but not so large as to affect the pump's operation. The value will depend upon the current draw of the pump. You do not want to try for a 5v output here, that would be too much drop and would affect the pump. 100 mV would be more appropriate, which means using an analog input on the microprocessor. Also understand that the pump current will be highest when it is just starting up.

Thanks so much for your help S, I keep looking at the two schematics you've added, and realise that it is the first one that i need to work out, a parallel circuit, but one where I can't get between the motor and the switch! maybe it's just not possible? I'm sure it is though somehow!

Don't give up, yet. Make the R in the second drawing large enough to turn on a LED in an optio-isolator and use it's output to tell the Arduino when the pump is on.
Paul

mrmarkynose:
Thanks so much for your help S, I keep looking at the two schematics you've added, and realise that it is the first one that i need to work out, a parallel circuit, but one where I can't get between the motor and the switch! maybe it's just not possible? I'm sure it is though somehow!

It is definitely possible, it's just a question of how much trouble you're willing to go through to access the parts. A couple of years ago I implemented a similar monitoring scheme for a water softener, and it took some disassembly to get to the motor which runs the recharge cycle. But it wasn't hard to do and it works great. Again, the easiest approach for you will depend on your physical layout and what is most easily accessed.
S.

Paul_KD7HB:
Don't give up, yet. Make the R in the second drawing large enough to turn on a LED in an optio-isolator and use it's output to tell the Arduino when the pump is on.
Paul

Thanks Paul!
Is that because the larger resistor will allow a greater voltage across the LED. I suppose the resistor has become a shunt as in an ammeter in that situation?
I'm concerned that I won't necessarily know the size of the pump being used. I have some that draw 10amps, and some much smaller, and I'd like my friends and others to be able to use it to tell when their pumps are running too. So i don't really want to put anything in series with it.
I'm starting to vaguely see a situation where i could have a resistor in parallel that I could then sense? something like the attachment here? I think this is a mix of what you're saying combined with srturners second drawing? Although i guess this would still be dependant on the size of the pump, and therefore the resistor?

opto accross resistor.pdf (19.2 KB)

mrmarkynose:
I'm starting to vaguely see a situation where i could have a resistor in parallel that I could then sense? something like the attachment here? I think this is a mix of what you're saying combined with srturners second drawing? Although i guess this would still be dependant on the size of the pump, and therefore the resistor?

Look at pin 1 of the optoisolator in your diagram: it is connected directly to ground. Both pins of the optoemitter are tied to the same potential! That means that the optoemitter will never turn on. The nearby resistor also has both leads tied to ground and is therefore doing nothing.
S.

dlloyd:

That won't work either -- A0 is always at ground. But remove the connection between the diode anodes and ground and it should work, provided the pump doesn't mind being fed with 23.3v, which seems entirely reasonable. Note that the diode will be carrying the full current of the pump motor and therefore needs to be rated for the stall current.

S.

You wrote:" I'm concerned that I won't necessarily know the size of the pump being used. I have some that draw 10amps, and some much smaller, and I'd like my friends and others to be able to use it to tell when their pumps are running too. So i don't really want to put anything in series with it.".
I was not aware this was a community-wide project.
Do all the pump motors have brushes? If so, there is another way.
Paul

That won't work either --

Ha, now that looked silly! (too many interruptions so I rushed it) Thanks +1

SB2060TA

EDIT: This assumes you don't have access to the switch to motor junction, so you may need to add extra capacitance to the +24V supply to help absorb the flyback current. The external flyback diode + extra capacitance isn't needed if there's already a built-in flyback diode.


Using a resettable fuse might be an option. For example using the 30R500UMR for a 5A motor, you could monitor if its running, how much its loaded and if its tripped (re-cycling) or OFF.

Reed switch as current monitor.

Reed switch between digital pin and Arduino ground, with pull up enabled on the pin.
With a few turns of the motor wiring (+24 or ground) around the body of the reed switch.
Leo..

The reed switch/relay might work.
If the motors are brushed type, as I suspect they are, then the RFI from the brushes might be used to determine if the motor is on/off. I have built this circuit and it works. May require quite a few turns of wire around the 24 volt wires.

Paul_KD7HB:
You wrote:" I'm concerned that I won't necessarily know the size of the pump being used. I have some that draw 10amps, and some much smaller, and I'd like my friends and others to be able to use it to tell when their pumps are running too. So i don't really want to put anything in series with it.".
I was not aware this was a community-wide project.
Do all the pump motors have brushes? If so, there is another way.
Paul

Hi Paul, yeah i think all of the pumps have brushes, and they're mostly sealed. I live on a boat, and so do most of my friends, so i guess thats a boaty community if that's what you mean?! But i'm sure the arduino community could find plenty of uses for this. I'd like my water pump to stop destroying my battery bank when i run out of water, so i just want to make it turn off when it's been running for longer than the length of a shower. These ones have pressure sensors, so when the tank is empty, they draw air and keep running until the batteries are dead and the pump burns out. Usually Im at home so i just turn it off, but if theres a small leak in the system or a tap, and i'm out, then its a whole new set of batteries, and thats a bit expensive!! So i imagine that some other boaties out there would like to know how to do this! The same thing happens with my bilge pumps, one has a float switch, but the newer one now has an electric field sensing switch, no idea how that works. This must also happen in other off grid situations with water from a spring or whatever, using float switches that get stuck open. Actually, writing this to you has just made me realise that it's not even necessary to have a processor really is it? Just a timer that latches open when it reaches 20 mins, or resets itself when it loses power.... hmm, maybe thats for another day!

Edit: I've also just realised another good use for this would be to tell when a pump ISN'T running. I have a diesel heater that has a diesel pump, an air pump and a water pump. Last year the water pump failed, but the heater doesn't seem to have any safety shutoff, so it just kept pumping diesel and air in until i saw steam coming out of the casing! luckily i was in the same room at the time. I've fitted a pipe stat now, but that relies on the temperature getting too hot, which might be too late, far better to just shut it all down if the water pump isn't running! So yeah, lots of pumps, all different, some without anything written on them (as in the case of the diesel heater water pump) with therefore no particularly safe way of getting in series with them.

srturner:
Look at pin 1 of the optoisolator in your diagram: it is connected directly to ground. Both pins of the optoemitter are tied to the same potential! That means that the optoemitter will never turn on. The nearby resistor also has both leads tied to ground and is therefore doing nothing.
S.

Hi S, yes i was dubious about it! Although i was trying a variation on the second diagram you kindly drew. Is the problem that I've now put the resistor in a parallel circuit, and that simply won't draw current across it? I assumed that in your second diagram, the resistor was acting as a shunt as in an ammeter, which presumably then creates a small potential difference that a voltmeter reads, and displays on a scale calibrated to amps? Or, if i got the values right, could light the LED of an optocoupler. I can see that there's some basic things here that aren't dragging out of the recesses of my brain!! Perhaps the breadboard and the multimeter will help..!

dlloyd:
Ha, now that looked silly! (too many interruptions so I rushed it) Thanks +1

SB2060TA

EDIT: This assumes you don't have access to the switch to motor junction, so you may need to add extra capacitance to the +24V supply to help absorb the flyback current. The external flyback diode + extra capacitance isn't needed if there's already a built-in flyback diode.


Using a resettable fuse might be an option. For example using the 30R500UMR for a 5A motor, you could monitor if its running, how much its loaded and if its tripped (re-cycling) or OFF.

Hi dlloyd! Thanks so much for your reply. Thats correct that I can't really get inside the pumps, 2 of them are submersible and therefore sealed, the other one i've taken apart many times to replace the diaphragm, but the motor unit is sealed. I'm assuming they all have flyback diodes as they're bought retail units for boats.
I think in the circuit above, as well as in srturners second circuit, I will need some very big diodes, resistors or fuses, as my biggest pump is 10A DC but if it got clogged I can imagine it would draw quite a bit more than this until the circuit breaker tripped (which would at least save my batteries!) Although perhaps that means that the circuit breaker is acting as the resettable fuse in your second diagram? I'm thinking for the second diagram that that would need a voltage divider to drop down from 24v to <5v, but then it is definitely approaching what i was trying to do in my first diagram, but with pulldown instead of up?
erm...
I'm going to have a play around with the breadboard and try some of the circuits that you've all kindly suggested, and then I'll report back!
Many thanks everyone!

Wawa:
Reed switch as current monitor.

Reed switch between digital pin and Arduino ground, with pull up enabled on the pin.
With a few turns of the motor wiring (+24 or ground) around the body of the reed switch.
Leo..

Hi Leo!
Ah! thank you! That seems a great simple solution! It would mean that i wouldn't have to put anything in series with the pump, which i guess is all I'm trying to avoid really. It would also allow me to put the switch up high, remote from the soggy pump, which is another thing that i'm trying to achieve.
Many thanks, I'll order one...!