D1 mini push switch

I want use 2n7000 mosfet with D1 mini for make a push switch. D1 mini 2.9v on pin D4, when push switch voltage dropes and return to 2.9v .
I want inverted like normal 0 v when push button must be 2.9v. How can i do.

switch:
  - platform: gpio
    name: "start"
    pin: D1      
output:
  - platform: gpio
    pin: D4
    id: start
button:
  - platform: output
    name: "Start"
    output: start
    duration: 500ms
    

Do you have a physical switch (e.g. push button) connected to the board?

No, i want push a physical push switch on wasing machine remotely with wemos d1 mini and mosfet 2N7000.
Circuit diagram is only for example.

Sorry, I don’t quite understand the situation. What is on pin D1 and what is on D4? Desired behaviour is to have low voltage on output pin at idle?

Simple solution would be something like

switch:
  - platform: gpio
    name: "start"
    id: switch_start
    pin: D3

button:
 - platform etc, etc,
   on_press:
     - switch.turn_on: switch_start
     - delay: 500ms
     - switch.turn_off: switch_start

Hm… i’m not sure that driving mosfet with 3.3V will open it fully… most mosfets are designed to operate at gate voltages 5V and above… you’ll need some sort of “buffer” between GPIO and gate of mosfet or use NPN transistor. But, try and see…

I’ve used Mosfets with output pins on ESP8266 to the gate. They have worked well. NTF3055L108T1G MOSFET N-CH, FQP27P06 TO-220 MOSFET P-CH, IRLML6401TRPBF P-CH are 3 I’ve used recently.

Yes, if you use logic gate mosfets they will do ok since their turn-on voltage is lower than at “normal” mosfets (typically 5V, but they do ok with 3.3, too).
Others could do ok, too, as long as current doesn’t go to high. But, for high current loads a good mosfet driver is a must since without it mosfets tend to overheat.

1 Like

D1 (GPIO 5) and D4 (GPIO 2) both are 2 different switches. On D1pin is a switch components and on D4 pin is a button component.
I will try your solution. Which platform you use with button?

Have you any circuit diagram ?

I could have a go at drawing my circuit later. Looking at your example it has an inductive load with a fly back diode. If the voltage across that load is much more than 5V I would suggest using a 5 V relay which would isolate the D1 mini from those big voltages.


I tend to use mosfets in solar powered projects no higher than 6V.

Sorry not so much a circuit schematic but more a picture I worked off to solder the parts in. Think I settled around a 3.2K resistor just before the 2 gates. Also put 10K on the green and yellow lines to pull them to ground to stop motors firing off with stray signals. I have 2 mosfet switches running side by side.

1 Like