Mailbox and Garage Door Notifier

1,258

27

8

Posted in TechnologyArduino

Introduction: Mailbox and Garage Door Notifier

This Instructables is based on Johan Moberg Mailbox Notifier. Comparing to this project, I did some changes:

    1. Far away from my house is not only mailbox, but garage as well. They are in one location close to road and house is located about 50m inside land. Due to very sensitive remote garage controller, it has happened a few times, garage door were open accidentally. Now I would like to know exactly, if door on garage is closed or not. Therefore I extend original project for one more contact, the garage door contact.
    2. MCU (Microprocessor Control Unit) in sender remain Attiny-85, which is important for low power consumption. There is not enough digital pins (I do not like use Reset pin) and I solve a problem by simple hardware solution.
    3. Receivers indication is done by optical and acoustic signals. Optical signals are made by leds and for acoustical one, there is added circuit producing song. MCU (Microprocessor Control Unit) in sender is changed and it is Arduino Nano. Originally I would like to use Attiny-85, but lack of one more free pin was big obstacle. There is not any simple hardware solution.
    4. Small changes were done in Arduino software, to maintain above hardware modification.
    5. Wireless half duplex communication is working well if both units (sender and receiver) are working . But, if one of both units fails (like low battery and so on), other unit continue running and pretend communication (receiver). In such a case, communication is interrupted even if error is fixed on any site. Solution: a new communication should be created. For this reason there is added reset circuit in the sender, with indicator.

    Description

    The project consist of two parts: sender and receiver. Sender located at garage site detects signals from mailbox contact and garage door open contact. If there is one of these contacts activated, transmitter HC12 send wireless signal to receiver. On receiver is indicated "alarm" state, like "mail arrived" or "garage door open" by blinking the corresponding led and played song. By reset push button on receiver unit, could be the indication cancelled and starts a new state of waiting for alarm.

    Maximal distance

    HC-12 communication module is dedicated for distance to 1.8km. But this value is theoretical and could be reached in open air. Inside building maximum range is shorter. I had a trouble to reach distance about 100m with simple string antenna. In this case were both units set to maximum range - FU4 mode and 1200 baud rate. One unit was inside building, behind 4 thick walls. With SMA antenna connection was established, but not stable. In this case the problem was solved by placing receiver unit to room oriented to site of garage (just one wall).

    According my experiences. I recommend to use SMA antennas with proper extension cord. This cable should match to connectors on both sides (antenna SMA connector and HC-12 Ipex connector).

    Step 1: Parts and Tools

    There are following parts used:

    Links are provided for less common parts.

    Sender:

    • Attiny-85, ebay
    • HC-12, ebay
    • Resistors 68, 150, 1k, 10k
    • Diode Schottky SR240, ebay
    • Diode universal , 1N589 or 1N4148
    • Terminal block, banggood
    • SMA Antenna, ebay
    • Capacitors 1000M
    • Transistor NPN, S9013, 2N2222 or similar one
    • Battery AA holder (3 pieces) and batteries
    • Switch Micro C + NO + NC for Reset
    • Led 5mm blue
    • Reed contacts for mail and garage door switches, banggood
    • Magnets, banggood
    • Prototype PCB, banggood
    • Connectors XH, banggood

    Receiver:

      • Arduino-nano, banggood
      • HC-12, ebay
      • Voltage stabilizer 7805T
      • Melody IC UM66
      • Transistor NPN, S9013, 2N2222 or similar one
      • Resistors 2x470, 10k
      • Trim Pot 10k
      • Small speaker
      • Switch Reset, banggood
      • Led 10mm, green and yellow
      • Diode universal , 1N589 or 1N4148
      • Capacitor 2x10M, 1000M
      • Main adapter 220V AC to 5V DC
      • SMA Antenna
      • Jack connector for main adapter, banggood
      • Led 10mm, 2pcs green and yellow
      • Connectors XH, banggood

      Tools:

      • Arduino-uno Rev3 board for setting HC-12 and programming Attiny-85
      • Soldering iron
      • Multimeter
      • Breadboard

      Step 2: Sender

      Scheme of sender is on picture above.

      Batteries are three pieces of AA type. Their peak consumption is during the first communication started, (about 100mA). Try to make this time as shorter as possible. During waiting time consumption is very low (less than 1ma), and during alarm, consumption is about 40mA for short time. D1 protect circuits from over voltage, if batteries are new.

      SW3, R1, C1 creates reset circuit. Indication of state after reset, is blue led D4. This led must light after reset and indicate: "sender is ready to establish connection". If the blue led is on, communication could be started by pressing Reset button on receiver.

      D2 and D3 are Schottky diodes with low forward voltage. Due this diodes, switch "garage door open" is using the same software interrupt, as the switch "mail arrived". If SW1 (mail) is connected to ground, interrupt and alarm for mail is activated. If SW2 (garage) is connected to ground, interrupt for mail is activated together with alarm for garage. This way was solved one missing pin on MCU.

      Suitable alarm indication is done by software. This hardware solution allow to use just one simple interrupt.

      Description of Attiny-85 and HC-12 is very well done inside mentioned Johan Moberg Instructables.

      Step 3: Receiver

      Receiver is powered from main power by adapter 220V AC to 5V DC. It could be any small adapter with DC output current about 0.3A. Because adapter output voltage depends on the output current, (there was voltage about 8V with low current), I have added simple voltage stabilizer IC1. Diode D1 decrease voltage for HC-12.

      Arduino Nano output D7 connect voltage about 4V to IC2 melody generator during alarm state. T1 amplify signal to speaker. Volume could be adjusted by variable resistor R4. I recommand to leave some hole in receiver cover to access this resistor. D5 and D6 are outputs for alarm leds. D3 , D4 pins are connected to HC-12 and provide serial communication. D2 pin is input and sense state of "Reset" switch.

      Reset switch is used for two function:

      1. Activate the first connection. After pressing it, communication should start.
      2. After connection is established and alarm occurs, Reset button can reset alarm and change receiver state for "waiting".

      LED indication is following:

      1. Both leds are On and lighting permanently. This is initial state after receiver is powered On. If sender is ready - blue led on sender is On, connection could be established by Reset push button on Receiver.
      2. After connection is established both leds are blinking alternately in period about 2 seconds.
      3. In case of alarm, corresponding led is blinking in period about 1 second, the other led is dark.

      Step 4: Software

      Arduino ino files with complete software are included in this step.

      Software for sender should be loaded to MCU Attiny-85. For programming Attiny use Arduino Uno and Arduino IDE software on PC. There are many tutorials how to do it, on internet. I recommend this one Attiny85 Programming . After loading program to Attiny, insert chip to socket on Sender circuit board.

      Programming Arduino Nano is the same as programming Arduino Uno. Use USB cable and Arduino IDE with selected Nano board in "Tools" and "Board manager". This process could be done with board inserted to bread board. After programming place Nano board to socket on Receiver PCB.

      Both units HC-12 should be set to same parameters with Arduino Uno. Instructions are in original Instructables.

      Step 5: Hardware and Setting

      The most critical parts are contacts for mail and garage door. This contacts are placed inside mail box and at garage door mechanical track, in place which door reach, during closing. Mail box contact consist of reed switch and neodymium magnet. Reed switch is mounted by adhesive tape, inside the box on one side of hole for inserting letters. Magnet is attached to mail flap such a way, that partly open flap, activate the switch. Wires are connected to a small XH connector.

      The same contact solution is used for garage door. In this case, contact could be created by limit switch as well. It is up to you, which variant would be chosen. But there is some more possibilities: Same garage systems may have terminal block with limit switch contacts, inside garage control box. In this case, just connect wires to competent screws.

      Sender

      Parts are placed on prototype PCB, which is cut to smaller size. On the board, there are placed sockets for HC-12 module and for Attiny-85, connectors for battery, and terminal blocks for both alarm contacts. Outside of board is placed Reset switch, blue led and SMA antenna. All other components are on the PCB soldered and connected by wires at bottom part of the board. Battery holder and PCB are mounted inside plastic box. It could be any plastic box with proper dimensions, I use damp-proof junction box. Box is mounted under garage roof and wires are led through plastic tubing.

      On the photo of sender box there are some parts, which are not subjects of this article. I added some more electronics inside box.

      Receiver

      Components of the receiver could be placed in any universal box. I have used plastic box from old wireless door bell. Parts are soldered on prototype PCB again, including both led diodes. There are sockets for MCU and HC-12 module, and male connectors soldered on the board for speaker, Reset button and power voltage. In the front cover are made holes for leds, in upper part for Reset button and antenna.

      Setting

      As author of original project has written, there are many and many reasons, which can prevent to successful communication between sender and receiver. First of all, double check wire connection and soldering. If everything is OK, try to establish communication with both units placed on table, side by side. If there are problems, check HC-12 modules in simple circuit with arduino, on two breadboards. Use instructions according very good article about module: Long range Communication There is simple software HC-12 messenger. Load the same software to both arduino and check communication. If OK, both modules are good.

      As next step, try to extend arduino uno with HC-12 on breadboard, to all components for sender and receiver, and programme both arduinos. In this case, check arduino uno pins comparing to Attiny-85 and Nano in ino files and change pin numbers, if necessary. For this reason, I have added inside ino files corresponding arduino pins in remarks lines. If problem persist, try to find error in programming, using hardware serial. This way, you can input to some critical points of program, check messages, and see them in serial monitor. You can see, which parts of program are completed and which is not. Simulate switches for mail and garage by touching wires. After problem solving replace back boards with MCUs (Attiny and Nano).

      The first communication between units should be done on table. If everything is OK, mount units on place and check again.

      Thanks for reading and good luck.

      Share

        Recommendations

        • Science of Cooking

          Science of Cooking
        • Pocket-Sized Contest

          Pocket-Sized Contest
        • Spotless Contest

          Spotless Contest
        user

        We have a be nice policy.
        Please be positive and constructive.

        Tips

        Questions

        8 Comments

        Your approach wastes significant battery power. Look at this paper by removing the space before utilize:

        http://circuitcellar.com/cc-blog/ utilize-simple-radios-with-simple-computers/

        My approach idles below 1 micro-ampere and draws much less current when operating. Batteries last for years.

        2 replies

        I agree, your solution can save battery life. It is very good idea to use transmitter and receiver at 315MHz. But there is disadvantage in larger antennas and still distance range could not be very far.

        Thanks for alternatives.

        Exactly right. Higher power consumption gives longer range, and shorter wavelength allows the use of small high gain antennas for still more range. Regards, Sam

        This is really well done. I hadn't heard of the HC-12 module until now.

        I wish I would have known about the HC-12 earlier before I made my own mailbox notifier using two ESP-01 modules. One was flashed with a firmware to make it a WiFi range extender for the mailbox sensor, and the other as a mailbox sensor with code that connected to the extender, sent a alert message to my phone via Blynk, then went into deep sleep mode until power was disrupted. I used a simple normally closed metal ball bump switch mounted to my wobbly mailbox as the sensor to reset the device, and I pried off the built-in LEDs to save power.

        Your design sounds more reliable with better range.

        The code for both are on our website www.makersa.ga if you are curious.

        Thanks!

        2 replies

        To use WiFi is very good idea. But there is a problem with accessible range. Extender is the best solution, but making project more complex. Very good inspiration is ball bump switch. If you can send exact type of switch, it can help. Switch is weakest point in my project. It is reliable but difficult to adjust. Another problem is: can ball bump switch detect very light weight letter?

        Anyway, I am curious to programming code for your solution, and thanks for inspiration.

        The metal ball bump switch is the same thing as a metal ball tilt switch, except is it configured differently.

        In my device, the slamming of the mailbox door very briefly disrupts power flowing from the battery to the WiFi microcontroller. Is normally is closed and conducts. It is reliable to detect the slamming shut of the mailbox door only if your microcontroller is very sensitive to power disruptions. So if the slamming shut does not cause power disruption for long enough, it will not reboot the microcontroller.

        It cannot detect the addition of a single letter's weight, but if your mailbox has a door and your mail carrier likes to slam it shut, it might work for you. You can get metal ball tilt/bump switches on eBay 10 switches for $1 USD free shipping.

        If you attached the switch to the mailbox door, that would work quit well.

        Ideally, you could use a spring bump sensor.

        Hope this answers your question. :)

        Just wondering if you receive a garage door open signal, do you have a remote close option to close it from the house? That would be nice so you don't have to go out and manually do that. Interesting project.

        1 reply

        Yes, I can receive garage door open signal.

        I do not have a special remote close option. But I have the usual remote controller with open and close function. Its range is about 50m, so I can close garage door through house open window.

        Thanks for comment.