~ Stuff I Learned About Tech+Hydroponics

We’ve Got Mail

I’ve been delighted with the results of my We’ve Got Mail project. Now we know when mail is put into our mailbox. Our mailbox is down the road from our house. There are days when my husband goes down and checks for mail delivery several times. A little exercise is a great thing. But some days it is cold, rainy, and dark.

NOT ANY MORE – when mail comes, the super-dah-dee-duper We’ve Got Mail home device starts to sparkle…a DEFINITE YIPPEE moment…It knows when to sparkle because the Mail Box Puck – which sits inside the mailbox – sends a message to the controller when the mailbox door is opened.

This can’t be seen in the image, but the top of the device’s enclosure is printed with translucent filament. When mail comes, the neopixel FeatherWing starts lighting up in a sparkle panel. There is a button on the left side of the enclosure that turns off the sparkling.

Thanks To Those That Went Before

I am very grateful for the knowledge, excellence, and practical use of:

the RadioHead RF arduino libraries. These libraries have been the backbone of my radio projects. Well done. My only challenge is in power management with the m0 – getting to deep sleep requires waiting for an interrupt. My current challenge is the RF library takes over the interrupt I define for RF traffic. When I put the m0 in idle mode 2, I get the interrupt. When I put the m0 into deep sleep and wait for an interrupt, I don’t receive one. I should do more investigation. However, at this time I want to make progress on other project.

Adafruit products and services. THANK YOU for the spirit of “We all do better when we all do better.” (see Al Franken’s book). For the RF95 feather, neopixels, their exceptional service, exceptional support, exceptional videos. From all I can tell employees are treated well. They care about each other and us. It would be SO AMAZING if more companies shared the “We all do better when we all do better” spirit.

John Ericksen’s really nice neopixel sparkle sketch. It would take me a long, long time to figure out the graphics/math and put this together. John made this easy and shared it with us. THANK YOU.

Open Source

The Goal

The goal is to build a Mail Box puck and Controller that lets us know when mail has arrived. The Mail Box puck sits in the mail box. When the door is opened, it sends a notification to the Controller. The Controller is responsible for:

receiving the message from the Mail Box puck.

sparkling when it receives the message.

turning off sparking when a button is pushed.

The Hardware

PIR Sensor. I had one from back when I started learning about electronics + Arduino. Whoa – using it gave me a moment of reflection on how much I have learned since I started. I am incredibly grateful. I feel a sense of joy.

The first thing the loop() does is goToSleep() – i.e.: set the M0 into deep sleep mode, put the RF95 to sleep, and set the motionDetected interrupt to be called back when the GPIO pin assigned to the PIR sensor goes off. The GPIO pin will change from LOW/HIGH when the mailbox is opened. When this happens, the __WFI() happens, which plops the code into motionDetected().

The bMotionDetected is set to true.

When bMotionDetected is true and now the code is running below the interrupt in the loop(), a mail message is sent to the WeGotMail home device.

The message includes the battery level.

The Controller

There are three Feather boards inside the Controller – a Feather M0 RFM95 LoRa, a proto FeatherWing, and a neopixel FeatherWing. This image shows the neopixel Featherwing connected to the proto Featherwing.

The RF95 code was easy because I was familiar with how RadioHead’s library worked after using it for my outdoor gardening project. I LOVE evolving what I have learned.

just getting one interrupt when the button was pressed and the interrupt was set to fire on RISING (or FALLING). AKA debouncing. The debouncing links shows how to do this when the code does not use a hardware interrupt. I’m glad it did because I didn’t know how to hardware debounce. Lucky for us, Jeremy Bloom has a tutorial discussing hardware debouncing.

The pins I used include 7, 14, 2, and 1. Pin 1 is input from the button push and pin 2 is output that goes into a GPIO pin of the Feather M0.

Firmware

The Controller’s job is to hear a message from the mail box puck. When it does, it starts sparkling the neopixels. There is a button on the side of the box to turn off sparkling. When the battery level of the Mail Box Puck is <= 3.7V, the sparkling looks like red fire to symbolize the Mail Box puck’s battery needs to be recharged.

Feature requirements:

Sparkle when a “We’ve got mail” message is received from the mail box puck.

Stop sparkling when the button is pushed.

Have a robust and attractive enclosure.

Be available wherever we are within the house. In order to do this, the Controller will use a battery. The enclosure must make it easy to recharge the Controller through the USB port. The Controller should use minimum battery power.

It is my hope/expectation that the GotMail_Home_V2.ino is readable enough for anyone interested to figure out what is going on.

…Thanks for reading this far. Please find many things to smile about. I for one, am grateful.