0

Hi there I got quite a project on my end I am using a mosfet specifically IRF4905 now the I want to turn on a 12 volts LED using this

I have the following materials

12v power supply pi pico w 12v LED IRF4905 10k Resistor

Wiring is as follows enter image description here

now base on what I read and research (I don't know if I understand correctly) to turn ON the mosfet you have to supply the gate a 0v and to turn it off you have to supply 2v or higher (again I'm not sure correct me if I am wrong)

now my code looks like this

from machine import Pin
import time
# Initialize GPIO 0 as an output pin
gpio_pin = Pin(0, Pin.OUT)

Function to set the GPIO pin to high (3.3V)

def set_pin_high(): gpio_pin.high() print("GPIO pin is set to 3.3V")

Function to set the GPIO pin to low (0V)

def set_pin_low(): gpio_pin.low() print("GPIO pin is set to 0V")

while True: set_pin_high() time.sleep(1) set_pin_low() time.sleep(1)

i don't know what is wrong but when I test the negative wire and positive wire of the out to LED still having 12v on the reading

Snow Angel
  • 115
  • 1
  • 3
  • 8

1 Answers1

0

The simple answer to your question is it won't work.

To explain requires an understanding of MOSFET operation and the limitations of the Pico which can only output 0/3.3V. You need >12-2V to turn it off and <12-Vgs to turn it on.

It IS possible with additional circuitry but frankly you would be better to look for a more conventional solution.

Milliways
  • 62,573
  • 32
  • 113
  • 225