Skip to content
  • MySensors
  • OpenHardware.io
  • Categories
  • Recent
  • Tags
  • Popular
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo
  1. Home
  2. Hardware
  3. wireless door / window sensor

wireless door / window sensor

Scheduled Pinned Locked Moved Hardware
12 Posts 6 Posters 7.0k Views 7 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • parachutesjP Offline
    parachutesjP Offline
    parachutesj
    wrote on last edited by
    #1

    guys,
    did anyone build up a wireless door or windows sensor yet?
    For example with this one?
    433 wireless door sensor

    I guess it shouldn't be too hard to hack this.

    Cheers,
    SJ

    1 Reply Last reply
    0
    • M Offline
      M Offline
      mortommy
      wrote on last edited by
      #2

      I built a window and a door sensor, just using a normal magnetic switch as proposed in this example. They are working quite well and are powered by a coin cell battery.

      parachutesjP 1 Reply Last reply
      0
      • M mortommy

        I built a window and a door sensor, just using a normal magnetic switch as proposed in this example. They are working quite well and are powered by a coin cell battery.

        parachutesjP Offline
        parachutesjP Offline
        parachutesj
        wrote on last edited by
        #3

        @mortommy thank you. So you have the whole thing incl. the Arduino powered by a battery?
        That would work most probably but is too bulky for me. Don't like to have a too big case dangling around on my windows. Also using a wireless could save a few arduinos. I give it a shot and order a few and let you know the outcome.
        SJ

        1 Reply Last reply
        0
        • mikeeM Offline
          mikeeM Offline
          mikee
          wrote on last edited by
          #4

          Most of these cheap sensors are based on PT2622 chip or similar. RF link works fine with them.

          parachutesjP 1 Reply Last reply
          1
          • mikeeM mikee

            Most of these cheap sensors are based on PT2622 chip or similar. RF link works fine with them.

            parachutesjP Offline
            parachutesjP Offline
            parachutesj
            wrote on last edited by
            #5

            @mikee thank you, that ensures my thoughts. There will be SALE on Aliexpress tomorrow...

            1 Reply Last reply
            0
            • A Offline
              A Offline
              Andrea1
              wrote on last edited by Andrea1
              #6

              I heard about a new radio chip monitoring window sensor? Have anyone heard about this? It warns when the windows are left open. It powers up with energy provided by solar power and the maintenance is also easy. Is it good for preventing the break-ins?

              parachutesjP 1 Reply Last reply
              0
              • A Andrea1

                I heard about a new radio chip monitoring window sensor? Have anyone heard about this? It warns when the windows are left open. It powers up with energy provided by solar power and the maintenance is also easy. Is it good for preventing the break-ins?

                parachutesjP Offline
                parachutesjP Offline
                parachutesj
                wrote on last edited by
                #7

                @all
                When the window sensors from above arrived, receiving the wireless signal was easy. I noted that they only report open and not change when closed, so I tried to "fix" it but failed after a few hours of improving the original hardware. I took all electronics out and fittet an Arduino pro mini, radio and a reed switch into the case easily.

                Quite expensive after all but exactly what I wanted. I still do have two laying here and not sure if I shall remodel them or go with an out of the box sensor from Homematic here...

                1 Reply Last reply
                1
                • U Offline
                  U Offline
                  user2684
                  Contest Winner
                  wrote on last edited by
                  #8

                  Kind of off topic but personally when I struggle too much in repurposing an existing radio sensor I go with this https://github.com/merbanan/rtl_433, attach a 7$ DVB dongle to a raspberry or equivalent, connect a proper antenna and decode the signal (which is usually pretty easy when it comes to cheap sensors). Of course the learning curve can be quite steep at the beginning so it is not convenient in every situation.

                  A bit more on topic, if I have understood correctly, the example at https://www.mysensors.org/build/binary is not suitable for a sleeping sensor cause debouncing and sleeping do not play well together. For a sleeping sensor what I did was attaching to an interrupt and if waking up on CHANGE you get a message when the door/window opens as well as closes. If anybody is interest can copy the relevant code from the SensorDoor of https://sourceforge.net/projects/mynodemanager/

                  parachutesjP 2 Replies Last reply
                  0
                  • U user2684

                    Kind of off topic but personally when I struggle too much in repurposing an existing radio sensor I go with this https://github.com/merbanan/rtl_433, attach a 7$ DVB dongle to a raspberry or equivalent, connect a proper antenna and decode the signal (which is usually pretty easy when it comes to cheap sensors). Of course the learning curve can be quite steep at the beginning so it is not convenient in every situation.

                    A bit more on topic, if I have understood correctly, the example at https://www.mysensors.org/build/binary is not suitable for a sleeping sensor cause debouncing and sleeping do not play well together. For a sleeping sensor what I did was attaching to an interrupt and if waking up on CHANGE you get a message when the door/window opens as well as closes. If anybody is interest can copy the relevant code from the SensorDoor of https://sourceforge.net/projects/mynodemanager/

                    parachutesjP Offline
                    parachutesjP Offline
                    parachutesj
                    wrote on last edited by
                    #9

                    @user2684
                    correct, debouncing does not work. below is my code which works pretty well.
                    I forgot the power drain but it was very minimal. The major "problem" are the standard reed switches which are <normally open>
                    that means in most cases when the door is closed, the switch is closed as well and this means the circuit is also closed and power flows which results in a factor 10 higher power consumption. The solution is to use a <normally closed> reed switch which will turn it around (circuit closed when door is open).
                    At least in my case, the door is 98% of the time closed and therefore power consumption is less during close phase.

                    
                    // Enable debug prints to serial monitor
                    #define MY_DEBUG
                    
                    // Enable and select radio type attached
                    #define MY_RADIO_NRF24
                    //#define MY_RADIO_RFM69
                    
                    #include <SPI.h>
                    #include <MySensors.h>
                    //#include <Bounce2.h>
                    #include <Vcc.h>
                    
                    #define CHILD_ID 3
                    #define BUTTON_PIN  3  // Arduino Digital I/O pin for button/reed switch
                    
                    //Bounce debouncer = Bounce();
                    int oldValue = -1;
                    
                    float oldVolts = 0;
                    const float VccExpected   = 3.00;
                    const float VccCorrection = 3.0 / 3.0; // Measured Vcc by multimeter divided by reported Vcc
                    Vcc vcc(VccCorrection);
                    static int oldBatteryPcnt = 0;
                    
                    
                    // Change to V_LIGHT if you use S_LIGHT in presentation below
                    MyMessage msg(CHILD_ID, V_TRIPPED);
                    
                    void setup()
                    {
                      // Setup the button
                      pinMode(BUTTON_PIN, INPUT);
                      // Activate internal pull-up
                      digitalWrite(BUTTON_PIN, HIGH);
                    
                      // After setting up the button, setup debouncer
                    //  debouncer.attach(BUTTON_PIN);
                    //  debouncer.interval(5);
                    
                    }
                    
                    void presentation() {
                      // Register binary input sensor to gw (they will be created as child devices)
                      // You can use S_DOOR, S_MOTION or S_LIGHT here depending on your usage.
                      // If S_LIGHT is used, remember to update variable type you send in. See "msg" above.
                      present(CHILD_ID, S_DOOR);
                    }
                    //  Check if digital input has changed and send in new value
                    void loop()
                    {
                    //  debouncer.update();
                      // Get the update value
                      // int value = debouncer.read();
                      int value = digitalRead(BUTTON_PIN);
                      wait(100);
                      if (value != oldValue) {
                        // Send in the new value
                        send(msg.set(value == HIGH ? 1 : 0));
                        oldValue = value;
                      }
                      //BAtterie
                      int batteryPcnt = (int)vcc.Read_Perc(VccExpected);
                      float volts = (float)vcc.Read_Volts();
                      int myPerc = volts * 100 / VccExpected;
                      Serial.print("Battery percent: ");
                      Serial.print(myPerc);
                      Serial.println(" %");
                    
                      Serial.print("Volts: ");
                      Serial.print(volts);
                      Serial.println(" V");
                      if (oldBatteryPcnt != myPerc)
                      {
                        sendBatteryLevel(myPerc);
                        oldBatteryPcnt = myPerc;
                      }
                    
                      sleep(1, CHANGE, 0);
                    }```
                    U 1 Reply Last reply
                    0
                    • U user2684

                      Kind of off topic but personally when I struggle too much in repurposing an existing radio sensor I go with this https://github.com/merbanan/rtl_433, attach a 7$ DVB dongle to a raspberry or equivalent, connect a proper antenna and decode the signal (which is usually pretty easy when it comes to cheap sensors). Of course the learning curve can be quite steep at the beginning so it is not convenient in every situation.

                      A bit more on topic, if I have understood correctly, the example at https://www.mysensors.org/build/binary is not suitable for a sleeping sensor cause debouncing and sleeping do not play well together. For a sleeping sensor what I did was attaching to an interrupt and if waking up on CHANGE you get a message when the door/window opens as well as closes. If anybody is interest can copy the relevant code from the SensorDoor of https://sourceforge.net/projects/mynodemanager/

                      parachutesjP Offline
                      parachutesjP Offline
                      parachutesj
                      wrote on last edited by
                      #10

                      @user2684
                      it was not so much figuring out the 433 signal/transport, the hardware just did not capture the close phase of the switch. I guess this is due to the issue I explained in the other reply regarding power consumption and they just cut that off somehow in order to make the batteries last longer. But thanks a lot for the link, will check this out

                      1 Reply Last reply
                      0
                      • parachutesjP parachutesj

                        @user2684
                        correct, debouncing does not work. below is my code which works pretty well.
                        I forgot the power drain but it was very minimal. The major "problem" are the standard reed switches which are <normally open>
                        that means in most cases when the door is closed, the switch is closed as well and this means the circuit is also closed and power flows which results in a factor 10 higher power consumption. The solution is to use a <normally closed> reed switch which will turn it around (circuit closed when door is open).
                        At least in my case, the door is 98% of the time closed and therefore power consumption is less during close phase.

                        
                        // Enable debug prints to serial monitor
                        #define MY_DEBUG
                        
                        // Enable and select radio type attached
                        #define MY_RADIO_NRF24
                        //#define MY_RADIO_RFM69
                        
                        #include <SPI.h>
                        #include <MySensors.h>
                        //#include <Bounce2.h>
                        #include <Vcc.h>
                        
                        #define CHILD_ID 3
                        #define BUTTON_PIN  3  // Arduino Digital I/O pin for button/reed switch
                        
                        //Bounce debouncer = Bounce();
                        int oldValue = -1;
                        
                        float oldVolts = 0;
                        const float VccExpected   = 3.00;
                        const float VccCorrection = 3.0 / 3.0; // Measured Vcc by multimeter divided by reported Vcc
                        Vcc vcc(VccCorrection);
                        static int oldBatteryPcnt = 0;
                        
                        
                        // Change to V_LIGHT if you use S_LIGHT in presentation below
                        MyMessage msg(CHILD_ID, V_TRIPPED);
                        
                        void setup()
                        {
                          // Setup the button
                          pinMode(BUTTON_PIN, INPUT);
                          // Activate internal pull-up
                          digitalWrite(BUTTON_PIN, HIGH);
                        
                          // After setting up the button, setup debouncer
                        //  debouncer.attach(BUTTON_PIN);
                        //  debouncer.interval(5);
                        
                        }
                        
                        void presentation() {
                          // Register binary input sensor to gw (they will be created as child devices)
                          // You can use S_DOOR, S_MOTION or S_LIGHT here depending on your usage.
                          // If S_LIGHT is used, remember to update variable type you send in. See "msg" above.
                          present(CHILD_ID, S_DOOR);
                        }
                        //  Check if digital input has changed and send in new value
                        void loop()
                        {
                        //  debouncer.update();
                          // Get the update value
                          // int value = debouncer.read();
                          int value = digitalRead(BUTTON_PIN);
                          wait(100);
                          if (value != oldValue) {
                            // Send in the new value
                            send(msg.set(value == HIGH ? 1 : 0));
                            oldValue = value;
                          }
                          //BAtterie
                          int batteryPcnt = (int)vcc.Read_Perc(VccExpected);
                          float volts = (float)vcc.Read_Volts();
                          int myPerc = volts * 100 / VccExpected;
                          Serial.print("Battery percent: ");
                          Serial.print(myPerc);
                          Serial.println(" %");
                        
                          Serial.print("Volts: ");
                          Serial.print(volts);
                          Serial.println(" V");
                          if (oldBatteryPcnt != myPerc)
                          {
                            sendBatteryLevel(myPerc);
                            oldBatteryPcnt = myPerc;
                          }
                        
                          sleep(1, CHANGE, 0);
                        }```
                        U Offline
                        U Offline
                        user2684
                        Contest Winner
                        wrote on last edited by
                        #11

                        Oh you're right, also the "Magnetic Door Switch Sensor" from the example https://www.mysensors.org/build/binary is normally closed. I read somewhere a high value resistor can help in limiting the current flow in these situations but never tried myself

                        1 Reply Last reply
                        1
                        • XanderX Offline
                          XanderX Offline
                          Xander
                          wrote on last edited by
                          #12

                          If you need a signal both if the window was closed and opened you can buy this sensor:
                          https://www.aliexpress.com/item/Free-shipping-Wireless-window-and-door-magnetic-sensor-open-detector-1527-chips/32334214010.html
                          It is based on a 1527 Chip.
                          Open the rear cover and connect these pins with a solder point:
                          0_1490295555056_433MHz Reed Sensor small.jpg

                          1 Reply Last reply
                          2
                          Reply
                          • Reply as topic
                          Log in to reply
                          • Oldest to Newest
                          • Newest to Oldest
                          • Most Votes


                          29

                          Online

                          11.7k

                          Users

                          11.2k

                          Topics

                          113.1k

                          Posts


                          Copyright 2025 TBD   |   Forum Guidelines   |   Privacy Policy   |   Terms of Service
                          • Login

                          • Don't have an account? Register

                          • Login or register to search.
                          • First post
                            Last post
                          0
                          • MySensors
                          • OpenHardware.io
                          • Categories
                          • Recent
                          • Tags
                          • Popular