Idea to Build: An ESP32 Letterbox Notifier That Tells Your Phone "You've Got Post" - Compoden

Idea to Build: An ESP32 Letterbox Notifier That Tells Your Phone "You've Got Post"

Here's the idea. Your letterbox is down at the gate, and you only find out a courier slip came when you walk past two days later. So let's make the letterbox tell you: something drops through the flap, your phone gets "You've got post". Collect it and it resets.

A micro limit switch with a long lever sits behind the flap, so anything pushed through nudges it. A magnetic door sensor goes on the collection door. An ESP32 watches both and sends the push over your home Wi-Fi.

How it should behave

  1. A letter pushes the lever. If it's held for more than about 50 ms (a letter, not a rattle), the ESP32 waits 2 seconds and sends "You've got post".
  2. More letters in the next 10 minutes don't send more pushes.
  3. Open the collection door and it sends "Post collected". Flap presses while that door is open are ignored, since that's just your hand.
  4. An LED blinks each time a push goes out, handy for testing.

What you need

Step 1: Wire it up

Wiring diagram: ESP32 with a micro limit switch on GPIO32, an MC-38 magnetic door sensor on GPIO33 with 10k pull-ups, and a status LED on GPIO26

Part pin ESP32 / connects to
Limit switch COM GND
Limit switch NO GPIO32, plus a 10k resistor from GPIO32 to 3V3
MC-38 sensor, one wire GND
MC-38 sensor, other wire GPIO33, plus a 10k resistor from GPIO33 to 3V3
LED long leg (+) GPIO26 through a 330 ohm resistor
LED short leg (-) GND
ESP32 micro USB 5V USB charger

A few notes so it works the first time:

  • Leave NC empty. Use COM and NO on the limit switch, so the pin reads LOW only while the lever is pressed.
  • Check your door sensor first. Put a multimeter on continuity, hold the magnet against the MC-38, and use the pair of wires that beeps. Door shut, GPIO33 reads LOW. Door open, HIGH.
  • Why the 10k resistors. The ESP32's internal pull-ups are weak (around 45k). With a metre or two of wire out to the letterbox, 10k to 3V3 stops noise from sending phantom pushes.
  • Pins that won't fight the boot. GPIO0, 2, 5, 12 and 15 decide how the ESP32 boots, and GPIO34 to 39 are input-only with no pull-ups. GPIO32, 33 and 26 avoid both, and the switches only ever see 3.3V.

Step 2: Fit the switches to the letterbox

Mount the limit switch just behind the flap, lever reaching across the slot, and bend it gently until the flap presses it near the end of its swing. It needs about 50 grams of push, so even a postcard does it.

Stick the MC-38 on the box frame and its magnet on the collection door, within about 15 mm when shut.

Keep the ESP32 in a plastic box out of the rain. The MC-38 isn't weatherproof either.

Step 3: Describe it to Soldr

This is the part where you don't write anything yourself. Describe the idea at soldr.ai, and Soldr designs the hardware from it: it picks the parts, assigns the pins, gives you the wiring and writes the firmware for your exact parts and pins. Soldr is Compoden's AI, built on a catalog, so every part in the plan is one you can order from Compoden. Here's roughly what you'd type:

An ESP32 letterbox notifier. A micro limit switch on GPIO32 is pressed when post comes through the flap, and an MC-38 magnetic door sensor on GPIO33 shows when the collection door is opened. Both use 10k pull-ups to 3V3. When the flap switch is held for more than 50 ms, wait 2 seconds, then send "You've got post" to my phone with ntfy over Wi-Fi. Send only one push per 10 minutes. When the collection door opens, send "Post collected" and ignore the flap while the door is open. Blink an LED on GPIO26 each time a push is sent.

Mention the parts you already have and Soldr builds around them. Then flash the firmware it gives you to the ESP32 over USB.

Step 4: Set up your phone and test

  • Install the ntfy app and subscribe to your topic. Pick a long, random topic name, because anyone who knows it can read it.
  • Test on the bench: press the lever, one blink, one push. Press again: no second push. Pull the magnet away: "Post collected".
  • Pushes on windy days? Ask Soldr for a longer hold time, or bend the lever so the flap must swing further.

If something's off

  • A push every few seconds, nothing in the box: GPIO33 is probably floating. Re-check the 10k pull-up and that you're using the MC-38 wire pair that closes with the magnet.
  • Nothing arrives on your phone: the gate is often at the edge of Wi-Fi range. Move the ESP32 closer to the house and run longer wires to the switches.
  • Pressing the lever does nothing: you've wired NC instead of NO. Swap that wire to the other outer terminal.

Small build, but never missing a courier slip again feels like a proper upgrade.

Back to blog

Open this project in the Soldr app → What is Soldr.ai → parts, wiring and code for what this guide builds