First of all I want to thank the contribution to help solving this problem.
The question is:
I need to develop a system that detects when a "door" is open (using a sensor) and allows the extraction of the time and date that the event happens, Furthermore, if the door is open in certain hours it has to activate an alarm.
In a first approach, I thought using a contact sensor with a timer associated to activate the alarm and a PLC that would save the date and time in which the sensor was activated. However, after a few searches I thought that would be better to use an arduino to solve the problem.
But, I have found some problems so, this is why I am requesting your help. To accomplish this task I need an arduino but, wouldn't be better to save the data information in a SD card because it is needed to extract this dates? How can I do the interaction between the arduino and the SD? And how can I activate the alarm only in certain hours?
You could use this magnetic switch to determine if the door is open or closed:
For writing to an SD card, I really like this Pololu (Arduino compatible) board that has an on-board microSD slot:
That saves you from having to buy and wire in a separate board that has SD support. It's also the same format as the Arduino Uno, so you (probably) won't run into shield compatibility issues.
For precise time, you could either use a real time clock (RTC) module like this:
Or if you want to get super-fancy, you could possibly leverage a GPS unit like this:
For your "alarm" functionality, you could do something as simple as a piezo buzzer:
Or something more complex like a wireless link to some other base station that sends you a text message whenever the alarm is tripped. Or whatever. Start small and go from there.
I've found that Arduinos are typically less expensive than PLC solutions, as well as more flexible. If you need something rock solid in an industrial application though, a PLC is probably the way to go.
In the project I will have to use other type of switch to find of the door is open/closed.
But, I will have to find if the door is open with the signal of the switch and with the RTC get the hour that the event happens, isn't it? And then save that information in the SD to be able to read it in the future?