Types of Sensor

Thread Starter

Denis65

Joined Oct 5, 2019
2
Hi all,

I'm new to the forum, so apologies in advance.

I'm playing around with an arduino as a hobby and experimenting with home automation.

I'm looking for a system where i can tell a door is closed, and how long the door is closed for?

So the Garage door is closed, and then how long its closed for? I think I can do the transmitt / recieve wireless on the arduino but what sensors sound good?

Any ideas?
 

jpanhalt

Joined Jan 18, 2008
11,087
Have you checked how home alarm sensors tell whether a door is open or closed? One way is magnetic with a Hall sensor or magnetic reed switch. One could also use an IR emitter/receiver sensor, but I believe the current drain would be more.

One thing about using parts from home systems is that the parts may be available cheap used,
 

Thread Starter

Denis65

Joined Oct 5, 2019
2
Thank you for the reply. Much appreciated. That's actually on my list to investigated.

So would it be possible to create a program in arduino to read how long the door was closed time wise?
 

SamR

Joined Mar 19, 2019
5,031
Or just a plain old wired limit switch or even a micro one. The time you will have to program for. Wireless may be the prefered method but will require remote power so there are tradeoffs either way.
 

SamR

Joined Mar 19, 2019
5,031
Don't ever remember programing a timer (other than delay) on Arduino so not sure how accurate it's clock is but it should be possible. Look into it and see.
 

BobTPH

Joined Jun 5, 2013
8,813
A sensor is not going to tell you how long the door has been closed.

The sensor will only tell the Arduino whether the door is opened or closed.

The way a program could give you the info you want is as follows.

The program loops reading the sensor and and storing the last state. When it sees the state go from open to closed, it sets the time closed to zero.

It then adds 1 each second as long as the door remains closed.

This us all done by programming, including the keeping of the time. I would say this is an intermediate level programming exercise.

Bob
 

KeithWalker

Joined Jul 10, 2017
3,063
Hi all,

I'm new to the forum, so apologies in advance.

I'm playing around with an arduino as a hobby and experimenting with home automation.

I'm looking for a system where i can tell a door is closed, and how long the door is closed for?

So the Garage door is closed, and then how long its closed for? I think I can do the transmitt / recieve wireless on the arduino but what sensors sound good?

Any ideas?
The Arduino is not very accurate for measuring long time intervals. The internal interrupts affect the accuracy of "delay" statements. You can purchase a real-time clock module that will work with the Arduino for very little cost. Then you just need to sample the time and transmit it with an "open/closed" flag each time the door operates.
An alternative would be to just transmit the open/closed status from the garage to a local Arduino which reads the clock and displays the data.
https://randomnerdtutorials.com/guide-for-real-time-clock-rtc-module-with-arduino-ds1307-and-ds3231/
 

BobTPH

Joined Jun 5, 2013
8,813
You do not need a real time clock. To keep accurate time, you use the internal timer and interrupts. It can keep time as accurate as the crystal oscillator is.

Bob
 

Picbuster

Joined Dec 2, 2013
1,047
Hi all,

I'm new to the forum, so apologies in advance.

I'm playing around with an arduino as a hobby and experimenting with home automation.

I'm looking for a system where i can tell a door is closed, and how long the door is closed for?

So the Garage door is closed, and then how long its closed for? I think I can do the transmitt / recieve wireless on the arduino but what sensors sound good?

Any ideas?
Closed do you mean locked?
in any case you buy a cheap switch (push model normal closed avoiding external noise)
This goes to your MPU input via resistor and cap ( filter ).
When the button indicates a high (open) the mpu save open and current date time.
When the button indicates a low (closed) the mpu save down open and current date time.
This will produce time table for your door movements.

Save information on a usb or internal flash.
Accuracy clock I think good enough when using a xtal ( lets say 1 days a year. remember you are observing difference in time)


Picbuster
 

jpanhalt

Joined Jan 18, 2008
11,087
For any practical home security system today, I think the sensors need to communicate wirelessly to the MCU. Developing such sensors is a project in itself. That is why harvesting them from discarded units might be the best way to start. Of course, they will be older units. Then as a last tweak, newer, smaller, "better" sensors could be developed.
 
Top