Good way to disable MOSFET-controlled buzzer

Hi, all,

Simple question, I think. Project is an Arduino-controlled smoker/grill controller that sounds an alarm (buzzer) for various reasons controlled by the sketch. I use a mosfet to control the buzzer and all that works fine.

Now, I want to give the user the opportunity to shut off the alarm if s/he wants. I thought to add a switch on the unit, connected as shown in the attached schema, to isolate the mosfet from the pin and let the pull-down 10k resistor pull the gate down to 0v.

I just wonder if there is anything wrong with leaving the Arduino pin hanging open like that? I know that unused pins are left hanging open by definition, but in this case, the sketch would/could be attempting to send pwm signals to this pin, which would now be open.

Thanks for your thoughts.

PS - “Why don’t you just test it?” you are asking. Well, I’d have to re-breadboard it with parts that are being installed in the actual project. So, my first test will be when I fire up the actual project.

Thanks for asking… :smiley:

No it should be okay.

It would be even better if you would swap around the resistor:
Arduino pin - switch - 10k resistor to ground - 220R resistor in series - MOSFET gate.
In your current situation, you have a voltage divider, so the voltage on the gate will be slightly lower than 5V. Not a lot, but still, it's best practice to swap them if you can.

Pieter

Pieter -

That never even occurred to me, and I see what you mean. Thank you for the tip and your quick response - that's what I'll do.

Maybe it'll be good to also try having a 'momentary' push-button switch, that the arduino is able to monitor (on one of its analog pins)..... so when the user depresses this momentary switch, the arduino can then disable the output that drives the buzzer. In this way, the user doesn't have to keep manually flipping the switch back to some default position.

04d410c2fd6aedac21e5ad286fb551febd20e9a6.png

Southpark:
Maybe it’ll be good to also try having a ‘momentary’ push-button switch, that the arduino is able to monitor (on one of its analog pins)…

Why on an Analog pin? I would think it better to use a Digital input, with an internal Pull-up. After all, a Pushbutton is a digital action.

ReverseEMF:
Why on an Analog pin? I would think it better to use a Digital input, with an internal Pull-up. After all, a Pushbutton is a digital action.

I should have written any pin that can be used with a feature that is able to detect an event.... like a change in voltage, which (when detected) runs the code to turn off the buzzer. External interrupts etc.