# Mail box sensor

**URL:** <https://www.thethingsnetwork.org/forum/t/mail-box-sensor/33412>\
**Category:** Use Cases\
**Created:** [January 15, 2020, 6:19pm UTC](https://www.thethingsnetwork.org/forum/t/mail-box-sensor/33412 "2020-01-15T18:19:02Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![eivholt](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/eivholt/32/46351_2.png) [@eivholt](https://www.thethingsnetwork.org/forum/u/eivholt)\
**Post date:** [January 15, 2020, 6:19pm UTC](https://www.thethingsnetwork.org/forum/t/mail-box-sensor/33412/1 "2020-01-15T18:19:02Z")

</div>

I made a write-up of my 2 year in-the-making [mail box notification](https://www.element14.com/community/community/project14/rf/blog/2020/01/14/got-mail-lorawan-mail-box-sensor) project. Maybe someone will find it useful.

Have you made something similar?  
 ![20180913_114308](https://www.thethingsnetwork.org/forum/uploads/default/original/3X/0/5/05cfa6c2f0d4de28d56e6fccba26a8f1b483142a.jpeg)  
 ![20180824_234241](https://www.thethingsnetwork.org/forum/uploads/default/original/3X/2/4/244f4cb3ae2875d4f0fdf2b8ce7a0dc6e38b7c07.jpeg)  
 ![Otii improved](https://www.thethingsnetwork.org/forum/uploads/default/original/3X/2/1/216a6f6c09137e077302fdf8692052ce1f86c2f7.png)

---

<div class="post-metadata">

**Author:** ![gms](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/gms/32/35697_2.png) [@gms](https://www.thethingsnetwork.org/forum/u/gms)\
**Post date:** [December 18, 2021, 6:06pm UTC](https://www.thethingsnetwork.org/forum/t/mail-box-sensor/33412/2 "2021-12-18T18:06:46Z")

</div>

FWIW, the german computer magazine c’t published an article about a similar project in 2019:

> **[Brief-Fernmelder](https://www.heise.de/select/ct/2019/11/1558697595025607)**
>
> Ein vernetzter Füllstandsmelder für den Briefkasten ist praktisch, vor allem dann, wenn der Kasten weit entfernt von der eigenen Wohnung hängt. Oft ist er damit aber außer WLAN-Reichweite. Eine gute Gelegenheit, das IoT-Netz LoRaWAN in der Praxis zu...

The author uses a [Broadcom HSDL 9100 infrared proximity sensor](https://www.broadcom.com/products/optical-sensors/proximity-sensors/hsdl-9100-021) instead of a micro-switch and an ATtiny84 instead of a ATMega328p.

I don’t have experience with that particular sensor, but it feels like it’s challenging to use it to detect new mail. And it probably increases power usage significantly in contrast to a micro switch/reed-contact connected to an interrupt. The author argues that a switch just detects open-events and thus might yield false-positives in case someone opened the box without depositing a letter. On the other hand, I could imagine that small letters and post-cards don’t easily register with the infrared sensor, either, thus, yielding false-negatives.

---

<div class="post-metadata">

**Author:** ![eivholt](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/eivholt/32/46351_2.png) [@eivholt](https://www.thethingsnetwork.org/forum/u/eivholt)\
**Post date:** [December 18, 2021, 7:51pm UTC](https://www.thethingsnetwork.org/forum/t/mail-box-sensor/33412/3 "2021-12-18T19:51:41Z")

</div>

Thanks for sharing! I love the bare-bones approach regarding the selection of components. I don’t have a subscription so I haven’t been able to read the details, but it seems like a good solution. Just being able to support a full LoRaWAN stack driven by coin cell is an amazing accomplishment, I have yet to make this work. I wonder what sort of current this solution draws at the different modes? My sensor has run on the same 2xAA batteries for almost 4 years.

---

<div class="post-metadata">

**Author:** ![cslorabox](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/cslorabox/32/35697_2.png) [@cslorabox](https://www.thethingsnetwork.org/forum/u/cslorabox)\
**Post date:** [December 18, 2021, 8:11pm UTC](https://www.thethingsnetwork.org/forum/t/mail-box-sensor/33412/4 "2021-12-18T20:11:09Z")

</div>

> [@gms](#):
>
> ATtiny84 instead of a ATMega328p.

That suggests that they’re using a custom LoRa scheme and not LoRaWAN, or at least are failing to _fully_ implement LoRaWAN (including reception and support of MAC configuration downlinks) in the way a TTN node _must_.

> [@](#):
>
> I don’t have experience with that particular sensor, but it feels like it’s challenging to use it to detect new mail. And it probably increases power usage significantly in contrast to a micro switch/reed-contact connected to an interrupt. The author argues that a switch just detects that open-events and thus might yield false-positives in case someone opened the box without depositing a letter. On the other hand, I could imagine that small letters and post-cards don’t easily register with the infrared sensor, either, thus, yielding false-negatives.

Power could probably be managed by only pulsing the sensor briefly at long intervals. Personally I’d consider monitoring both that the door has been opened since yesterday, and any hints of contents. Some kind of IR-transparent triangular “shelf” inside might help orient things in a way that could be more easily optically detected, but at some point one probably runs into postal regulations.

Could also have some IR (or even visible?) reflectance sensors scattered around at and pulse them in different combinations.

Ideally what would be seen would be a sequence of door opening, then closing with the internal reflection measurements now being different than they were before it opened.

I feel like a notification that **“mailbox door cycled, reflectance change suggests 79% probability of mail in box”** is something I could work with especially compared to what else I was doing with my time and how urgently I was awaiting a particular piece of mail.

---

<div class="post-metadata">

**Author:** ![gms](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/gms/32/35697_2.png) [@gms](https://www.thethingsnetwork.org/forum/u/gms)\
**Post date:** [December 18, 2021, 8:40pm UTC](https://www.thethingsnetwork.org/forum/t/mail-box-sensor/33412/5 "2021-12-18T20:40:21Z")

</div>

> [@eivholt](#):
>
> I wonder what sort of current this solution draws at the different modes?

Unlike your project page, the c’t article doesn’t include detailed power measurement results. The author basically just reports that he didn’t need to change the CR2032 battery during his 6 week long test period, while using a 5 minute check interval.

> [@cslorabox](#):
>
> That suggests that they’re using a custom LoRa scheme and not LoRaWAN, or at least are failing to _fully_ implement LoRaWAN (including reception and support of MAC configuration downlinks) in the way a TTN node _must_.

FWIW, the c’t project uses a RFM95W LoRa module and the article describes how to register the device with TTN (using ABP instead of OTAA). The author’s github repository gives some hints on the used LoRaWAN stack and RFM95W library: [radio-mailbox/03\_lora\_test/lib at master · jamct/radio-mailbox · GitHub](https://github.com/jamct/radio-mailbox/tree/master/03_lora_test/lib)

There are also some schematics: [radio-mailbox/00\_circuit diagram/briefkastensensor.sch at master · jamct/radio-mailbox · GitHub](https://github.com/jamct/radio-mailbox/blob/master/00_circuit%20diagram/briefkastensensor.sch)

So I don’t know if a full LoRaWAN implementation is possible when using such a RFM95W module.

---

<div class="post-metadata">

**Author:** ![cslorabox](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/cslorabox/32/35697_2.png) [@cslorabox](https://www.thethingsnetwork.org/forum/u/cslorabox)\
**Post date:** [December 18, 2021, 9:15pm UTC](https://www.thethingsnetwork.org/forum/t/mail-box-sensor/33412/6 "2021-12-18T21:15:25Z")

</div>

> [@gms](#):
>
> So I don’t know if a full LoRaWAN implementation is possible when using such a RFM95W module.

It’s an issue of software (and MCU memory resources to support it) not of the radio hardware, which would be fine for LoRaWAN if driven by a complete LoRaWAN software stack.

The link you shared makes it clear their software is drastically short of correctly implementing LoRaWAN. That software **must not be used to attempt to interact with TTN** as doing so will cause problems by wasting network bandwidth on repeatedly ignored configuration downlinks - jamming things up as much if not more so for other users as for the person actually trying to get their incomplete system reporting data.

---

<div class="post-metadata">

**Author:** ![descartes](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/descartes/32/47220_2.png) [@descartes](https://www.thethingsnetwork.org/forum/u/descartes)\
**Post date:** [December 18, 2021, 10:21pm UTC](https://www.thethingsnetwork.org/forum/t/mail-box-sensor/33412/7 "2021-12-18T22:21:07Z")

</div>

> [@gms](#):
>
> while using a 5 minute check interval.

Have lid, only wake on microswitch interrupt, battery life \> 10 years.

---

<div class="post-metadata">

**Author:** ![cslorabox](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/cslorabox/32/35697_2.png) [@cslorabox](https://www.thethingsnetwork.org/forum/u/cslorabox)\
**Post date:** [December 19, 2021, 12:00am UTC](https://www.thethingsnetwork.org/forum/t/mail-box-sensor/33412/8 "2021-12-19T00:00:29Z")

</div>

Waking a bit after the switch to try the optics would be good if you can do a meaningful optical test in isolation.

If the optical test needs to be more of comparing the before vs. after internal reflection then you need a “before” which implies either some kind of letter-carrier proximity detection (“about to open the door”) or long period polling.

---

<div class="post-metadata">

**Author:** ![descartes](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/descartes/32/47220_2.png) [@descartes](https://www.thethingsnetwork.org/forum/u/descartes)\
**Post date:** [December 19, 2021, 12:16am UTC](https://www.thethingsnetwork.org/forum/t/mail-box-sensor/33412/9 "2021-12-19T00:16:38Z")

</div>

> [@cslorabox](#):
>
> letter-carrier proximity detection (“about to open the door”) or long period polling.

For an enclosed space with a decent lid there should be a base line value that can be established at startup and maybe periodically updated.

But with a switch on the lid and some other sensor, there should be plenty of time to read the level as the lid is being opened and then after to compare.

Alternatively, unless you have a clutch of naughty children in the area, you could just see how many false positives you get from lid openings but nothing being left.

---

<div class="post-metadata">

**Author:** ![cslorabox](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/cslorabox/32/35697_2.png) [@cslorabox](https://www.thethingsnetwork.org/forum/u/cslorabox)\
**Post date:** [December 19, 2021, 12:54am UTC](https://www.thethingsnetwork.org/forum/t/mail-box-sensor/33412/10 "2021-12-19T00:54:24Z")

</div>

> [@descartes](#):
>
> unless you have a clutch of naughty children in the area

just imagine what would happen if someone stuffed a blinky bike light in there

---

<div class="post-metadata">

**Author:** ![Archer](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/archer/32/45881_2.png) [@Archer](https://www.thethingsnetwork.org/forum/u/Archer)\
**Post date:** [December 19, 2021, 8:19am UTC](https://www.thethingsnetwork.org/forum/t/mail-box-sensor/33412/11 "2021-12-19T08:19:27Z")

</div>

Attention, the project from Heise is a little buggy… 😉  
It has any bugs that must be cleared before it will work.  
And with the ATTiny84 you will have not enough memory and power to implement an LMIC. They use ABP.

---

<div class="post-metadata">

**Author:** ![cslorabox](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/cslorabox/32/35697_2.png) [@cslorabox](https://www.thethingsnetwork.org/forum/u/cslorabox)\
**Post date:** [December 20, 2021, 2:46am UTC](https://www.thethingsnetwork.org/forum/t/mail-box-sensor/33412/12 "2021-12-20T02:46:51Z")

</div>

> [@Archer](#):
>
> And with the ATTiny84 you will have not enough memory and power to implement an LMIC. They use ABP.

They don’t even use ABP correctly.

They lazily implement just a tiny fraction of LoRaWAN. Doing that on TTN is prohibited, nodes must _completely_ implement LoRaWAN, regardless if they chose a complete implementation of ABP, or preferably a complete implementation of OTAA.
