Go Down

Topic: Door Open Notification (Read 1 time) previous topic - next topic

wannab1

Just know this will be my first time using an ARDUINO so please be kind.   

Goal: We work in a very loud area and need to ring a Bell each time the front door is opened.

Here is what I already have:  A door that has a sensor already in it that is hard wired back to the area I will need the bell. The door sensor was from an old alarm system, I have tested it and it does still work.  The bell is 120vac and is very loud.  I would prefer the bell only ring for a few seconds each time the door is opened.

Is this something a novice could do with a board?

AWOL

"120V" and "novice" I'm uncomfortable with.

Mains wiring/safety experience?
"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

PaulS

Quote
I have tested it and it does still work.

What kind of sensor? Tested it how? What does still work mean?

If it is a simple switch, and "still works" means that it still makes/breaks a connection, it is very easy to connect that to an Arduino and read the connection state.

Connecting the bell will require a relay and a transistor. The Arduino toggles the transistor, which activates the relay, which activates the bell. After a time, the Arduino toggles the transistor again, which deactives and relay, which causes blessed silence.

https://www.sparkfun.com/products/11042

wannab1

Novice with Arduino only.

Door Sensor is Magnetic type embedded in door frame.  I played with alarm to see if I could use it for this without success.  Doing this I was able to determine the door sensor still works.
Is Magnetic sensor compatible with Arduino?

PaulS

I'll ask again. You said you tested the sensor, and that it works. HOW did you test it? If the sensor is mounted on the frame, and there is a magnet on the door, the thing is a simple switch. The mechanism for the make/break is irrelevant.

wannab1

It is a simple magnetic switch actually in the door frame.

I tested it 2 ways - 1. Had the alarm on opened door and it activated open door on display. 2. Ohm tested, closed/open.

PaulS

Quote
2. Ohm tested, closed/open.

OK. So, connect one side to ground and the other side to a digital pin. Activate the internal pullup resistor. Read the switch. HIGH means the door is open. LOW means that it is closed.

Something like this:
Code: [Select]
const int switchPin = 7;
const int relayPin = 8;

int currState;
int prevState = LOW;

void setup()
{
   Serial.begin(115200);

   pinMode(switchPin, INPUT);
   digitalWrite(switchPin, HIGH); // Turn on the pullup resistor
}

void loop()
{
   currState = digitalRead(switchPin);
   if(currState != prevState)
   {
      // Door just opened or door just closed
      if(currState == HIGH)
      {
         digitalWrite(relayPin, HIGH);
      }
      else
      {
         digitalWrite(relayPin, LOW);
      }
   }
   prevState = currState;
}


You can change the code to debounce the switch, or to keep the relay HIGH for a period of time, instead of shutting off then the door is closed.

wannab1

Thanks!Thanks!Thanks! I would not have been able to write that.   

One more question, Is the Arduino overkill for this?  I've looked for simple solutions that could be hacked over to do what I want but no luck.

PaulS

Quote
Is the Arduino overkill for this?

Of course it is. You could simply wire the switch to the relay and a battery. Open the door, the relay energizes. Close the door, the relay shots off.

But, where's the fun in that? With the Arduino, you can use the noise maker for so many more creative things.  8)

wannab1

I would do it the relay way but the switch in the door is normally closed, backwards for an easy solution.  I would go that way because now I want an Arduino just to play with.....

terryking228

Hi, Take a look at the page on the http://ArduinoInfo.Info WIKI: "Arduino Power"  http://arduino-info.wikispaces.com/ArduinoPower

A simple 1 or 2 relay board is very inexpensive.

You can learn more about Arduino and later add functions like "Nobody CLOSED the door after 60 seconds. Do 2 short rings".  Etc Etc. whatever you can imagine.

If you want to learn about Arduino, see: http://arduino-info.wikispaces.com/YourDuinoStarter
Regards, Terry King terry@yourduino.com  - Check great prices, devices and Arduino-related boards at http://YourDuino.com
HOW-TO: http://ArduinoInfo.Info

joebert

Hi, Florida BASA here.

I get the ominous feeling you should leave this door contact alone, especially after reading that you tested it's functionality by turning on an alarm. Taking the contact off the system or using varied resisters will likely screw your alarm up, keeping it attached and hooking it to voltage could permanently damage the alarm system.

What kind of security system is it? Some systems, for example a Bosch D6412, can be setup to watch contacts, and activate outputs on the board that can in turn close relays to a 120VAC bell. I had my home motion detectors setup to bypass the light switch in my hallway and turn on the light for 30 seconds on movement at one point.

Go Up