No announcement yet.

Seeking electrical opinion on door/window sensors

  • Filter
  • Time
  • Show
Clear All
new posts

  • Seeking electrical opinion on door/window sensors

    I have a couple of locations that I have built a multi sensor based on the Arduino. One of the sensor functions is monitoring doors/windows. As example, in my garage, I have 2 garage doors (manual), 3 windows and 1 man door. I have a magnetic sensor at each of these locations. I wired them in series so that if any one of them gets triggered, the arduino will know and set the garage door/window device to open.

    It seems somewhat unreliable. The arduino is fine, just monitoring those 6 sensors in series does not always alert when I enter the door. On the arduino, one of the wires for the series circuit goes to GND and the other goes to the digital pin that I am monitoring.

    Here is my question - would it be better to have one end of the circuit going to 3V (rather than GN) and then to the pin I am monitoring. Stated another way, it is better for long distances to use GND or actual voltage (3V)?

    Hope this makes sense.

  • #2
    I'd try resistors on the inputs - see here for why -

    I don't know what the minimum voltage is to detect a change from 0/1 with an Arduino (I would imagine it is less than 3V) but I'd look at connecting them to 5V to see if that helps. I don't know what cable you are using as to whether there will be any significant volt drop across it.
    My Plugins:

    Pushover 3P | DoorBird 3P | Current Cost 3P | Velleman K8055 3P | LAMetric 3P | Garadget 3P | Hive 3P |
    Yeelight 3P | Nanoleaf 3P


    • #3
      Most door/window contacts are Normally closed meaning that under normal conditions when the door or window is closed, the circuit is closed. This allows a small amount of current to flow through the contacts and be monitored by an alarm panel. I am not sure how the Arduino is setup but maybe try to invert the trigger on the Arduino to see if that helps. So now if a door is opened, the Arduino pin will go High.



      • #4

        Thanks for the link about input pins. It helped me understand more.

        I previously was opening the pin with:

        if (DoorSensor != 0) pinMode(DoorSensor, INPUT);
        I changed it to:

        if (DoorSensor != 0) pinMode(DoorSensor, INPUT_PULLUP);
        and it works much better it seems.


        • #5
          It also depends on the type of sensor you have. For professional alarm panels the sensor uses two additional resistors that are sometime built into the sensor.

          The way it works is as follows:

          - The two resistors (typically 4K7 or each) are placed in series and connect to the alarm panel input
          - The contact triggered by door open/close will short circuit one resistor
          - In case of a PIR that has a sabotage switch (open enclosure), both resistors will be shorted

          The alarm panel is now able to detect four states:

          1. Normal operation, contact open: 4K7+4K7= 9K4
          2. Normal operation, contact closed: 4K7
          3. Sabotage, cable cut: OPEN
          4. Sabotage, cable short circuit: 0

          So check your contacts for built in resistors, because if they are included your input might never reach the 0V your are expecting...


          • #6

            My door window sensors are the simple 2 wire magnetic ones that you find on ebay for cheap. I've got them wired in one big serial circuit.I don't care which one triggered. Only that one did.