Driver FixRecommendedSound, Wi-Fi or graphics acting up? Check drivers firstFind missing or outdated drivers fast.Check DriversOctober DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsClean PCRecommendedOne scan can reveal what keeps slowing WindowsLook for cleanup and repair opportunities.Run Scan×
Skip to content
Bettesworth Construction
Construction Technology

How to Build a Wi‐Fi Burglar Alarm with a Raspberry Pi Pico W

A Raspberry Pi Pico W can power a capable DIY alarm prototype, but it is not a certified replacement for a professionally monitored security system.

By Bettesworth Construction Team 6 min read
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Yes—you can use a Raspberry Pi Pico W to build a basic wireless burglar-alarm prototype. It can monitor door contacts, PIR motion sensors, vibration switches and enclosure tamper switches, then trigger a local buzzer or siren and send an alert over Wi‐Fi.

This is a suitable project for a workshop, shed, garage, office or other non-critical space. It is not a drop-in replacement for a certified, professionally installed and monitored alarm system.

As an Amazon Associate I earn from qualifying purchases.

What the Pico W alarm can—and cannot—do

The Pico W is a small RP2040-based microcontroller with 26 GPIO pins, 2.4-GHz 802.11n Wi‐Fi, Bluetooth 5.2 hardware, 264 KB of SRAM, 2 MB of flash and a 21 × 51 mm form factor. Those resources are sufficient for reading several sensors and controlling local outputs. See the Pico W product brief and official product page.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

A DIY Pico system normally does not include supervised wiring, cellular backup, battery reporting, certified enclosures, professional installation, dispatch procedures or security-system approvals. Treat it as an electronics project, a local alarm, a customizable smart-home sensor or a secondary alert system—not as guaranteed protection against determined intrusion.

#1 Best Overall
Pico 2 W with Color Soldered Header Compatible with Raspberry Pi Pico 2 W
  • RPi Pico 2 W Microcontroller Board (pre-soldered header (color-coded)), Based on Official RP2350 Chip, Dual-core & Dual-architecture Design. Upgraded hardware from Pico 2 with wireless communication, onboard antenna, features 2.4GHz 802.11n WIFI and Bluetooth 5.2.
  • Adopts unique dual-core and dual-architecture design: dual-core Arm Cortex-M33 processor and dual-core Hazard3 RISC-V processor, flexible clock running up to 150 MHz.
  • Onboard Infineon CYW43439 wireless chip, supports WIFI 4 wireless and Bluetooth 5.2.
  • 520KB of SRAM, and 4MB of on-board Flash memory.
  • Castellated module allows soldering direct to carrier boards. USB 1.1 with device and host support. Low-power sleep and dormant modes. Drag-and-drop programming using mass storage over USB.

Three different types of alarm

  • Local alarm: A buzzer, siren, strobe, LED or relay activates at the property. This can continue working during an internet outage if the controller and alarm output still have power.
  • Network-connected alarm: The Pico sends MQTT messages, HTTP requests, dashboard events or push notifications. These depend on Wi‐Fi, router power, DNS, cloud services and valid credentials.
  • Professionally monitored alarm: A commercial system may add cellular backup, supervised sensors, battery monitoring, tamper detection, certified hardware and a monitoring centre. A Pico prototype should not be described as equivalent.

Recommended system design

Keep the immediate alarm path independent from the internet:

Door/window contacts ─┐
PIR motion sensor ────┤
Tamper switch ────────┤
Vibration sensor ─────┤
                      │
                 Raspberry Pi Pico W
                      │
      ┌───────────────┼────────────────┐
      │               │                │
 Local buzzer      Status LED       Wi‐Fi event
 or siren          or display       MQTT/HTTP

The Pico should trigger the local output immediately, then attempt a remote notification separately. A failed web request must never prevent the local alarm from sounding.

Useful software states are disarmed, arming delay, armed, entry delay, alarm, silenced but fault present, network unavailable, low battery or power fault and tamper detected.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Parts list

Basic prototype

  • Raspberry Pi Pico W, or Pico WH if you want presoldered headers.
  • USB cable and regulated 5-V USB power supply.
  • Breadboard or prototyping board, jumper wires and an enclosure.
  • Magnetic reed switches for doors and windows.
  • PIR motion sensor.
  • Piezo buzzer, status LEDs and suitable resistors.
  • Push button or keypad for arming and disarming.
  • Optional normally closed enclosure tamper switch.

The official and Adafruit product pages showed price signals of $6 for the Pico W and $7 for the Pico WH when the source material was retrieved. Prices, stock, tax and shipping vary by region and should be checked before purchase. The Pico 2 W is another option for a new design, but existing Pico W examples and libraries should not be assumed to work unchanged.

Driving a siren or other load

Do not connect a large siren, motor, solenoid or high-current relay directly to a Pico GPIO pin. Use an NPN transistor with a base resistor and flyback diode, a logic-level N-channel MOSFET, an appropriate optoisolated relay module or a dedicated buzzer driver. Use a separate, fused supply for a high-current alarm output where necessary, with the correct common-ground arrangement.

GPIO pins are logic outputs, not general-purpose power supplies. Never connect mains voltage directly to a GPIO pin, and do not connect a 5-V signal to a GPIO unless the device documentation confirms that it is safe.

Basic wiring

Door or window contact

A simple reed switch can be connected between a GPIO and ground, using the Pico’s internal pull-up:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Pico GPIO ───── reed switch ───── GND

Example pin assignments are not mandatory. The following uses GP15 for a door contact, GP28 for PIR output, GP16 for a buzzer and a separate GPIO for the tamper switch. Change the pins to suit your board layout, and test the actual open and closed logic rather than assuming that a particular value always means “open.”

Rank #2
SunFounder Raspberry Pi Pico W Ultimate Starter Kit with Online Tutorials, RoHS Compliant, 450+ Items, 117 Projects, MicroPython, C/C++ (Compatible with Arduino IDE)
  • IoT Starter Kit for Beginners: The SunFounder Raspberry Pi Pico W Ultimate Starter Kit offers a rich IoT learning experience for beginners aged 8+. With 450+ components, 117 projects, and expert-led video lessons, this kit makes learning microcontroller programming and IoT engaging and accessible, RoHS Compliant
  • Expert-Guided Video Lessons: This kit includes 27 video tutorials by the renowned educator, Paul McWhorter. His engaging style simplifies complex concepts, ensuring an effective learning experience in microcontroller programming
  • Wide Range of Hardware: The kit includes a diverse array of components like sensors, actuators, LEDs, LCDs, and more, enabling you to experiment and create a variety of projects with the Raspberry Pi Pico W
  • Supports Multiple Languages: The kit offers versatility with support for three programming languages - MicroPython, C/C++, and Piper Make, providing a diverse programming learning experience
  • Dedicated Support: Benefit from our ongoing assistance, including a community forum and timely technical help for a seamless learning experience
from machine import Pin
import time

door = Pin(15, Pin.IN, Pin.PULL_UP)

while True:
    print("open" if door.value() else "closed")
    time.sleep_ms(100)

Long or vibrating wires can produce several rapid transitions. A 50-ms debounce interval is a reasonable starting point, not a universal value:

from machine import Pin
import time

door = Pin(15, Pin.IN, Pin.PULL_UP)
last = door.value()
stable = last
changed_at = time.ticks_ms()

while True:
    current = door.value()
    if current != last:
        changed_at = time.ticks_ms()
        last = current
    if time.ticks_diff(time.ticks_ms(), changed_at) >= 50:
        if current != stable:
            stable = current
            print("door state changed:", stable)
    time.sleep_ms(5)

PIR motion sensor

A typical PIR module has VCC, GND and a digital signal output. Adafruit’s Pico example uses VBUS for the sensor’s 5-V supply, GND and GP28 for the data line; see its Pico alarm example. Your module may have different voltage requirements, so confirm its documentation before connecting the signal to a GPIO.

from machine import Pin
import time

pir = Pin(28, Pin.IN)

while True:
    if pir.value():
        print("motion detected")
    time.sleep_ms(100)

Many inexpensive PIR modules need a warm-up period after power-up and keep their output active for an adjustable delay. Pets, sunlight, heaters, HVAC airflow, insects and loose mounting can also cause false alarms.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Vibration and tamper sensors

Vibration or tilt switches are useful on windows, gates, cabinets and shed doors, but they often generate noisy repeated transitions. Debounce and event filtering are essential. A normally closed tamper switch should be treated as its own alarm zone so that opening the controller enclosure is recorded and can trigger an alert.

Buzzer

A small buzzer may be driven directly only when its voltage and current requirements are known to be within the GPIO’s safe limits. Otherwise use a driver circuit. For a small passive buzzer, PWM provides an illustrative pattern:

from machine import Pin, PWM
import time

buzzer = PWM(Pin(16))
buzzer.freq(2200)
buzzer.duty_u16(0)

def beep(duration_ms=250):
    buzzer.duty_u16(20000)
    time.sleep_ms(duration_ms)
    buzzer.duty_u16(0)

beep()
buzzer.deinit()

The frequency and duty cycle will not suit every buzzer or module. A full-size siren requires a properly rated driver and power supply.

Install MicroPython

  1. Download the current Pico W UF2 firmware from the MicroPython Pico W page. Check the release version immediately before installation; firmware changes over time.
  2. Hold the Pico’s BOOTSEL button while connecting it to a computer over USB.
  3. Copy the UF2 file to the mass-storage drive that appears.
  4. Allow the board to reboot.
  5. Open a MicroPython REPL with an editor such as Thonny and run a simple GPIO test.

The retrieved MicroPython page listed 1.28.0 as stable, released April 6, 2026, with preview builds also listed. That version information is time-sensitive.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Implement the alarm state machine

A single loop such as if motion: sound_buzzer() is useful for a demonstration but is not enough for a usable alarm. The controller needs explicit states and timestamps.

Rank #3
EC Buying Pi Pico W Dual-core Arm Cortex-M0+ 133MHz RPI Pico W Built-in WiFi,Supports 2.4/5 GHZ Wi-Fi 2MB BLE
  • With a large on-chip memory, symmetric dual-core processor complex, deterministic bus fabric, and rich peripheral set augmented with our unique Programmable I/O (PIO) subsystem, RP2040 provides professional users with unrivalled power and flexibility
  • RP2040 is manufactured on a modern 40nm process node, delivering high performance,low dynamic power consumption, and low leakage, with a variety of low-power modes tosupport extended-duration operation on battery power
  • Pi Pico W offers 2.4GHz 802.11 b/g/n wireless LAN support and Bluetooth5.2, with an on-board antenna, and modular compliance certification. It is able to operatein both station and access point modes. Full access to network functionality is available to both C and MicroPython developers
  • Pi Pico W pairs RP2040 with 2MB of flash memory, and a power supply chip supporting input voltages from 1.8 -5.5V. It provides 26 GPIO pins, three of which can function as analogue inputs, on 0.1"-pitch through-hole pads with castellated edges
  • A polished MicroPython port, and a UF2 bootloader inROM, it has the lowest possible barrier to entry for beginner and hobbyist users; Pi Pico W is available as an individual unit, or in 480-unit reels for automated assembly
  1. Arming: Accept an arm request and start an exit delay so occupants can leave.
  2. Armed: Monitor all enabled zones.
  3. Entry delay: A designated door contact starts a countdown. A valid disarm cancels it.
  4. Immediate zones: Motion, tamper or selected vibration zones may trigger without an entry delay.
  5. Alarm: Activate the local output, record the cause and attempt a notification.
  6. Reset: Keep the alarm latched until an explicit reset or disarm action. Record any sensor that remains faulty.

Use timestamps and a non-blocking state machine rather than long sleep() calls. Blocking code can stop the controller from reading another sensor, handling a disarm request or reconnecting to Wi‐Fi.

DISARMED = 0
ARMING = 1
ARMED = 2
ENTRY_DELAY = 3
ALARM = 4

ENTRY_DELAY_MS = 20_000
state = DISARMED

This is a starting structure rather than a complete security implementation. Add input debouncing, code handling, alarm latching, duplicate-alert control and recovery behaviour before installing it permanently.

Connect the Pico W to Wi‐Fi

The Pico W uses single-band 2.4-GHz Wi‐Fi. A 5-GHz-only network will not work. Signal range depends on the router, walls, enclosure, antenna placement and local interference, so do not promise a fixed range.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
import network
import time

SSID = "your-network-name"
PASSWORD = "your-network-password"

wlan = network.WLAN(network.STA_IF)
wlan.active(True)
wlan.connect(SSID, PASSWORD)

deadline = time.ticks_add(time.ticks_ms(), 15_000)
while not wlan.isconnected():
    if time.ticks_diff(deadline, time.ticks_ms()) <= 0:
        raise RuntimeError("Wi-Fi timeout")
    time.sleep_ms(250)

print(wlan.ifconfig())

A practical system should use connection timeouts, retry backoff, router-reboot recovery, network-loss indication and a watchdog or restart path. Do not print Wi‐Fi passwords or notification secrets to logs or commit them to publicly shared source code.

Send notifications

MQTT

MQTT is a good fit for Home Assistant or another local broker. Example topics include:

home/security/pico_w/front_door
home/security/pico_w/motion
home/security/pico_w/alarm
home/security/pico_w/availability

Use authentication, a unique client ID, retained availability state and an offline last-will message. Use TLS where practical, and do not expose an unauthenticated broker port to the public internet.

HTTPS webhook

An HTTP or webhook endpoint can be simpler for one notification destination. Use HTTPS, a secret or token, request timeouts, controlled retries and duplicate-alert protection. A request that succeeds locally is not proof that a person received or acted on the alert.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Cloud dashboard

Adafruit’s door-detector project and Pico alarm material demonstrate approachable cloud and sensor workflows. Cloud services add account, quota, internet and provider-availability dependencies, so they should supplement—not replace—the local alarm path.

Rank #4
Freenove Raspberry Pi Pico W Board Pre-Soldered Header, Dual-core Arm Cortex-M0+ Microcontroller, Development Board, Python C Java Code, Tutorial Example Projects
  • Raspberry Pi Pico W: A tiny, fast, and versatile board built using dual-core Arm Cortex-M0+ processor with wireless LAN and Bluetooth (Comes with pinout card and stickers)
  • Detailed Tutorial: Provides step-by-step guide with MicroPython, C and Processing (Java) Code (The download link can be found on the product box) (No paper tutorial)
  • Example Projects: Each project has schematics, wiring diagrams, complete code and detailed explanations (Need extra items)
  • Easy to Use: Just connect the board to your computer (installed IDE) with the USB cable to program it
  • Get Support: Our technical support team is always ready to answer your questions
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Reliability improvements

Power resilience

The Pico W product brief specifies a 1.8–5.5-V DC input range, but that does not mean every sensor or siren can share the same rail. USB power is acceptable for a prototype. A more serious installation needs a regulated supply, a suitable rechargeable battery system, low-voltage protection, supply-voltage monitoring and controlled power-failure testing.

Do not claim a battery runtime without measuring the complete build under load. The router also needs backup power if remote notifications are expected during a mains failure.

Watchdog and logging

A watchdog can recover from some software hangs, but it cannot correct faulty logic, repeated reboot loops, damaged wiring, power loss or deliberate tampering. Log arm and disarm events, sensor changes, alarm causes, reboots, Wi‐Fi status, power faults and tamper events. Because the Pico has limited onboard storage and does not run Linux, send long-term logs to another system or store them carefully.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Physical protection

Use a proper enclosure, secure cable entry, a tamper switch and separated high-current and sensor wiring. Breadboards and exposed conductors are suitable for development, not a finished security installation. For higher assurance, consider supervised end-of-line resistors, enclosed wiring, multiple sensor types and independent power monitoring.

False alarms and bypass risks

Common causes include PIR warm-up, pets, direct sunlight, HVAC airflow, reed-switch bounce, loose connections, vibration, electrical noise from a relay or siren and software that repeatedly reports the same event.

  • Debounce contacts and vibration inputs.
  • Ignore PIR events during its warm-up period.
  • Use entry and exit delays.
  • Latch and record the first alarm cause.
  • Provide a controlled test mode and physical silence control.
  • Keep siren wiring away from sensitive sensor wiring.
  • Use more than one sensor type where the risk justifies it.

A basic reed switch can be defeated by poor placement, exposed or cut wiring, removal of the controller’s power or manipulation of the magnet and switch. Supervised wiring and tamper reporting improve matters, but a DIY system still lacks the assurance of a properly designed security panel.

Security-code and network precautions

A button sequence is acceptable for a prototype but weak for serious protection. Use changeable codes, rate limiting, lockouts after repeated failures and a secure recovery procedure. Keep user and installer access separate where possible.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

WPA3 capability at the wireless-hardware level does not secure the entire system. An unauthenticated MQTT broker, reusable webhook token, hard-coded password or unsecured configuration page can still expose the alarm. Control firmware updates and isolate the device on a suitable network segment if your home-network equipment supports it.

Test the finished system

  • Open every protected door and window while armed.
  • Trigger motion during and after the entry delay.
  • Test correct and incorrect disarm codes.
  • Unplug and restore the router.
  • Remove and restore controller power.
  • Disconnect, break and restore a sensor cable.
  • Open the enclosure.
  • Trigger repeated motion and confirm duplicate alerts are controlled.
  • Test the siren driver at its intended load.
  • Confirm a reboot does not silently leave the system falsely marked as armed.
  • Verify that network loss is visible and that the local alarm still works.

Pico W versus a commercial alarm

Feature Pico W project Commercial alarm
Initial hardware cost Low Variable
Custom sensors and logic Excellent Usually limited to its ecosystem
DIY flexibility High Lower
Professional monitoring Usually absent Often available
Cellular backup Requires extra hardware Common on higher-tier systems
Battery supervision DIY Usually integrated
Certification Generally absent Depends on the product and installer
Maintenance Owner responsibility Vendor or installer support may be available
False-alarm management DIY More mature
Security assurance Design-dependent Higher when properly installed

When a Pico W is the right choice

Choose it when you want a low-cost custom project, unusual sensors, local control and the ability to maintain the wiring, firmware and power system. A Pico WH reduces soldering work. Consider a Pico 2 W for a new design if your chosen MicroPython version and libraries support it, but do not assume its newer hardware makes every alarm application better.

Choose a commercial or professionally installed system when dependable intrusion protection, insurance requirements, cellular backup, certified equipment, battery supervision, tamper reporting or emergency dispatch matters. Local licensing and regulatory requirements vary by country and jurisdiction.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Site Office

Recommended PC Tool
Recommended PC Tool
Windows Errors? Fix Them Before They SpreadFree repair scan
Crashes, No Sound, or Screen Glitches?Free driver scan

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.