I've been trying to power my 5v relay through a MOSFET but I can't seem to get it to work. I'm using a IRLI540N with the gate to GPIO 24 that goes high when I click the pushbutton (that much does work, I checked with some leds before) drain is to 5v and source is to one of the coils of the relay.
I tried the rest of the circuit manually switching the relay on with 5v power and it does work (the solenoid pulls, which is all I want to be able to do via code), I just really don't know how to switch it logically with this or any other sort of transistor.
Is there any way to switch it on with logic with the mosfet or through any other type of switching that doesn't involve a relay board module? (It would solve my problem, but I wasn't able to get one of those).