Replacing Momentary Button

Some background:

I bought a small humidifier from a local drug store to use in my greenhouse. I initially wired it into my Arduino using two relays. The first relay connects the actual power to the humidifier. I did this so if the Arduino loses power for some reason, and the humidifier does not lose power, the humidifier will not burn out when it goes dry. There's no auto off function with this one, and I've programmed the Arduino to monitor total run times to stay within the bounds of not running out of water.

The second relay is used to momentarily connect two wires. I soldered on two wires from the real momentary button leads from inside the humidifier. When the humidity needs to turn on, the Arduino turns a pin high, connecting the two wires (simulating the button press), and then turns the pin low (simulating the button depress).

My problem is, the relay is getting really annoying. It kicks on once every ~3 minutes or so depending on what's going on inside/outside the greenhouse. I attempted to use a MOSFET, connecting the two momentary button leads to the drain and source, and the arduino pin to the gate, but was not successful in being able to connect the two leads together momentarily in the same fashion as the relay.

Does anyone have suggestions on alternatives, or perhaps I was not thinking of the right wiring schematic when using the MOSFET?

I also tried wiring one lead from the momentary button to 5V, then running ground thru the MOSFET, but was unsuccessful as well.

Any advice on cutting out the relay would be awesome.

Thanks,
Justin

I was able to mimic the press by placing the two leads of momentary switch to the emitter and collector of a BC547B transistor that came with a kit I bought a while back. I then put a 1k ohm resistor between an arduino pin and the base of the transistor. This solved the issue.

My question now is, when I did not have the resistor between the arduino and the base, the circuit did not work. Why is that? Meaning when I connected the arduino straight to the base via a connector wire, the circuit did not work.

Thanks
Justin

When you command the output of the Arduino HIGH, it tries to do so but it runs into a brick wall of 0.7V which is the point at which the transistor starts to conduct. You have not limited the current, and are asking the Arduino for the full 40mA out of that pin.

When you correct the circuit by putting the 1K in series, you have now limited the current to 4.3mA and the Arduino is happy.

Thank you for the explanation. As I move out of being a beginner and into a "moderately intelligent" arduino user I'm still learning some fundamentals. Appreciate the help.