I am trying to control a 12v solenoid from a NodeMCU. I bought the wrong MOSFET, I've got an IRF520 (the website I bought it from said the gate threshold voltage was 3.3v, so I thought it would work, but it appears to require much higher voltages than a GPIO can provide in order turn on).
I'm wondering whether I can make a voltage divider with a couple of resistors to get the gate to the required voltage. This is what I am thinking:
I'm not entirely sure how to work out the resistor values. I've read that a NodeMCU can sink 20mA. So the total resistance needs to be 600Ω in total.
The way I've calculate it, if it is 300Ω each, then the gate voltage varies between 6v and 4.35v as the GPIO goes between 3.5v and 0v.
Is this correct? Will it work?