Snail mail detection via LoRaWAN
I finally got this going: snail mail (letters, ect) detection via LoRaWAN. We live in an apartment where our mailbox is downstairs. Thanks to 2 LoPy's and a light sensor I can now see that mail has been dropped in our box..
One LoPy is in the cigar box (with the light sensor on top), the other in my home...
@philwilkinson Thanks Phil, it was a fun project and something I wanted to try for a long time. I will share the code in a moment. The communication between the 2 LoPy's is based on the 'ping-pong' example, although some messages were added. The 'mailServer.py' is the code running in the mailbox. The 'mailClient.py' is the client running in my home. When the client starts it does a getStatus() to get the status from the server ('mail'/'no mail': it could be that mail came in when the client was not running).
Then it sends a reset command so the mailServer resets ( so I do not have to power down the server each time mail was detected)
Every minute the getStatus() is also executed. In fact getStatus() tries 3 times to get the status. If that does not succeed, I assume the battery is dead and the clients LED turns red.
It turns green when getStatus() succeeds, but there is no mail, blue when mail was detected. My next step is to connect the client to my Wifi network also (via a socket or so), allowing me to send an email when snail mail came in or the battery is dead...
To answer your questions, it uses the LoRa protocol. I estimate the distance to be 50 to 70 meters, but with a lot of concrete and a steel elevator in between. The antenna wire is now in a sleeve in the mail box door, because vandals stripped the antenna twice.
It seems to work well, especially with these settings for tx_power and sf:
lora = LoRa(mode=LoRa.LORA, frequency=863000000, tx_power=14, sf=7)
philwilkinson last edited by
Great project Richard.
Did you publish via Lora/LoRaWAN? If so, how far away was your gateway as I assume just extending the wire as an antenna would not be suitable for a long range antenna.
Also, did you just use a plain interrupt on a Pin that was pulled-up? What sensor did you use?
It would be great if you could publish your code too!
thanks for sharing this project,
@sympatron That used to be the antenna, because the mailbox is a Faraday cage, so radio waves do not pass through. Now I have the cable in the side of the door, seems to work also. BTW, I have written about the project here: https://medium.com/@zappfinger/snail-mail-detection-with-lopy-and-lora-iot-protocol-249c8fa4bac5
What is the cable you taped to the front of your mailbox for?