Skip to content

DIY Toddler Door Alarm (I made an internet thing!)

In the middle of the night we found our darling 3-year-old downstairs in the kitchen eating ice cream out of the freezer. It was then that I realized I needed to get a door alarm.

I learned quickly on Amazon that many door alarms are pretty spendy. And I wanted to have one that would be accessible through the interwebs, so I decided to make my own.

And lucky me, I’m a developer. Here are a few things I learned!

I don’t want to post pictures of the specifics or post my code because honestly I wouldn’t want you do to what I did :). I got it to work, but this is not a tutorial. This will be a dump of what I thought about and went through designing a working prototype. Hopefully it inspires those aspiring to make one and gives a few ideas and pointers others could follow.

Photons are amazing

If you’re interested in Arduinos but you want something that has more out of the box functionality, try something from particle.

They have a couple different micro-controllers that all connect pretty effortlessly to wifi and the IDE, and I recommend the Photon.

Some pros:

  1. Super easy to set up the photon to connect to the wifi
  2. Has a web IDE that makes developing and testing really quick
  3. Out-of-the-box APIs allow you to basically have a REST endpoint immediately
  4. It’s small
  5. Code structure basically is Arduino in concept- you have a setup function and a loop, and you write to pins on the board.

Some cons:

  1. Pretty much needs wifi to update
  2. The language of choice is c++ (? or is it C? I think its C++ of some sort)
  3. You are tied to the photon eco-system (or, at least, it wasn’t quickly apparent if you could mix with arduino stuff)
  4. The documentation for the REST api is not the greatest, and the community just yells at you if something is unclear and you ask a question. Not the greatest. I spent 4 hours one night trying to simply post a request to my photon. They need to work on making things clearer

Reed switches are easy to use

Reed switches were surprisingly easy to use! For me it was simply easiest to use doorbell wire and run that from my boy’s room to our bedroom. So my prototype door alarm will alarm a buzzer in our bedroom, but the trigger is pictured here. The switch has two modes: normally on and normally closed. So in my case I connected it in series using the normally closed option. When it disconnects, it will trigger something in my Arduino/Photon/Particle code.

This is where I learned about pull up pin modes. Basically, with certain physical triggers like reed switches or tactile buttons it’s just easier to do a pull up mode. This means that basically the pin is set to “HIGH” as the default, and when the switch triggers it goes to “LOW” (which is the opposite of what a switch normally would do).

If that is all terribly confusing, don’t worry about it. Basically if triggers aren’t working the way you expect, check out pull up modes for pins.

It’s fun to design a case

The board has the photon plugged into a wall socket. The red and white wire is the doorbell wire that runs to the reed switch above my boys’ door. The green LED is lit when I’ve activated the alarm. There’s also a red LED and a buzzer that alternate on/off when the door switch is triggered and our little hellion is trying to escape.

This project was cool because it stretched my 3d CAD abilities (using Fusion 360), 3d printing skills, electrical wiring skills, coding, and REST endpoint skills.

REST endpoints with Photon are niiiiiice…

…once you get them working… Like I said, the forums were incredibly unhelpful at clarifying details about sending requests- often I found people just complaining about not reading the docs and then linking me to the page in the docs that I’m currently looking at.

But anyway, I designed a small app in Vue.js that would send a simple on/off post to my photon to turn the alarm on or off.

This is my Vue app that I’m hosting in a super secret place. And it was fun to make. It’s now hosted on the internet of things and I can activate and deactivate from my phone.

In the end

If you are considering dabbling in the internet of things I highly recommend Photon/Particle products to help you get set up quickly.

If you’re a developer already and have an idea for an internet thing, go for it. There’s so much that you can learn and do if you roll up your sleeves and make lots of mistakes.

Questions? Comments? Smart remarks? Hit me up at @jschof or comment below!

Leave a Reply

Your email address will not be published. Required fields are marked *