SMS Mailbox Notifier on the Cheap




If you shop online, then you often find yourself waiting for a delivery. This requires checking the mailbox frequently which is fine if you have your mailbox in sight. But if you live on a high floor of an apartament building that has shared mailboxes downstaris, then taking the trip down and back can be daunting. Wouldn't it be great if your mailbox could let you know when new mail arrives?
Normally you would handle such a notification over wifi or radio. But if there are a few concrete floors between your apartment and the mailbox then there's no way the signal can reach you. The GSM network may be your only hope.

Step 1: Define Requirements

Let's think about requirements for our device:

    • it will be located in the mailbox so it will be powered from a battery
    • it needs to be power efficient to maximize battery life. We will achieve this by using a few tricks. First, we will power down the GSM module completely when not in use. This will prevent it from sucking power in standby mode when waiting for incoming traffic. We will also use sleep modes of the microcontroller. We won't use a Hall Effect or laser sensors which draw too much current. Instead, we will use a contact switch to detect when mail is inserted.
    • It needs to react to movement of mail. This is why we won't use a PIR sensor which detects living creatures but not moving pieces of paper.
    • it needs to be small enough to fit into the mailbox and leave some space for the mail. We'll base it on the Arduino architecture but just use the essential components that we'll need for this application.
    • it should not require modifying, drilling etc. of the mailbox which is not my property.
    • it should tell you the battery level so that you know when to recharge it.
    • it should not require re-flashing each time you want to change recipient's phone number. We'll allow for configuration mode. The device will not go to sleep when a smaill SPDT switch is flipped. We will give it the ability to receive text messages with the modified number that will then be stored in the static EEPROM memory for re-use in the upcoming cycles.
    • it should be cheap to build and operate. This means using a rechargable battery, components scavenged from other projects and the cheapest stuff available.

    Step 2: Collect Your Gear

    Before you begin make sure there is GSM coverage in your mailbox! You don't want to build this device only to find out there is no coverage. I had to change the SIM card to another carrier and was lucky it worked. Don't make the mistake of skipping this step :-) The easiest way to find out is by putting your phone inside the mailbox and calling it from another number.

    In order to build this circuit you will need the components shown in the photo.

    For the MOSFET I used IRL7833. I just had it lying around and other compatible transistors will do.

    The diode I used is IN5819, for the same reason as above. Feel free to replace with another diode that can handle the current.

    For voltage regulation I used S7V7F5 by Pololu. I love these puppies because they are really stable and flexible in terms of voltage. This particular one operates from 2.7V and up which perfectly corresponds with the minimum discharge voltage of the battery that I used (18650). The current output is not ideal (only 500mA up) compared to the max draw of the GSM module. However since the high current draw is only momentary, we will use a BFC to ensure stable operation. The BFC is essential!

    The tact switch is used to reset the microcontroller which is especially handy (required) for flashing.

    Apart from the items in the picture, you'll also need:

    • a breadboard (unless you plan to use another technique). I used one with 270 holes which was just enough.
    • assorted wires to connect everything together
    • a 18650 rechargable battery (with holder)
    • enclosure (optional)
    • activated SIM card

    In addition you'll need a USB to Serial converter to flash the chip.

    Step 3: Prepare the GSM Module

    Connect the GSM module. If you happen to have the same GSM module as the one I got, just hook up 5V TX to a RX of a USB to Serial conveter and the 5V RX to TX. Insert the SIM card (make sure to activate it first using your phone). Power it with 5V from USB using the provided socket plug. For some reason the module did not work when I tried using the onboard pin headers. Launch a serial monitor and you can start typing AT commands (AT is a good start ;-)).

    In the requirements section we talked about using el cheapo components. Sure, you could buy a GSM shield and spend 40-80 EUR. But you can also get these nice 10 USD GSM modules from China. The only problem is that they come pre-loaded with firmware which limits its use to Asia (you can tell by the 'A' in 'SIM900A'). If you're not in one of the countries the module is designated for, you'll notice that the module does not register to the network. Try AT+COPS? or AT+CPIN? to see error messages. We need to hack the module to work in our location.

    To do so you need to find out what HW revision you have by typing AT+GMR. Note this down. Then do a web search for corresponding SIM900 firmware for your region (without the A). Download the file (or the closest matching one). Download an app called "SIM900 Series Download Tools Develop 1.9". Select your port, baud rate and correct target and off you go. In some cases you'll need to power the module down and up again to begin the upload. Play with the settings if you have problems, it took me a few attempts but eventually the module reflashed and I was able to register with a European carrier. You can see the outcome of the CPIN and COPS commands in the second screenshot.

    Step 4: Connect Everything Together

    You can use any technique you want. I used a small, 270-hole breadboard which was just the right size. If you decide to design a PCB, please share it with us!

    The schematic is fairly straightforward and centered around the ATMega microcontroller. The ATMega controls power of the GSM module via the MOSFET and communicates with it using an emulated serial port.

    One feature that has not been explained so far is the battery level measurement. Since the voltage regulator provides a stable 5V reference, we can use the regular Analog In of the micro to measure the battery level. In order not to sink too much current, we use a 100K resistor inbetween. It reduces the accuracy a bit but also provides a 25% reduction in sleeping power consumption.

    The ATMega works on 16MHz and 5V. It would be possible to reduce power consumptiion further by using the internal 8MHz oscillator and, say 3V3, but since the whole circuit mostly sleeps (I only get mail a few times a week), runtime power optimization was second priority. 16MHz on the other hand ensures more reliable handling of the Serial communication by the microcontroller.

    Step 5: Program the Microcontroller

    I used the Arduino IDE. Please support this excellent project by making a small donation if you have not done so yet.

    Hook up the TX and RX of your USB to Serial converter to the hardware serial pins of the Atmega (2 and 3 respectively). Download the attached sketch. Open it in Arduino IDE. Configure your board and serial port. Replace the XXXXXXXXXXX in the code with your default phone number. Compile the sketch (do not upload). Now, this is going to be tricky if you do not have a RST on your usb to serial. Place your finger steady on the tact switch. Press upload on Arduino IDE. The milisecond you see the "uploading" status on your Arduino IDE press the tact switch to reset the microcontroller and put it into bootloader mode. If you don't succeed at once, try a few times. Fun, isn't it?

    The overall operating principle of the firmware is the following:

    • wake up by an interrupt (the mailbox is open and the contact switch pulls the pin LOW)
    • do a reset
    • configure the serial port and pins
    • obtain recipient's phone number from EEPROM
    • measure the battery level
    • power up the GSM module
    • keep prompting for the network carrier name. Once obtained, the module can send text messages
    • delete any old text messages
    • send the notification text message
    • wait for receipt confirmation on the serial port or timeout
    • check if the configuration switch is in configuration mode
    • if yes - wait for 40 seconds when the user can send a new text message containing the word "PROGRAM". If such a message arrives, store the new number in EEPROM
    • re-attach the interrupt go to sleep

    When developing this sketch I used the excellent avt/sleep library and code from here For SW resetting the microcontroller, I used the brilliant WatchDog Timer solution found here

    The file contains a lot of lines of commented code that you can just uncomment. If you prefer receiving missed calls to SMS's (can be cheaper), there's a commented function for that too. The comments in the code will help you know what does what.

    It's time to test the setup. For debugging, uncomment all the lines Serial.print (remember to connect 14 and 15 to the USB to Serial converter).

    Step 6: Put Everything in an Enclosure and Mount It

    I had an unused enclosure from a previous project. It fit almost perfectly, I just needed to adjust the capacitor a bit and make a small opening in the front panel for the contact switch wires.

    Generally, an enclosure is a good idea because it will prevent the mailman from getting a heart attack/calling the bomb squad after seeing a lot of wires and blinking lights in the mailbox.

    I installed the device in the mailbox using an electric tape (no drilling). The operation is based on the fact that in order to insert mail, the mailman needs to press a latch in, which then triggers a microcontroller interrupt via the contact switch. The latch is a European requirement for mailboxes.

    At the end, you can hardly see anything inside the mailbox and there are no visible blinking lights once the device is woken up.

    Step 7: Use It!

    If you've done everything correctly, your device should send you texts each time you get mail. In my case, the whole project cost less than EUR ~20 including the parts I already had lying around.

    The power consumption when sleeping is about 1mA. I have not mesaured the (highly variable) power consumption when the device operates, but in case you have, please share.

    Sending texts costs very little with the pre-paid service that I use. The account remains valid for 1yr after recharging and even if you get mail daily, the notifications cost less than $1/month.

    You can update the phone number by flipping the configuration switch, waking up the device by moving the mailbox latch and texting the module with "PROGRAM" from the new number as soon as it finishes sending the SMS to the old one. Make sure to flip the switch back to the operating position, otherwise it will wait for the incoming text after each cycle which is not going to be good for battery life.

    A few potential improvements:

    • this was a quick weekend project, and more stuff can be done to improve the device. If you have good ideas, do share them
    • the serial communication is sometimes not 100% reliable and seems to drop bytes (likely affected by the HW and SW serials running in parallel when debugging). Dropping baud rate to 19200 for communication between the micro and the module helped a lot. The device is fairly fail-safed with timeouts, but if you know how to improve Serial comms reliability, let me know.
    • the device takes longer to register with a network inside the metal mailbox than it does outside (duh!) so I'm thinking about adding a better antenna. I know close to nothing about the GSM technology so again, I will appreciate any suggestions.

    Finally, if you like this instructable, cast your vote in the contests!

    Digital Life 101 Challenge

    Participated in the
    Digital Life 101 Challenge

    Full Spectrum Laser Contest 2016

    Participated in the
    Full Spectrum Laser Contest 2016



      • DIY Summer Camp Contest

        DIY Summer Camp Contest
      • Growing Beyond Earth Maker Contest

        Growing Beyond Earth Maker Contest
      • Planter Challenge

        Planter Challenge

      20 Discussions


      Question 1 year ago

      Hey, Thanks for posting. I'm planning to make this, but with a reed switch and float to monitor a remote tank level, with a 18650 battery and solar panel. Also awaiting the production of a PCB for it, which I will post pictures of. Quick Question, which GSM module are you using? Again thanks

      2 answers

      Answer 5 months ago

      hi Ben I used the SIM900A module


      Question 2 months ago on Step 2

      what all component did you use in this project i want to make this project for my final year project

      1 answer

      Answer 2 months ago

      Step 2 details out all the components. Besides if you hover over the photo in that section you'll be able to see which one's which.


      Question 5 months ago

      hello, may i iknow if i change the contact switch to a sensor, will it work?

      1 answer

      Answer 5 months ago

      anything that shorts the circuit will work


      1 year ago

      May i know what type of the sensor to calculate voltage amount in that project ?

      1 reply

      Reply 1 year ago

      The Amega microcontroller has an analog input pin hat works up to 5V, so no additional sensor is required


      2 years ago

      Two questions...

      Can I use a reed switch instead of a contact switch? I am assuming it shouldn't matter as it works on the same Principle.

      Also How do I program it to send an email instead of a text message?

      1 reply

      Reply 2 years ago

      Sure, you can use any switch you want. After some trial and error I ended up replacing the sensor with a tilt senso. It works better with my box. Anything that shorts the circuit is fine.

      For an email, you need to use GPRS. I have not tried it but I found a nice tutorial you can use with this module:


      Reply 3 years ago

      So far, after about 100 sms's it went down by 0.5V. It depends very much on the number of notifications and battery quality but my rough estimate is that it should last at least 1 year before recharging.


      3 years ago

      Well explained project. End result works well. Bet you get proud everytime you get mail. :-)
      Q: don't you have a monthly fee for the GSM?

      5 replies

      Reply 3 years ago

      I was wondering the same thing. I'm going to look into using a small wifi transmitter that only transmits when the mail box is opened and is run by a primary lithium cell.


      Reply 3 years ago

      Good idea. If I had WiFi coverage in the mailbox this technology would be my first choice as well. I'd look into ESP8266 and simple HTTP requests.


      Reply 3 years ago


      Awesome project and really well explained - many thanks.

      Would you be able to help us with the ESP8266 and HTTP option ? I'm no where near as knowledgable as you and would love to build a wifi version for an old lady in a wheelchair that lives down the road.


      Reply 3 years ago

      sure, I'll do whatever I can to help.

      Send me a PM with details.



      Reply 3 years ago

      It runs on a pre-paid starter which makes the account valid for a year after each top-up. One SMS costs 4 cents and this only applies if I decide to use SMS'es and not the missed call feature to notify. So even if I get mail 5 times a week (unlikely), the cost is about 1 USD/month.