Skip to content

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

LoRa Mailbox Sensor

Battery-powered mailbox sensor using LoRa for long-range communication. Sends notification when the mailbox lid is opened, including battery voltage for monitoring.

Features

  • Long range: LoRa communication (tested at -70 to -80 dBm indoors)
  • Long battery life: ~4-6 months on 6x 18650 cells (12000mAh)
  • Low power: ~2.6-3.4mA deep sleep current
  • Battery monitoring: Voltage reported with each message, LOW_BAT warning at 3.4V
  • Lid open warning: Alert if lid stays open for 5+ minutes
  • Home Assistant integration: Via ESPHome API

Hardware

Sender (in mailbox)

  • Heltec WiFi LoRa 32 V3 (ESP32-S3 + SX1262)
  • 6x 18650 Li-ion cells in parallel (12000mAh)
  • Reed switch or magnetic contact sensor
  • Voltage divider for battery monitoring (2x equal resistors)

Receiver (indoors)

  • Heltec WiFi LoRa 32 V3 (ESP32-S3 + SX1262)
  • USB powered (always on)

Wiring

Sender

Reed Switch:
  - One terminal → GPIO5
  - Other terminal → GND
  - (Internal pullup enabled)

Battery Voltage Divider:
  - Battery+ → 100kΩ → GPIO7 → 100kΩ → GND
  - Gives 0-2.1V for 0-4.2V battery

Battery Pack:
  - 6x 18650 in parallel → JST connector or direct to board

Receiver

Just USB power - no additional wiring needed

Installation

  1. Install ESPHome
  2. Copy lora-sender.yaml and lora-receiver.yaml to your ESPHome config folder
  3. Update secrets.yaml with your WiFi credentials and API keys
  4. Flash receiver first (needs WiFi for OTA)
  5. Flash sender via USB (no WiFi in production mode)

Message Format

Message Meaning
1|4.02 Mail received, battery at 4.02V
1|3.35|LOW_BAT Mail received, battery low (<3.4V)
W|4.02|LID_OPEN Lid open for 5+ minutes

Home Assistant Automation

The receiver fires a esphome.lora_mailbox_packet event with:

  • payload: The raw message
  • rssi: Signal strength in dBm

Example automation:

automation:
  - alias: "Mailbox notification"
    trigger:
      - platform: event
        event_type: esphome.lora_mailbox_packet
    condition:
      - condition: template
        value_template: "{{ trigger.event.data.payload.startswith('1|') }}"
    action:
      - service: notify.mobile_app
        data:
          title: "📬 You've got mail!"
          message: "Battery: {{ trigger.event.data.payload.split('|')[1] }}V"

Power Optimization Notes

Tested optimizations that did NOT help (hardware limited):

  • rtc_gpio_isolate() on unused pins
  • gpio_hold_en() and gpio_deep_sleep_hold_en()
  • Various GPIO configurations

The ~2.6-3.4mA deep sleep current is due to:

  • CP2102 USB-UART chip (always powered)
  • LDO regulator quiescent current
  • These are hardware limitations of the Heltec V3 board

Recommendation: Consider Heltec WiFi LoRa 32 V4

The Heltec V4 board is worth exploring for this type of battery-powered project. It features improved power management compared to the V3, which may significantly reduce deep sleep current. This project has not been tested on V4, but it is the recommended upgrade path if battery life is a priority.

Future Improvements (TODO)

  • Weekly heartbeat with battery status
  • DS18B20 temperature sensor
  • Solar panel charging (CN3065 + 6V panel) — goal is indefinite runtime without manual charging

License

MIT

Credits

Developed with assistance from Claude AI (Anthropic)

About

Battery-powered mailbox sensor using LoRa and ESPHome for Home Assistant

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors