Z
@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.
1_1531328973387_mailClient.py 0_1531328973387_mailServer.py
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)