As I travel through my Christmas Tree Watering System, I decided I wanted to put a fail-safe feature into the design. I mean, what happens if a pressurized hose pops off, or a cat claws a feeder hose causing a leak?
The idea is to have a signal/measurement reference voltage to the controlling MCU on the current used by the pump. If current is being used by the pump and the program has not intended it, the program can shut off the pump until reset manually. The idea is to prevent my home from being flooded by the pump in case a hose pops off or a cat claws the feeder hoses to the Christmas tree watering pan.
I noticed modules on eBay that do this, but not sure if they are right for my 12 vdc/3 amp feed to the pump motor. The only other option I see is to have a pressure switch in the feeder tube system to signal when pressure drops unintended.
As always, advice is needed. Thank you guys!
Current Sensing - Best Approach Advice Needed
4 years 1 month ago #17337
I'm not sure exactly what problems you're trying to solve. I'm assuming a pump is on only when you want water to flow and that the micro controls to pump. So why (how?) should the pump be on unless the micro has commanded it, and how will the micro be able to turn it off if it somehow didn't active the port pin to turn it on? In other words, if the micro didn't tell it to run, why would you expect the micro to turn it off?
If you're afraid the somehow the motor will run when it shouldn't, how about using a port pin (with a suitable voltage divider) to monitor the motor to see if it has operating voltage? This can be a logic pin (not analog), with the voltage divider configured to provide 5v when running and 0v when not.
If you're worried about hoses coming disconnected or being chewed through, how about measuring flow? For the irrigation at least, if there's some flow limiting such as drip heads at each plant, flow will be much greater if a hose becomes disconnected. Elecrow (and others) have some flow meters that would detect a change in flow.
For adding water to a Christmas tree stand, the problem is a little different. That's probably full flow out the tube for a certain period of time. You can't tell by flow rate if anything is amiss. If I recall, you mentioned using an ultrasonic sensor to measure water level. The rise in level vs pump operation time should be pretty constant. So measure this when the pump runs. If you don't get a rise of a quarter inch in the expected time, shut it down. You may get some water on the floor, but you won't fill the house.
As far as detecting level, or at least detecting when the reservoir is full, you could use a moisture sensor like this one Elecrow sells. It's designed to measure moisture level in plants, but as long as your water isn't totally pure, it would detect when the fluid level reaches the tips.
Maybe Hop is using a pump with a presurized reservoir that turns on when the presure drops, and a solenoid valve is controlled by the micro? Then he needs to know if something before the solenoid is wrong.
From the top of my head, you can use a current measuring IC, like the ina219 (I made some experiments with it).
Or just use an small shunt resistor (0.1 or 0.5 ohm) in the low side, amplify the voltage drop with an op-amp, and feed the output to a comparator (another op-amp or a comparator in the micro) or an analog input.
Or tap the presure sensor that turns the pump on.
But as Jon said, if the pump is controled by the micro, you don't need to know when it turns on, you already know.
You know, I strive not to sound vague in my questions, but especially after reading your reply Jon, I was embarrassed that I did not include enough information. Baldor had it dead on.
The only reason I am using the micro via the 2N2222 and the IRF540 to turn on the pump is that I can also turn it off, instead of having the pump on via hard-wired using a switch. Because I am using a pump that pressurizes the system to 100 psi, I will control flow using solenoid valves. So, if the pump runs and the solenoids are not open, there is a problem. So I decided to add detection of the pump running in this scenario so the micro can shut off power to it, as a fail safe. The only problem with this option is that there will be a delay from when the solenoids are open and when the pump's pressure sensor triggers to turn the pump on, and the pump might still be running to get the system back to 100 psi after the solenoids are closed. This should be easily compensated however through code running on the MCU.
I can code for the pump to run without the solenoids opened for a specific time before emergency shut-off. I can also code for an expected period of time for the pump to be perceived to safely run after the solenoids have closed. Considering the short length of tubing I am using, these timings should be fairly short in duration.
Of course, this is programming for eventuality and that is something I excel at. I am always considering strange occurrence scenarios and program for those situations. To a fault mostly, but covering all the bases is what I try to do.
Thank you Jon and Baldor for the options for being able to tell if the motor is running or not. I never want my code to assume ANYTHING so I need to have that feedback when the motor is actually kicked on and running.
I would be a nightmare of a system designer for those that want to keep parts costs down. Most people would toggle an LED in a hello-world project from a MCU, using their eyes for confirmation. I'm the guy that puts a photo sensor on the LED so the program can actually confirm the LED was lit, and again, to a fault, trying to read the wavelength to confirm it was actually the color desired, and how far off it is from that mark. To feed a database for comparison analysis later via a Linux script. LOL.
I hope that last paragraph helps you guys to realize the bane of my development. I need to learn when contingency planning and programming is enough already.
Current Sensing - Best Approach Advice Needed
4 years 1 month ago #17343
I would have realized this had I been following along more closely. Sorry for my inattention!
In that case, I think the flow meter makes even more sense. If you have flow in the main line feeding the solenoids but you haven't commanded any of them open, you have a problem. Those flow meters are less than five bucks at Elecrow; I think I've seen them other places too.
I've thought about a whole house flow meter like these to tell if the water is flowing when it shouldn't be. That would take the larger size, which was like twelve bucks. Would I trust my house from flooding by a failing $12 flow meter backed up by a 30 million gallon reservoir? Maybe not... I'd want to take a close look at it.
We did have a fawcett pipe come out of a shutoff valve when nobody was home for a week. This was during some unusually heavy rain storms or someone would have noticed the water following out of the garage door. When I came home, first I though someone had left a fawcett running, until I stepped off the last step into 2" of water in the basement! Fortunately, it was only 2" deep (and it was clean water) so that most of the furniture was ok. The carpet had to go (orange shag...getting rid of it was a good thing) and some stuff on the floor was damaged but really there wasn't too much damage. Fortunately the broken pipe was downstairs.
Pressure could also be a parameter to measure. If the pump is running with no flow, you'll be at max pressure. When there's flow, the pressure will fall. Whether it's enough to be measureable depends on many parameters.
Yes sir. A flow meter or current sensor each will do what I want. Finding which is more practical is the effort I'm undertaking now. An interesting feature though with the flow meter(s) is that I can actually gauge through programming how much I am watering my tree, and if I incorporate another flow sensor, say past the TEE, I can also consider how much is being sprayed at the cats. So over the course of the holiday, I can actually see how much water each feature is drawing from the system, and use maybe a third flow meter at the length of tubing from the pump to the tee to use as my fail-safe sensor.
The only problem with all this... I might have to incorporate BOTH systems. If the hose pops off to the flow meter, the pump runs and the program does not see any flow... flood! But if I use a current sensor on the motor as my fail-safe, then I will know if the pump is running or not, regardless if the hoses are popped off or compromised. The two flow meters are still used however because it will be really cool to see how much water is being used by each feature of the system. LMAO! If I incorporate a temperature sensor AND a humidity sensor, I can chart how much water is needed against the temp and the humidity in the ambient air. Practical? Not at all! But would be cool to see how each metric effects the other.
Of course, all this would be unnecessary if the pump motor had a logic line that toggled high for on and low for off. When are these engineers going to realize us embedded designers need feedback from incorporated modules?? lol