Home alarm with an Arduino

My university degree didn’t involve electronics, or at least the hands-on aspect of using them at least. I did cover basic circuitry, but my study mostly focused on the physics of it all, namely something known as quantum mechanics. I won’t delve into that side of things, but the thing to remember with that can of worms is that the physics which governs the world we see is itself a world away from what governs the world at the nano-scale.

1 nanometre (nm) = 1/1,000,000th of a millimetre (mm)

It just so happened that in my final year at university I lived with two friends, both of whom studied electronics and electronic engineering so I probably had the best chance of learning something of it all. I wasn’t up for having ‘Electronics for Dummies’ sitting on my shelf…haha. I thought it might be fun to design my own silent alarm for our then flat. I find a more hands-on approach teaches me more than just the books. We never actually used it in the end.

I started with a breadboard. This is a plastic block with wires inside that allows for the user to test circuit designs without needless soldering and wasting supplies. The block has some 400 ports which are filled by simply push-fitting wires and LEDs into.

Breadboard with push-fit ports for solderless prototyping.
Arduino used for controlling home alarm.

The sides of the breadboard have a row of two ports. The rows are connected lengthways which means you can either supply (+) or ground (-) a current which supplies the rows of 5 ports in the middle of the board. In short, this just means you can neaten up your prototyping. Hopefully it’s illustrated better below.

I assigned a red LED to each door in my house to tell me if it had been opened and a single green LED to signify all doors being locked. I used those supply and grounding rows to neaten up the design. Each LED has its own colour-corresponded supply wire. This was because each LED was controlled on a separate circuit as each door is separate.

Wired LEDs for locked (red) and unlocked doors (green) with individual supply and shared grounding.

Next, it was just a matter of creating individual circuits with a 5V supply for each door. This time, the circuits shared the same supply, but had different groundings. This allowed me to monitor the output.

Inputs and outputs for doors with shared supply and individual grounding.

Now the coding bit. I won’t go into too much detail because frankly I’m still learning myself. I measured the output of the circuit for each door to determine if it was still locked or had been opened. If a specific circuit was broken for longer than 2 seconds, then the green light from the first circuit would turn off and the corresponding red light flash. A second ‘on’ and a second ‘off’.

I coded the alarm using the Arduino platform. I used something called an ‘if function‘. This allowed me to code in that ‘if the circuit is completed’ (i.e. the door is shut) then ‘the green light is on’. Then I coded that ‘if the circuit is broken for 2 or more seconds’ (i.e. a door is opened) then ‘the green turns off and the corresponding red light flashes’. Once the bugs were ironed out, it worked pretty well.

Portion of the code written for the alarm.

I designed a case for the alarm with TinkerCad. I roughly measured the dimensions of the Arduino mother board, its power supply and the breadboard and placed pilot holes to neaten up all the wires going in and out of the case.

I then printed it using the Neo 3D printer. This one uses a laser to cure a resin. After cleaning it with rubbing alcohol to remove excess resin and a thorough wash in warm soapy water, it was ready to go.

Final Alarm Design

It worked quite well. I also designed and printed a second LED alert module. The larger alarm will be placed somewhere inside, whilst the second module will be visible from outside the front door to alert someone coming home of a break in the circuit.
Have you used an Arduino before? Let me know what you used it for and how it went. If you have a design in mind, please get in touch and I’ll do what I can to help.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: