Close
0%
0%

Snail Mail Notifier

Low power, wireless device that informs user of regular mail.

Similar projects worth following
This project aim is to build a cheap and elegant regular mail notifier.

The idea is to build a PCB that hosts a low power wireless transceiver. The board on both sides should be the same, the only difference is in the software so that should anything happen you would only have to replace the faulty side of the system.

The other important factor is the power use, the part that detects variable changes should have a very low power consumption as it's probably powered by batteries. The receiving side could technically be powered by something else. Notification could be done via a buzzer, or by hooking it up to some Arduino connected to the Internet via an Ethernet shield and send an e-mail, or some other fancy idea...

Finally the project should be open-source and accessible to as much people as possible, this basically means that an AVR MCU has to be used as the developing tools are very affordable and the community is there to help.

I often forget to check my regular mail, so much that sometimes I miss deadlines for various things. It seems weird to still use regular mail in this day and age, but there's no going around it.

I decided I wanted to know exactly when the mail is delivered so that I could get it out of the way and not worry about it. I've been tinkering with MCUs and know my way around low level programming so I figured this shouldn't be too difficult of a task. It'll be extremely time consuming as I'm ordering parts from across the world, this means it's a long term project, but I'm dedicated to it.

I've read about some similar projects, but none of them are open-source or really purpose built with extreme efficiency in mind, I don't want to change the battery every week and I want it to look nice.

My goal is thus to build a very affordable product, open so that anybody could buy the parts, easy to install, use and be modified by like-minded engineers.

The main goal of this project is to remotely inform about the change of state of one physical variable, it doesn't necessarily have to be mail delivery, let's say a cat door opening or a reached threshold could make use of this project as well, it's all about how you interpret it.

  • 1 × 315Mhz or 433Mhz transmitter/receiver pair Depending on what's allowed
  • 2 × ATtiny85-20SU Microprocessors, Microcontrollers, DSPs / ARM, RISC-Based Microcontrollers
  • 1 × USB-A or SMD micro-USB connector For the receiver
  • 2 × 68ohm 0805 SMD resistor For USB data lines
  • 1 × 1.5Kohm 0805 SMD resistor For USB D- pull-up

View all 16 components

  • The Mighty Power Reduction Register

    Solenoid01/30/2016 at 20:31 0 comments

    The ATtiny85 is a really wonderful chip, it presents an array of features (timers, interrupts, watchdog, ADC, PWM...), but makes it challenging to use with a relatively low pin count, flash and SRAM. The fun doesn't have to end there though, once the code is running another challenge is to reduce the power the project is drawing. On the emitter I got it down to the lowest spec in the datasheet: 0.1uA, pretty good, but what about the receiver? It has to run all the time in order to catch the emitter messages...

    The ATtiny has a couple of ways to reduce its power usage: some peripherals like the ADC and timers can be disabled or turned off completely. The Power Reduction Register (PRR) allows to turn off the timers 1 and 0, Universal Serial Interface (USI) and the Analog to Digital Converter (ADC) - datasheet p.38.

    I tried to see the effects on the current when disabling the unneeded peripherals on the receiver (ADC and USI), the difference was a notable 2mA, lowest consumption achieved was 19.5mA at 5V, a full 10%! Just for kicks: this is about 850Wh per year when run constantly, at 0.2CHF/kWh it costs 0.17CHF to run the receiver for a year. Disabling the unused peripherals saves 0.017CHF per year.

    My current measurement setup involved some crude, self-made tools.

  • Show me the code!

    Solenoid01/30/2016 at 09:13 0 comments

    I tend to develop projects in parallel and some get priority over others depending on how interesting they are to me. This project was pushed back of the list for some time (I started it in the end of 2014), but I always try to publish my whole project files/sources sooner or later.

    So here it is: the GitHub repository for the Snail Mail Notifier. It contains the circuits for the emitter and receiver, in perfboard, etched and PCB formats. There's also the code for both ends and some pictures. The current documentation on Hackaday.io is sufficient for now I think.

    Fun fact: the compiled code on the receiver is just 2 bytes shy of the total available flash memory.

  • Programming the emitter

    Solenoid01/23/2016 at 10:32 0 comments

    The emitter does not need USB, actually adding USB would probably increase its power usage, so instead if using micronucleus bootloader, which adds unnecessary overhead, it will be programmed using an ISP programmer like USBasp.

    To program the emitter follow the instructions on High-Low Tech to add support for the ATtiny on Arduino IDE.

    The emitter needs the VirtualWire library. Download it from here (link in the middle of the page) and stick it in the ~/Arduino/libraries/ folder.

    The receiver uses a special version of VirtualWire library (modified to work with micronucleus) in its own library folder, this new one will be in conflict with it (since they have the same name), to solve this issue rename the downloaded folder to VirtualWire_emitter. So instead of having ~/Arduino/libraries/VirtualWire you should have ~/Arduino/libraries/VirtualWire_emitter now. You also need to do it for the VirtualWire.cpp file, VirtualWire.h file within this folder and finally in the VirtualWire.cpp file you need to change the include from VirtualWire.h to VirtualWire_emitter.h. This way there won't be any conflicts between the two libraries.

    Restart Arduino so it loads all the libraries and select the configuration to program the emitter:

    Select the ISP programmer you have at hand. Note that you cannot upload the program using the Upload button, you need to select Sketch->Upload Using Programmer.

  • Programming the receiver

    Solenoid01/20/2016 at 07:21 0 comments

    The receiver is a blatant copy of a Digispark with a format that suits this project, therefore it can be programmed the same way.

    The latest library version has a required fix for this project, but it don't seem to be working very well with Arduino IDE, so follow the official Digispark tutorial on installing the libraries via the board manager in Arduino IDE and implement the fix yourself. I used Arduino IDE 1.6.7 at the time of this writing.

    The needed fix is one line in the VirtualWire library that comes with Digispark. Find the VirtualWire.cpp file (on OSX it's located in /Users/[user]/Library/Arduino15/packages/digistump/hardware/avr/1.6.5/libraries/VirtualWire/) and on line 273 add "const" at the beginning, otherwise the compiler will bitch about it (and tell you exactly where the issue is). It should look like this:

    const uint8_t prescalers[] PROGMEM = {0, 0, 3, 6, 8, 10, 12}; /* Must be outside the function */

    Before the microcontroller can be programmed from Arduino IDE via USB it needs to be loaded with the micronucleus firmware. I installed the 1.11 version. The Digispark library comes with the micronucleus uploading tool for 1.x firmware, it does not work on 2.x ones.

    Download the Github files for micronucleus firmware and extract them wherever. Connect the ATtiny to your computer via your trusty ISP programmer (I used USBasp) and upload the firmware using the following command.

    avrdude -c usbasp -b 19200 -p t85 -U flash:w:micronucleus-1.11.hex -U lfuse:w:0xe1:m -U hfuse:w:0xdd:m -U efuse:w:0xfe:m

    Finally it seems the Digispark libraries have some authority issues on OSX, the uploading tools have a missing executable flag, so add it manually:

    chmod +x /Users/[user]/Library/Arduino15/packages/digistump/tools/micronucleus/2.0a4/launcher
    chmod +x /Users/[user]/Library/Arduino15/packages/digistump/tools/micronucleus/2.0a4/micronucleus
    Now you can upload files comfortably form Arduino IDE via USB. You need to unplug and replug the device after clicking the Upload button in Arduino IDE each time though.

    Take a moment and marvel over what has been achieved here, USB protocol if a fussy one that requires impeccable timing, now it runs on an ATtiny which, in addition, can reprogram its flash memory and execute a bunch of other things... that's some very sexy optimisation right there.

  • 3D printed something something...

    Solenoid01/27/2015 at 18:49 0 comments

    I printed an enclosure for the receiver using SketchUp, it has 4 interlocking parts and no glue is required to assemble it.

    It has a flexible part on top that allows the user to click on the button which currently serves as a reset button. When the receiver gets a transmission it stops accepting messages for 1 hour, the button resets that timeout.

    I didn't want the antenna to protrude from the enclosure so I tucked it inside. At first I only had about 2m transmission distance, I swapped the 1/4 length antenna (~17cm) for a 1/2 length (~34cm) which didn't improve the reception. The solution was to tune the small coil on the receiver, I guess by changing anything on the antenna will require some tuning, so I'd recommend anybody having transmission distance issues wit these modules to rip off the red lacquer and start turning the thingy until it works.

    Read more »

  • The life of the battery...

    Solenoid01/24/2015 at 14:48 0 comments

    Now that I have the hardware the project is fun again and it's advancing much faster than I anticipated :).

    I have tested the ATtiny85-20SU and ATtiny85V-10SU for power consumption in power-down more on the emitter, they're basically the same, so I can remove the technically more power efficient V-10SU-type from the parts list and use two 20SU-types.

    At first I wanted to use the V-10SU-type because it can still reliably work at 1.8V, but I forgot that the transmitter also needs decent voltage to be able to emit something (it's actually rated between 3 and 12V), also the 3V coin-cell battery would be pretty much deceased at 1.8V, even with some remaining voltage when the transmission would begin the voltage would probably fall to 0, so two 20SU it is.

    As written in the datasheet the ATtiny uses 0.1uA in power-down mode, that's what I measured, this is quite incredible and a 200mAh CR2032 battery would last 228 years! Now to be more realistic the transmission takes about 7mA for a fraction of a second which is not negligible, even if only about once per day and the weather conditions and battery self discharge also play a role in battery life. But my goal was 1 year of battery life and that's probably satisfied.

    I have also implemented a one-minute waiting period after the message has been sent so that multiple messages, and thus excessive power, wouldn't be used when different things are inserted in the mailbox. In Switzerland, and Europe in general, the mailboxes usually have 2 compartments: one for the letters, closed with a key, with an lid that moves inside the mailbox and another one, for small packages, with a little door that opens outside. The mailman will drop the letters in the letter compartment one by one and will this trigger the system multiple times requiring this setup.

    During this one-minute waiting period the MCU uses 4.3uA as it uses the watchdog that sleeps for 8 seconds, decrements a counter, and continues to sleep until 8s*8=64s have passed, then it disables the watchdog and returns to power-down mode (0.1uA).
    I drew a state machine of how the emitter works using Lucidchart:

    The reason to not use a reed or a light sensor is evident here: an active sensor needs power (>1mA), but why use an active sensor when a passive uses absolutely no power whatsoever? That's why a simple lever-switch is the best kind of "sensor" in this scenario.

  • Steady...

    Solenoid01/23/2015 at 16:02 0 comments

    I have tested the wireless communication and it works really well even with a discharged 3V coin cell on the emitter (~2.5V). I'm currently squeezing an enormous amount out of the ATtiny85 on the receiver side and that's exactly what I love about this project.

    The receiver board basically copies Digispark which has mainstreamed the USB connectivity with the ATtiny. USB is horrible as the protocol timings are critical and the smallest deviation will make the computer barf and ignore the device, the amount of effort Digispark has put into making the ATtiny speak USB is massive and I'm really glad I can use it.

    The MCU is a fighter: it's communicating with the computer via USB, makes a sound via the buzzer or fades the LED (depending on what's soldered), takes input from the user via the on-board button and all that while listening to the emitter and decoding the data. I'm almost using all the available flash memory right now.

    On the receiver board the receiver module is way too close to the PCB and not very well fixed so there's a chance of shorts happening when one squeezes it too hard. That wasn't a chance I was willing to take so I inserted a piece of a broken bicycle inner-tube between them, this should prevent any issues for now.

    I plan to 3D print a case by the end of the project so the inner-tube won't be necessary later-on.

    I've been having transmission reliability issues, even with additional antennae (~17mm for 433MHz): for some reason I was only able to transmit at about 2-3m before I stripped the red lacquer from the green coil and adjusted it. Now I can reliably transmit 10-20m, through walls (with less than 3V!).

    Another thing I've been busy with is how to interpret the data coming from the module to the computer. Since the easiest solution is the use the Digispark libraries and the only way to communicate with the computer, without having to make any drivers, is the declare oneself as a human interface device (HID), like a keyboard, I did just that: send keyboard commands to the computer.

    The receiver sends a user defined shortcut combination and from there the computer simply interprets that. On a Mac there's a thing called Automator (comes with the OS), one can make a service that displays a notification, then in the keyboard settings instruct the computer to call that service when the shortcut combination is entered, voilà: a desktop notification for snail mail. The Automator can also send e-mails ;).

    I won't be using my Mac as a receiver though, I have a Raspberry Pi media center running 24/7 that will handle that, but that's one possible approach.

    Next I need to check the power consumption on the emitter side, with different types of MCUs, and build the switch for detecting the mailbox lid state.

  • It's not a defect, it's a feature!

    Solenoid01/20/2015 at 19:04 0 comments

    The PCBs arrived a while ago, but I didn't have the motivation to assemble and document right away. Now that they're assembled I started screwing around and programming all sorts of useless stuff... I'm not good without a deadline.

    So far I have only tested the receiver board, without the receiver module. I routed the lines the same way as Digispark so that I wouldn't have to mess around with the Digispark libraries (that was quite annoying with my prototype boards), eventually this project should be easily reproducible so that's a plus.

    I routed the passive buzzer, 1K current limiting resistor and LED in series, thinking that by toggling the pin slowly I could make the LED blink and when toggled fast the buzzer would make some noise, unfortunately the buzzer is a piezoelectronic type which means it's effectively an open circuit... why didn't I test it before >_<?!? The good news is that by mounting the buzzer OR the LED and shorting the missing element they work separately. Not as pretty as I would've wanted, but eh...

    The receiver board works fine and looks quite good, the emitter hasn't been tested yet, but will be whenever I feel like it. On the emitter boards I soldered an ATtiny85-20SU on one and an ATtiny85V-10SU on the other to see how they perform power-wise when in power-down mode, maybe I could cut the V-10SU from the parts list and go with the 20SU-type on both sides.Since there are 2 types of footprints for the USB connector (uUSB and USB-A) I soldered one of each on the boards, the same with the buzzer/LED.

    I think I'll have way too many boards left over so if anyone's interested...

    Now I'll be slowly, on and off, working on the software side of the project for the next couple of months.

  • New PCB order

    Solenoid11/23/2014 at 23:24 0 comments

    This time I ordered 2 PCBs, I panelized the circuits since they're so small. The limit for the cheapest PCB size is 50x50mm so I crammed 3 receivers and 4 transmitters on them. From Elecrow it's still cheaper than from DirtyPCBs with shipping ($26.32 vs. $28), the actual manufacturer is probably the same anyways

  • Too cheap, denied...

    Solenoid11/21/2014 at 18:27 0 comments

    As Elecrow, and basically all other Chinese PCB manufacturers, state: only one PCB design per order. So my order was naturally refused in the end, but in rare cases it passes inspection, so I tried to be too cheap and failed.

View all 15 project logs

Enjoy this project?

Share

Discussions

deennoo33 wrote 06/16/2016 at 10:40 point

Thank for your great works and passion !

Please can you share your Eagle Project with 4 Transmitter PCB on a 5 x 5 board ?

Goal is toi use it on a soil analog soilmoisture sensor with solar batterie.

  Are you sure? yes | no

deennoo33 wrote 06/16/2016 at 20:41 point

Ok Thx i  already got it, spoking about gerber files, If you can add yours on github this will be wonderfull.

  Are you sure? yes | no

zaerty wrote 03/16/2016 at 19:28 point



hi,
really good work, I love it,
sorry, but I find files on github, but I don't know what folder send to dirtypcb. etched, pcb, or perfboard..
can you help me please.

  Are you sure? yes | no

Solenoid wrote 03/16/2016 at 21:51 point

You need the *_PCB ones. However it's not enough to just send the folder, you need to generate the Gerber files yourself. I did not include them in the GitHub since they heavily depend on your PCB house. You can do it using Eagle CAD to generate them.

  Are you sure? yes | no

dgibsongso wrote 12/02/2015 at 13:03 point

Does each transmitter have to be paired with a receiver or can you have multiple transmitters and one receiver? (and how to you code to figure out which is which when it sends a signal?)

  Are you sure? yes | no

Solenoid wrote 12/02/2015 at 13:13 point

From experience these transmitters aren't very reliable in their transmitting frequencies. The potentiometer on the receiver allows you to tune the receiving frequency, that means you'd better go with a transmitter-receiver pair. That being said it's technically possible to receive from two transmitters with these modules.

Personally I wouldn't really bother with that, you'll lose too much time and scratching your head over this. If you want a single receiver for multiple transmitters go with something that is proven to work, such as a Moteino or an ESP8266.

To distinguish between two transmitters the easy solution is to define an ID in your transmitted data packet, this way the receiver knows which module sent the data it got.

  Are you sure? yes | no

davedarko wrote 11/18/2014 at 20:17 point
I like your pcb design and the fact that you are using attinys+433mhz :) most of the time I ask people if they have tried dirtypcb.com without any experience of trying it myself, but they look unbeatable when it comes to the prices.

  Are you sure? yes | no

Solenoid wrote 11/18/2014 at 21:28 point
Thanks. For what I wanted Elecrow was cheaper at the moment (5x10cm maximum board size, shipped: $18.42 vs $25), I know of dirtypcb.com, but if I can have clean ones for less well... I will.

  Are you sure? yes | no

davedarko wrote 11/18/2014 at 21:32 point
Ah okay, i thought i've read 12usd for 1pcb.. valid argument :)

  Are you sure? yes | no

PointyOintment wrote 07/19/2014 at 21:42 point
Have you thought about metal mailboxes, and how they'd block the radio signal?

  Are you sure? yes | no

Solenoid wrote 07/20/2014 at 08:23 point
Yes, my first thought was to drill a tiny hole in the underside and let an antenna protrude. My mailbox happens to be in metal so I'll get around finding a solution for that, hopefully a more elegant one.

  Are you sure? yes | no

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates