Working Mailbox Sensor for Apartments/HOAs/FAR away mailboxes!

project_mailbox

(Aaron) #1

Okay guys, so this initial post is going to be rough, but I wanted to share progress that I have made on getting notifications from my mailbox, 3 blocks away. If anyone that’s good with device handlers wants to help out making the smartthings integration, that would be awesome.

So, obviously this write up is NOT for those of you within z-wave, zigbee, or wifi distance. (although my code could run on a wifi version of the kit I used)

Now, what you have all been wondering, HOW?
I am using a 3g cellular dev board, the Particle Electron with a SIM card and Free Data plan from FreedomPop. The electron publishes events to the particle cloud, and at this time, I am just using IFTTT to toggle a virtual switch in smartthings. Which then sends me notifications using the Notify Me When smart app.

-if anyone thats good with making device handlers wants to work on one to contribute, I would love to remove IFTTT from the flow.

Materials:

Okay, so you got all the equipment now? Good.
You’re going to want to go ahead and register your Electron, but choose you are using another SIM. For Freedompop, use fp.com.attz as the APN name. The SIM should be activated, but if not, just pop it into your cell phone for a few minutes.

Now that you have that set up, copy and paste this code, and flash it to your electron. (OTA is fine, you have 200 mb and this is about 14kb.)

Now for the hardware setup. Pretty easy!
Drill a hole in your box for the switch. install the switch, and solder/connect it to the WKP pin, and the 3v3 pin on the opposite side. This allows the switch to power the electron up from a low power state.
Hook up your battery, and test its working and publishing correctly to the particle web site.

Seal up your box with the screws, and put a sticker or note on the box saying what it is for the mailman.

Open up the smartthings IDE and create a virtual switch. Name it mailbox, or whatever you want.
Open up IFTTT, and reauthorize smartthings, ensuring the new switch is a controllable item.
Now we create three rules.
If Particle, MailStatus is “opened” on (Device name) Then, Smartthings, turn on switch, mailbox.
If Particle, MailStatus is “closed” on (Device name) Then, Smartthings, turn off switch, mailbox.
If Particle, MailStatus is “Left Open” Then, SMS, “Mailbox was left open”

Set up the Notify Me When smartapp to notify you when the switch is turned on.

Go ahead and test all the modes and make sure it updates to you correctly, and then install in your mailbox with velcro.

A note on battery life. I wrote this code to be incredibly power conservative, running only a max of 5 minutes if the door is left open to your mail box. It is powered on for about 30 seconds at minimum. So far, I have not had to charge the battery at all this month. The battery is rechargeable via USB. If you want it to last longer, you can add a bigger lipo cell.

Really would like someone who has experience building device handlers to hop on board here and help out with that aspect and cut out IFTTT so we can get battery stats as well. I just dont have the time to develop that right now.

Anyway, if you are still here, thanks for the read!


#2

You may want to start here. This is for an LED strip specifically but the basics should be the same.


(Aaron) #3

Good info. I’ll review it some when I get a chance. Thanks for the post!