New to Arduino- Need Advice please


We recently got given Arduino starter kits as part of a university project. Having no experience with the hardware side of electronics before i could really use some advice. My idea for the device is relatively simple in concept but i could use some pointers as to the realism of it. Basically i need my arduino to recognize whether a door is open or closed. I planned on using an ultrasonic sensor to detect if the door was closed.

Is this a good option? Or is there a better way of pulling this off?

Any help is greatly appreciated guys!


First off, welcome to the wonderful world of Arduino! ;D

An ultrasonic sensor seems overkill to me for such a simple task. Here's what I would do:

Have a conductive material on both the door and the door frame, and then you can detect whether the door is closed or not by checking if there is a complete circuit between the two plates or wires, etc.

This is how many Security systems work, and some will also use reed switches too.

If you want to use a reed switch (which would probably be easier), here's what you'd do:

A reed switch is basically a switch that is activated by a magnetic field. Put a strong RE (rare earth) magnet on the door, and a Reed switch (connected to the Arduino) on the door frame, near the magnet when the door is closed. If you do it right, when the door is closed, the circuit will complete, and you can detect the door's status.

Good luck! :)

Yes that could work, if you can mount the sensor such that it gives a good sight at the closed door. However the distance difference between a shut door and one just not totally latched shut may be too small to resolve with the US sensor.

A simpler method is using a simple door switch, either mechanical or a magnetic switch mounted in the door frame with a small PM magnet mounted in the door proper. I like to use the cheapest and simplest method that will solve the task.


EDIT: Typical that someone would beat me to posting while I'm typing a reply ;D


Thanks for the quick reply guys!

That does seem a much simpler solution, thank you!

I will look into it and update my progress as i go along

Cheers again.

You can pick up one of these for super cheap and get all the parts to get rolling:

You can purchase locally, they have stores in big cities with the same prices:

Apologies, Waterppk, but I have to suggest "no, no, no"...

Hobbyists getting going with Arduino needs to find a good supplier for electronic bits and pieces, and the reed switch inside the complete alarm solution are as good a place to start as any...

In the UK I like RS Components... ..not the cheapest, but vast selection, good service. And online datasheets.

Or, try... ... who have a more narrow range, but good prices if they have what you want. I bought 4 reed switches and magnets there recently: £1.80 + £2.50 p&p

In the US, I like Jameco and Digikey

=== Magnets: Yes, get the super-power RE type if easy... or just go down to Staples and pick up a pack of "hold notes to the 'fridge" devices. Probably RE anyway.