Remote Alerting Mailbox

About the project

You've already waited long enough to get your snail mail. Now use Blues + Pico + Twilio, so it doesn't just sit outside your door!

Project info

Difficulty: Easy

Platforms: DFRobotRaspberry PiTwilioBlues Wireless

Estimated time: 4 hours

License: MIT license (MIT)

Items used in this project

Hardware components

Battery, 3.7 V Battery, 3.7 V x 1
DFRobot Semi Flexible Monocrystalline Solar Panel (5V 1A) DFRobot Semi Flexible Monocrystalline Solar Panel (5V 1A) x 1
Raspberry Pi Pico Raspberry Pi Pico x 1
Blues Wireless Notecarrier-AL Blues Wireless Notecarrier-AL x 1
Blues Wireless Notecard Blues Wireless Notecard x 1

Software apps and online services

Twilio SMS Messaging API Twilio SMS Messaging API
Blues Wireless Notehub.io Blues Wireless Notehub.io

Story

You've Got Mail!

It's so exciting! I have no idea why, but getting something new is definitely noteworthy. It may be a letter from your great aunt Carol, it could be those radio parts you ordered from somewhere overseas, or maybe just the latest edition of the Hometown Gazette. Who knows? Who cares?!? It's ALWAYS interesting! Heck, you've already been tracking the package from who even knows where, through all the processing plants, trains, planes and automobiles, so why not ensure you get the most important notification of all; your mailbox!

The solution seems obvious and was inspired by the mailbox flag, 📬. The mailbox already has a feature, the flag, which allows you to notify the mail carrier that you have placed mail in the mailbox to be picked up. So why not have a system in place to notify you of the same situation?

Project Overview

Considerations

Battery Power

The standard mailbox is a simple device, and requires no power to work. As a result, there is no mains power anywhere near the mailbox. This means I needed a power efficient solution that can run entirely on battery and use a solar panel to recharge.

This is where the Notecard and Notecarrier-AL really shine. First, the Notecard can idle at ~8uA and can disable/enable the host microcontroller using its configurable interrupt mechanism. Secondly, the Notecarrier-AL has a solar charging circuit and comes prepopulated with two JST connectors used to connect a battery along with a 4-7V solar panel.

Cellular Connectivity

The major hurdle in IoT-izing your mailbox, is that it's just out of reach of your home Wi-Fi router, which pushes us into the cellular realm. If we are being honest, the idea of paying a monthly cellular data charge diffuses most ideas in this category (beyond the proof-of-concept stage), because the novelty is not worth the cost. This is where the Blues Wireless cellular model has been a game changer. Now you can just buy the device and know it will work for 10 years with no monthly fee.

Event Detection

Given the power of AI and availability of myriad exotic sensors, there are so many ways to know when the mail has arrived, along with varying levels of certainty, it is truly mind-boggling. That being said, I chose to keep it simple.

The Notecard comes to the rescue, yet again. The Notecard features an onboard IMU sensor that can be set using the card.motion API to report motion events at varying levels of sensitivity.

When the mailman opens the door to the mailbox, inserts mail, then closes the door, it naturally jostles the mailbox. The jostling is captured by the Notecard's IMU sensor, which then causes the host MCU to wake up and report the event to Notehub.io.

Message Delivery

What good is it that a machine knows when I have mail, if I do not? Uhmm... None. Fortunately, there is a simple Notehub integration for Twilio.

Dead Simple Implementation

Amazingly, the Notecard/Notecarrier-AL combination is capable of doing this without even requiring an MCU! The Notecard can be configured using the Notecard Playground at the Blues Wireless Developer website. Issue the following commands and your Notecard is ready to go!

Direct your Notecard to your Notehub.io account:

{
"req": "hub.set",
"product", "com.yourcompany.you:project"
}

Optimize the battery consumption based on charge:

{
"req": "hub.set",
"vinbound", "usb:10;high:360;normal:720;low:1440;dead:0",
"voutbound", "usb:10;high:180;normal:180;low:360;dead:0"
}

// Optimize voltage variable behaviors for a LiPo battery

{
"req": "card.voltage",
"mode": "lipo"
}

// Configure IMU sensitivity (3.904G)

{
"req": "card.motion.mode",
"start": true,
"sensitivity": 2
}

// Queue a Note based on motion detection

{
"req":"card.motion.track",
"start":true,
"file":"mailbox.qo"
}

// Sync based on motion detection alert

{
"req": "card.motion.sync",
"start": true,
"minutes": 180
}

That's it folks! This will allow you to be alerted of motion events at a frequency no greater than once every 3 hours. In theory, you would get one event per day, but the throttling should insulate against a rain storm or squirrel attack.

Adding a Raspberry Pi Pico for Manual Reset

Taking another queue from the mailbox flag 📬, I decided to use a mechanical input (in this case, a button), to indicate whether or not I have addressed an alert. Just as with outbound mail, you can continue to add pieces of mail, however you would not raise additional flags to notify the mail carrier. Only after the mail carrier has picked up the mail and lowered the flag, would you again need to raise the flag to send a new alert to the mail carrier.

Originally, I had anticipated storing the button state on the Notecard with a card.attn payload coming from the Pico. However, I quickly realized this solution requires the Pico to be enabled, which completely defeats the purpose. Fortunately, I stumbled upon a soft-latching circuit from EEVblog.

EEVblog #262: https://www.youtube.com/watch?v=Foc9R0dC2iI

EEVblog #262: https://www.youtube.com/watch?v=Foc9R0dC2iI

EEVblog #262: https://www.youtube.com/watch?v=Foc9R0dC2iI

I was able to modify it for my use case, and I dubbed it the Snooze Button for Blues Wireless Notecard Alerts. The snooze circuit runs directly from the battery power, so it doesn't get disabled along with the host MCU. When active (mail delivered), the circuit will consume about 630uA, and only 3.6uA when the circuit is in stand-by mode (awaiting mail). Therefore, the snooze button makes an ideal compromise between complexity and efficiency.

With the snooze button in place, now the Pico can check to see if an alert has already been sent, or if a Note should be generated. Now, thanks to the Pico and less than 100 lines of code, I will only receive a single alert until I have had an opportunity to check my mailbox. Perfection!

It's worth noting, although the Pico is a power conscious device, the Notecard enables you to minimize the power profile of ANY host device by using the ATTN pin to disable it (to learn more about this pattern, visit the Blues Wireless Low Power Design Guide). As with this project, you can enjoythe additional computational complexity, without having to use any more battery than necessary.

Mailbox to Pocket with Twilio

The last leg of the journey is from your mailbox to your pocket.

With the work that has been done so far, the mailbox is already generating an event that is going up to the cloud, however it's not doing much else. Fortunately, Notehub is designed to be a routing hub, which connects to nearly any other web service. The work to connect Notehub to Twilio was trivial when following the Notehub integration for Twilio. The guide walks you step-by-step through the entire setup.

Now, every Note (event) sent from my mailbox will be routed as a text message to my phone.

A Quick Recap

When mail is delivered to the mailbox, then the mailbox is jostled. The jostling triggers a "motion event" on the Notecard. As a result, the Notecard wakes up the Raspberry Pi Pico. The Pico will check to see if the snooze button is active. If the snooze button is active, then the Pico will request to go back to sleep. If the snooze button is inactive, then the Pico will activate the snooze button and queue a Note to the Notecard for immediate delivery. The Notecard then sends a Note to Notehub. When the Note arrives at Notehub, it is forwarded along the predefined Twilio route. Finally, Twilio sends an SMS message alerting me I have mail in my mailbox. Huzzah!

You've got mail!

You've got mail!

You've got mail!

CAD, enclosures and custom parts

Blues Notecarrier Pico Sidecar

Use it to clip a Raspberry Pi Pico (with female headers) to any Blues Notecarrier-A series.

Code

BluesApollo

The Arduino firmware for the Raspberry Pi Pico, used to configure the Notecard to detect mailbox events.

Blues Apollo

Credits

Photo of zfields

zfields

I like to build stuff.

   

Leave your feedback...