Another guest post, this time from my oldest son, who is considering an engineering major in college.

Introduction

For my first real engineering project, I made a garage door sensor. I chose to create a garage door sensor because it is both simple enough for me to understand and actually useful. I wanted to work on an engineering project in the first place because I am interested in electrical or computer engineering, and was curious as to what working on an engineering project would be like.

Overview

The system works by using a magnetic switch mounted to the garage floor that sends a signal to the microcontroller when it comes close to the magnet, which is mounted on the bottom of the garage door. This setup is implemented on both garage doors.

When one or both of the garage door switches is open (that is, a garage door is up), a blue LED will turn on inside the house to let people know that the garage is not closed. When both doors are shut, the LED will turn off.

Hardware

For our garage door switches, I used Honeywell 958 magnetic switches, a normally closed switch (NC).

When the magnet is nearby, the switch is closed, completing the electrical circuit. These switches are hooked up to digital inputs on the MCU, a Particle Photon, both of which have been pulled up using onboard circuitry. This is important because when the Honeywell switches are open, the digital inputs would be floating if they weren't pulled up. The term pullup resistor just means a weak resistor (high resistance) that is easily overpowered when the circuit is closed and the digital input is pulled to 0 volts.

For the receiver, we used another Particle to turn on and off a blue LED. The LED is connected to a digital out-configured pin in series with a current-limiting resistor.

Software

In order to transmit the data between the Particle attached to the garage door switches and the Particle attached to the LED, I used Particle's free cloud platform. Using this platform, I set up the garage Particle to publish the status of the garage door every time the boolean isOpen (a boolean OR of the two digital inputs) changes. The Particle inside the house uses the subscribe function to receive information from the cloud anytime isOpen changes.

Publish:

    if(isOpen != lastIsOpen)
    {
        Spark.publish("doorIsOpen", isOpen?"1":"0", 60, PRIVATE);
        lastIsOpen = isOpen;
    }
    nextTime = millis() + 1000;

Subscribe:

    Spark.subscribe("doorIsOpen", doorHandler, MY_DEVICES);

Wrap Up

After having the whole system working for about a week, it seems to be working well, with the exception of when the internet goes out. As the system depends on the Particle cloud service to send and receive information, it cannot function without internet. However, this is a fairly minor concern as the internet does not go out frequently, and doesn't stay out for a long time when it does. One possible improvement would be to directly connect the two Particles together so that the cloud service isn't needed, but that seems unnecessary.

Working on this project helped me learn what engineering projects are like, and how they involve both hardware and software work. I learned about how to use Particle boards and the Particle cloud service, and also learned how to use some tools I had never used before. Overall, I really enjoyed working on this project and hope to do another similar engineering project in the near future.