Time for an upgrade to my mailbox notifier. I long wanted to give it an upgrade and folks kept asking. Here are the things I wanted to change/add:
- the transistor was a rather unnecessary complication and it made assembly more difficult. The hall sensor could simply be powered from a Moteino pin
- a more weather proof enclosure would be nice
- use more velcro to keep the thing from falling off (happened a few times when the mailman was more violent with my mailbox door).
- how about battery voltage reading too!
- upgrade code to use structs since all I’m sending is a bunch of integers
- I wanted a standalone receiving unit with a LCD screen which I could operate from another 9V battery or just plug into an FTDI for quick reading. The other receiver on the RaspberryPi could still receive the same packets and still send an SMS
First, I assembled a voltage divider for a battery voltage reading circuit. I added a small cap on the lower portion to help the ADC be more stable at higher resistor values, as suggested in this Jeelabs post – it seems to be a pretty good method without getting too fancy and expensive, perfect for quick projects like this. I used 1Mohm and 470Kohm and 0.1uF in parallel with the 470K, but you could use higher resistor values to keep that parasitic drain through the divider even lower (perhaps 10M and 4.7M). The 1M is soldered to the “VIN” pin, the 470K bottom to “GND”, and the middle point to A2 for reading the battery voltage. The 1M+470K gives a ratio of 31.97%. So to calculate the actual voltage of the battery I need to know what the battery rated voltage is (ie starting point) and of course the ADC reading. The details of this calculation are in the new sketch for the standalone receiver. The sensor node just sends the ADC reading, and the receiver then decides how to interpret that based on the battery rating in the sensor.
Next up is removing all the old peripherals and rewiring everything a bit more neatly.
Previously I had the Moteino just taped to the battery. That was not ideal at all. While everything is enclosed in the mailbox and protected, it’s possible the door could be left open and exposed to the elements. So I spent some time researching a good enclosure, including ebay, amazon and other places. Have not really found something I was happy with, and everything was in the $7-$50 range, so I looked around in my junk to see if I can figure something out or make one on the fly. I found this nice pack of screws that I got from HD – my favorite hardware store – which was still pretty compact and fit everything perfect, plus it had a clear lid in case I need it and it closed the box very snugly. I could then use some velcro on the back of it to keep it tight on my mailbox door, and some clear tape to weather seal the unit. The box (full of 50 screws) is $1.94, it can’t get any better/cheaper than this. I will probably grab a bunch more for other projects when I stop by HD.
I used some white packing foam to keep stuff in place without having to hot glue everything, and I taped the hall sensor on one of the sides, which will align with the magnet that sticks on the inside of the mailbox for triggering an OPEN/CLOSE event.
I then added the velcro from HD, reprogrammed it and proceeded to install the sensor in the mailbox:
For the standalone receiver I used a Newhaven I2C LCD with backlight (ST7036i). It worked great with this library and using a custom character generator I could add custom icons for battery levels. The nice thing about this LCD is that it works on two data wires, and has a backlight, and it runs on 3.3V with the backlight being pretty low power. These would actually be nice to source for my store. The receiver code uses structs to read data from the RFM12B on the Moteino R1 which runs it. If you want to implement this, you could certainly use another regular LCD but you will need more pins in case it’s not a I2C or serial LCD, but mind the fact that I used a 3.3V LCD which could be powered directly from the Moteino’s “3.3V” regulated power pin. If you have a 5V LCD you will need a 5V power source instead.
So now whenever I want to check my mail, I just plug in another 9V battery and I wait for the next packet telling me when the mailbox was last opened and closed, and also the battery voltage. The sensor transmits every 8 seconds, and I can pick it up in my basement and pretty much anywhere in the house. I’m quite happy with this standalone unit, I will need to find a good enclosure for this also, and perhaps make a custom PCB for it to plug the LCD.
Fun fact: the remote Moteino still runs on the same 9V battery I installed in mid February (I did take it out of service for a few weeks though), and it’s at 7.9V now after a bunch of testing for this upgrade, not bad, I will try to remember to post an update here when it runs out. The cool thing about this project/LCD/enclosure is that I could use a large 2Ah lipo battery which is rechargeable. I might do that when the 9V finally dies.