Circuit for default on Buzzer Alarm / LED for error state, off for normal state

Thread Starter

e97

Joined Jun 8, 2022
4
Hello everyone,

I have a Raspberry Pi connected to a float sensor and relay. The relay turns on my sump pump when the water level increases and trips the float. I also record to micro SD when the float is triggered, and pump start and stop.

It's been working flawelessly for 3 years but recently we had some thunderstorms and power outages. My Pi SD card got a bit messed up and the system failed to boot successfully resulting in some light flooding - fortunately I caught it early enough and was able to dry everything out but still resulted in water damage to a few items.

So I'd like to have an buzzer alarm that is default on and when the Pi boots successfully, turn off the buzzer using a GPIO.

I researched depletion gate P- / N- channel mosfets, but both require negative voltage from my research - though some sites say positive on the gate for P- depletion.

Others have suggested relays, though I'd like to avoid power usage as this will be always on.

I have found this circuit: https://www.falstad.com/circuit/circuitjs.html?cct=$+1+5.0E-6+10.20027730826997+50+5.0+50 s+272+272+272+304+0+1+true r+272+160+272+240+0+10000.0 t+320+240+368+240+0+1+0.5933312765882728+0.6383911194200412+100.0 r+448+192+400+192+0+1000.0 g+368+320+368+336+0 R+208+144+176+144+0+0+40.0+12.0+0.0+0.0+0.5 w+208+144+272+144+0 w+272+144+272+160+0 w+368+192+368+224+0 w+368+256+368+320+0 w+272+240+272+272+0 w+320+240+272+240+0 w+272+304+272+320+0 w+272+320+368+320+0 c+368+144+368+192+0+2.0E-9+11.954940157168231 w+432+144+368+144+0 w+272+144+368+144+0 162+464+144+464+192+1+2.1024259+1.0+0.0+0.0 w+432+144+464+144+0 x+341+121+400+127+0+24+Piezo x+442+122+488+128+0+24+LED w+464+192+448+192+0 w+400+192+368+192+0

which seems to fit the bill - I could use a N-channel enhancement mosfet for the switch with the gate on a GPIO.

Wondering if there is a simpler solution with lower power usage?

My other alternatives are switch to an ESP8266 as its simplier and less prone to power loss corruption and also use a UPS based on an 18650 for the Pi / ESP8266 or a full on AC UPS.

In the meantime, I rebuilt my Pi and switched to overlay filesystem which is read-only but I lose the ability to log the state of the float and pump.
 

Wendy

Joined Mar 24, 2008
23,429
Because you are a new member , I had to approve this thread because of your link to somewhere else. AAC works best with local attachments. URLs to unknown territory, will bring mixed results
 

MisterBill2

Joined Jan 23, 2018
18,600
I suggest that you forget about using the micro in the control scheme. As you now know, they are able to fail and cause problems.
For the sump pump, if it did not come with an adequately rated float switch, you may need either a different float switch or an adequately rated relay to control the sump pump. Then another small relay to send a signal to your micro when the pump is switched on.
I suggest a second float switch, operated when the water level is above where the pump is switched on, to sound an alarm when the water level is above where the pump switches on but the pump has somehow failed to remove the water. That alarm should be battery powered so you can be alerted even if the mains power has failed.
Leave the micro for data logging.
 

MisterBill2

Joined Jan 23, 2018
18,600
Not clear what part of the post #6 is dated. The sump pump failures that I have seen were all due to human errors, either neglect or stupidity. That does include those caused by incorrect installation, of course. The other cause is power outages, often due to weather.
 

Thread Starter

e97

Joined Jun 8, 2022
4
Wish it was as simple as replacing the sump pump or an incorrect install. There's no sump pit, only a 4" diameter hole - so normal sump pumps wont fit / work in the situation.

The construction was done in the mid 70s and I'm told at the time the city contracted with a pump manufacturer to install the same pump for all constructions in the area (Michigan). Its a Shellback Torpedo Pump. Its prone to failure with the ballast and the contacts. Had to have it serviced multiple times in the past years and its expensive and it breaks again. I followed all the maintenance instructions - oil it, run it once every month, etc..

Feel free to search the web on all the complaints on this type of pump.

So I replaced it with a fresh water pump, level sensor and raspberry pi which has worked without issue for 3 years! Minus the power outages from thunderstorms corrupting the sd card. And the entire setup was cheaper than one service for the Shellback pump.

Simple = less likely to break.

I like the idea of removing the micro-controller but the the water level sensor needs to be de-bounced as cycling the pump rapidly will lead destroy it. Right now, the sensor is checked every 10s and if its triggered, turn on the pump for 3 minutes.

How can I do the same with a hardware circuit?

Turning on the pump I can use a N-channel enhancement mosfet (I have a few lying around) with the level sensor in series to the gate to trigger the relay and turn on the pump.

  • How do I check the level sensor every 10s?
  • How do I make sure if its triggered, it stays on for 3 minutes?

Doing research it sounds like a S-R flip flop and 555 timer? Is this the right track or is there something more KISS?
 
Last edited:

MisterBill2

Joined Jan 23, 2018
18,600
I do not recall the brand but I have pulled a skinny pump out of a pipe and taken it for repairs. I have also broken concrete and installed a sump. The fresh water pumps are quite expensive to run, and if it is an installation where the pump cycles frequently that can run a lot of money. So it might be less expensive to make a bigger hole and install a larger diameter sump and use a more standard pump that is far more reliable and lasts 12 to 15 years. And if you make the sump deeper it can have a second pump above the primary pump as backup.
 

AnalogKid

Joined Aug 1, 2013
11,056
Do the GPIO pins go up to 5 V or 3.3 V?

Also, what voltage(s) is/are available to power the buzzer?

Is the sensor a simple SPST switch that closes when the water is high, or does it have some internal electronics that produce something like an open collector switching to GND?

When things are working correctly, is it ever the case that the sensor still is tripped at the end of a 3-minute cycle? If so, what do you want to happen?

And (this hurts to say), this might be a job for a 555 <OUCH>.

ak
 
Last edited:

Thread Starter

e97

Joined Jun 8, 2022
4
Do the GPIO pins go up to 5 V or 3.3 V?

Also, what voltage(s) is/are available to power the buzzer?

Is the sensor a simple SPST switch that closes when the water is high, or does it have some internal electronics that produce something like an open collector switching to GND?

When things are working correctly, is it ever the case that the sensor still is tripped at the end of a 3-minute cycle? If so, what do you want to happen?

And (this hurts to say), this might be a job for a 555 <OUCH>.

ak
Using 5V.

It's a magnetic float sensor with reed switch. Can be closed when triggered or open when triggered by flipping the float.
Using open when low, closed when high/triggered.

Very rarely is the float sensor still triggered after the 3 min. Only happened a few times during heavy heavy rain, currently the pump runs for another 3 minutes and its cleared.

float-level-switch.jpg




I would keep the system as is if you had no problem for 3 years.
Stay with your first request and add a simple buzzer or LED indicator.

View attachment 269377
Yes, I'll keep it as is since its working. I've re-flashed the Pi, switched to overlay read-only filesystem, and added a battery backup with 18650 and charging circuit + boost converter to 5V. Had a few thunderstorms as has been OK! No multiple power outages like a few weeks ago though.

I might still switch to ESP8266 as its pretty robust again power outages and much simpler -- been testing it by pulling the power and it starts right back up with no issues!

I'll add a shorter level sensor and hook it up with a 5V buzzer & LED with the battery backup. In the diagram above, is the red diode a LED or diode?

R1 protects the GPIO from pulling to many amps, whats R2 for? Looks like a pull down? Pi has built in pull downs, ESP8266 I'm not sure.
 
Last edited:

BobaMosfet

Joined Jul 1, 2009
2,113
Hello everyone,

I have a Raspberry Pi connected to a float sensor and relay. The relay turns on my sump pump when the water level increases and trips the float. I also record to micro SD when the float is triggered, and pump start and stop.

It's been working flawelessly for 3 years but recently we had some thunderstorms and power outages. My Pi SD card got a bit messed up and the system failed to boot successfully resulting in some light flooding - fortunately I caught it early enough and was able to dry everything out but still resulted in water damage to a few items.

So I'd like to have an buzzer alarm that is default on and when the Pi boots successfully, turn off the buzzer using a GPIO.

I researched depletion gate P- / N- channel mosfets, but both require negative voltage from my research - though some sites say positive on the gate for P- depletion.

Others have suggested relays, though I'd like to avoid power usage as this will be always on.

I have found this circuit: https://www.falstad.com/circuit/circuitjs.html?cct=$+1+5.0E-6+10.20027730826997+50+5.0+50 s+272+272+272+304+0+1+true r+272+160+272+240+0+10000.0 t+320+240+368+240+0+1+0.5933312765882728+0.6383911194200412+100.0 r+448+192+400+192+0+1000.0 g+368+320+368+336+0 R+208+144+176+144+0+0+40.0+12.0+0.0+0.0+0.5 w+208+144+272+144+0 w+272+144+272+160+0 w+368+192+368+224+0 w+368+256+368+320+0 w+272+240+272+272+0 w+320+240+272+240+0 w+272+304+272+320+0 w+272+320+368+320+0 c+368+144+368+192+0+2.0E-9+11.954940157168231 w+432+144+368+144+0 w+272+144+368+144+0 162+464+144+464+192+1+2.1024259+1.0+0.0+0.0 w+432+144+464+144+0 x+341+121+400+127+0+24+Piezo x+442+122+488+128+0+24+LED w+464+192+448+192+0 w+400+192+368+192+0

which seems to fit the bill - I could use a N-channel enhancement mosfet for the switch with the gate on a GPIO.

Wondering if there is a simpler solution with lower power usage?

My other alternatives are switch to an ESP8266 as its simplier and less prone to power loss corruption and also use a UPS based on an 18650 for the Pi / ESP8266 or a full on AC UPS.

In the meantime, I rebuilt my Pi and switched to overlay filesystem which is read-only but I lose the ability to log the state of the float and pump.
You can run this piezzo off a single GPIO pin:

1655151917165.png

The line coming off the top between the voltage divider formed by R11 and R3 is the 5VDC 1mA input. 'BZ' is a 4kHz buzzer: MCKPR3-G2313-4135
 

AnalogKid

Joined Aug 1, 2013
11,056
Stay with your first request and add a simple buzzer or LED indicator.
I think your logic polarity is incorrect. If the Pi GPIO pins are open circuit of pulled low inputs when first powered up, the buzzer will be off. To correct this, add a 1-transistor inverter between GPIO and R1.

ak
 

AnalogKid

Joined Aug 1, 2013
11,056
I like the idea of removing the micro-controller but the the water level sensor needs to be de-bounced as cycling the pump rapidly will lead destroy it.
Doing research it sounds like a S-R flip flop and 555 timer? Is this the right track or is there something more KISS?
I'm going for more KISS. Couple of things -

1. You show 12 V in your schematic. does this mean that a non-uC circuit could run on 12 V only? IOW, is 12 V available?

2. You drive the pump through a relay. Relay specs?

3. Does it have to be three minutes? For example, another approach is to have the pump run for 1 minute after the float switch opens. Would something like this be acceptable, or do you want only integral multiples of 3 minutes?

The basic plan is that if a 10-second debounce timer actually times out, that means the switch was closed continuously for 10 seconds and a signal is generated. This triggers a variation of a retriggerable monostable sometimes called a pulse stretcher: the timeout period is however long the trigger signal remains true plus 1 minute after it goes false. Of course, the 10 second and 1 minute times can be adjusted.

Not counting the relay driver transistor that probably is a constant in any circuit, the timing and logic can be done with a couple of transistors. I would go with a dual comparator such as an LM393 for more crisp timing transitions. True comparators let us get more stretch out of the timing capacitors so we can reduce the cap values. 330K and 100 uF get us a 66 second period.

Another approach is to use a CD4060 oscillator/divider as the long-period timer. The timing cap could be something like 0.1 uF or even 0.01 uF. Small caps like these have a better initial value tolerance, temperature performance, etc.

ak
 
Last edited:

AnalogKid

Joined Aug 1, 2013
11,056
The whole idea is to have the Pi turn *off* the alarm when the Pi boots successfully. If it hangs up or has died (as it did once before), the alarm stays alarming. That's why the power-up / failed chip GPIO output state is important to know.
 

AnalogKid

Joined Aug 1, 2013
11,056
If the alarm stays on for some reason that would alert there is a problem.
That's the idea. But with the circuit in #9, if the GPIO pin fails low, or stays programmed low because the Pi did not boot up correctly, update the GPIO configuration register(s), and set that GPIO pin to a 1, there is no alarm.

ak
 

MisterBill2

Joined Jan 23, 2018
18,600
How about an arrangement where the float switch triggers a relay latching the pump motor on, even if the switch opens. And then the micro monitors the float switch, and after three minutes, if the float switch has been off for at least 30 secods, it unlatches the pump control relay and starts a timer that will not let it trigger for another minute. And if te float switch stays closed for over five minutes, not opening at all, an alarm is sounded.Much more towards a fail-safe scheme.
 
Top