Pull-up not working to keep pin in proper state


This photo shows the simple control for a haptic feedback buzzer. It's on pin D13, on an Adafruit Feather Sense board. In my arduino code, I set the pin as an output, and then set it HIGH, which with the MOSFET Gate, is off. It all works fine. But I have a pull-up resistor of 10K on the gate, so it's default state is off, but it doesn't seem to work. Every time I'm uploading sketches, the buzzer runs non stop. Is the pull-up K value too high? does the default state of that pin D13 already act as an output set to LOW? Ah, I just answered my own question! D13 is connected to a red LED on the feather sense, so it would be pre-set as an output, and turn off, (LOW). I guess there's no easy way to change this. It's not really bothering anything. The main bother is every time I'm looking some test sketch, it doesn't have accommodations for setting the pin as HIGH, so the buzzer runs non stop when I'm testing things/other codes.

What you have in the schematic is a "high side switch". Using a "low side switch" would be a better choice. See this link for more info and come back here with questions if you want more help. I've not checked whether there's any mistakes in your schematic.

1 Like

Pin 13 is, as you have found, a bad choice where it has an LED attached which blinks during the start up routine.
The obvious answer is to use another pin to drive the mosfet and reserve pin13 for things which are not so affected by the start up behaviour, say an indicator led etc.

Use another pin but not 1, 2, or 13.

thanks. Another pin it will be in the next version!