Il trasmettitore LoRa montato dentro la cassetta della posta, con i fili che salgono al reed sullo sportellino

I Put a LoRa Sensor in My Mailbox (Heltec V3, ESPHome, Home Assistant)

Key points

  • Two Heltec V3 boards: one runs on battery power in the mailbox, and the other connects to Home Assistant at home.
  • When mail arrives, the flap lifts and I get a notification on my phone.
  • The boards talk over LoRa, so there’s no need for Wi-Fi in the mailbox.
  • About €70 in parts and two 3D-printed pieces.

Why I did it

I live on the fifth floor, and my mailbox is downstairs. I got tired of opening it every time I walked past just to see if there was anything in it.

I wanted something simple: a notification on my phone when mail arrives. But there are five floors between my apartment and the mailbox, too far for Wi-Fi or Bluetooth. With LoRa, I only need two little boards to send a message that far, even through walls. LoRa also uses very little power, so the board in the mailbox can run on a battery for a long time.

1. What I bought

2. What I 3D-printed

  • The case for the board and battery: Case for Heltec V3/V4 with 3000mAh Battery by Johnneil on Printables (a remix of a model by tambaru, under a Creative Commons BY-SA license). I printed two, one for each board. The case leaves the screen, buttons, and USB port accessible.
  • The flap. My mail slot didn’t have one, so I printed it myself. In the video below, you can see the white flap lift with the magnet attached.
Kit with two LoRa V3 boards, battery, antenna and pin headers
The kit with the two boards. Seller’s picture: it shows an 800 mAh battery, the kit I bought has 3000 mAh cells.
Ten plastic reed switches with their magnets
The reed switches with their magnets (seller’s picture).
Heltec V3 transmitter in its 3D printed case with antenna and reed wires
The transmitter closed in its printed case, with the antenna and the two wires that go to the reed switch.

3. The firmware

I wrote two versions of the firmware in ESPHome with Claude’s help. The first is for the board in the mailbox: it just needs to detect incoming mail and send a message. The second is for the board at home, which receives the message and passes it to Home Assistant.

I didn’t have to install anything on my computer to flash the boards. I plugged each one in with a USB cable, opened web.esphome.io in my browser, picked the file, and clicked Install. It took me a couple of minutes per board.

4. Putting it together and testing it

I connected the reed switch with two wires: one to the 3V3 pin and the other to GPIO6. That’s all it needed.

I put the board in its case and placed it in a corner of the mailbox. Then I attached the reed switch to the wall next to the flap. When the mail lifts the flap, the magnet moves close to the switch. The board wakes up, sends the message, and goes back to sleep.

To test it, I lifted the flap with my finger. A moment later, the board at home received the message.

LoRa transmitter mounted inside the mailbox
The transmitter inside the mailbox: the two wires run up the wall to the reed switch, next to the flap.
The flap seen from inside: when it lifts, the magnet moves in front of the reed switch.

The mailbox board sleeps most of the time, which is why the battery lasts so long. It also wakes up once a day and sends its battery level so I know it’s still working. With a 3000 mAh battery, I expect it to last between 14 months and 2 years. When the battery runs out, I’ll just bring the board inside and charge it through the USB port.

5. Home Assistant

The board at home shows up in Home Assistant as a regular ESPHome device, with no special setup. From there, I set up:

  • a phone notification when mail arrives and a voice announcement in the kitchen;
  • a “Mail waiting” switch that turns on by itself and that I turn off when I collect the mail;
  • a battery level reading with an alert when it gets too low.

Here’s the notification I get on my phone:

Home Assistant notification on the phone: mail has arrived in the mailbox
The notification on my phone (in Italian: “Mail has arrived in the mailbox”).

The board at home also has a small screen that’s usually off. When I press the button, I see an envelope (closed if there’s mail, open if there isn’t), the time of the last message, the battery status, and the signal.

Receiver at home showing the status page on its OLED screen
The receiver’s status page: envelope, time of the last message, both batteries and the signal.

The project

The sensor’s been in place for a couple of weeks, and it does its job.

I put both versions of the firmware, the Home Assistant configuration, and the wiring diagram in a repository. If you’re interested in the project, send me a message through my About me page and I’ll share it with you.

Leave a Reply

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


Post Comment