This is a personal project with the goal of opening a gate from the phone.
- MOSFET -- IRLI540NPbF
- Relay -- LMR2-3D
Most likely not needed -- MOSFET can be used instead but I like the audio feedback it gives.
Only one side is used so LMR1 is totally fine, this was just locally available.
- Microcontroller -- Pico W
- Resistors:
- 220 Ω
- 10 kΩ
- Remote that opens the gate (mine operates on a 12V battery)
I decided to use Visual Studio Code to develop this project but Thonny is a good alternative.
- install Visual Studio Code
- install reccomended extensions, can be found in .vscode\extensions.json
- the most important one is the MicroPico extension
More information can be found in paragraph 4.2 of Raspberry Pi Pico-series Python SDK
Setup MicroPython on raspberry pi Pico
- download MicroPython (version used is v1.25.0)
- the latest from https://micropython.org/download/rp2-pico-w/rp2-pico-w-latest.uf2
- or use the one I used for this project dev\RPI_PICO_W-20250415-v1.25.0.uf2
- program the Pico
- Push and hold the BOOTSEL button while connecting your Pico with a USB cable to a computer. Release the BOOTSEL button once your Pico appears as a Mass Storage Device called RPI-RP2.
- Drag and drop the MicroPython UF2 file onto the RPI-RP2 volume. Your Pico will reboot. You are now running MicroPython.
- Access the REPL via USB Serial.
More information can be found on Drag-and-Drop MicroPython -- Raspberry Pi Documentation
Get the project running on pico
- copy
env.py.example
tosrc\env.py
- on windows use
cp .\env.py.example .\src\env.py
- on windows use
- populate required fields with information
SSID
with the name of the Wi-Fi you want to connect toWLAN_PASS
with the password for that connectionSIGNAL_DURATION
with how long you want the remote to be on in milliseconds
- upload project to Pico
- open command palette (
F1
orCtrl+Shift+P
) in vscode - then
MicroPico: Upload project to Pico
- alternative is to use rshell
- open command palette (
MicroPython automatically starts main.py
on device start.
see more -- MicroPython - Reset and Boot Sequence
Picture of the circuit that is used in this project
Pinouts used in this project:
3V3(OUT)
(36) -- powering the relay MOSFET circuitGND
(38) -- final point of the relay MOSFET circuitGP15
(20) -- driving the MOSFET's gateGND
(3) -- final point of the circuit that controls the MOSFET
Pico W pinouts, source -- https://www.raspberrypi.com/documentation/microcontrollers/images/picow-pinout.svg