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. My Project
  3. one Arduino with three door sensors and one buzzer sensor

one Arduino with three door sensors and one buzzer sensor

Scheduled Pinned Locked Moved My Project
4 Posts 3 Posters 1.3k Views 3 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.
  • H Offline
    H Offline
    Henry Liu
    wrote on last edited by
    #1

    Dear All :
    I have been looking around the forum for a solution, but haven't found. I have one Adruino uno, three door/window sensors , one buzzer sensor. One door sensor will be on my apartment front door, one door sensor will be on my bathroom door, one sensor will on window.

    The problem is that I don't know how to make the three sensor works independently? when someone open the door or window, the buzzer should be trigger and the Computer will show"Door 1/2 is opening" or "window is opening ".

    Now the three sensor is series. The code is that:


    const int buzzer = 3;
    const int sensor = 4;

    int state; // 0 close - 1 open wwitch

    void setup()
    {
    pinMode(sensor, INPUT_PULLUP);
    }

    void loop()
    {
    state = digitalRead(sensor);

    if (state == HIGH){
    	tone(buzzer, 400);
    }
    else{
    	noTone(buzzer);
    }
    delay(200);
    

    }


    What i am trying to do is have 3 door sensors running from one arduino uno as they will be in different door. I realise that this is probably some thing but how would i go about changing the code to make this happen?

    I appreciate any help. Thanks

    Best Regrads;

    dbemowskD 1 Reply Last reply
    0
    • H Henry Liu

      Dear All :
      I have been looking around the forum for a solution, but haven't found. I have one Adruino uno, three door/window sensors , one buzzer sensor. One door sensor will be on my apartment front door, one door sensor will be on my bathroom door, one sensor will on window.

      The problem is that I don't know how to make the three sensor works independently? when someone open the door or window, the buzzer should be trigger and the Computer will show"Door 1/2 is opening" or "window is opening ".

      Now the three sensor is series. The code is that:


      const int buzzer = 3;
      const int sensor = 4;

      int state; // 0 close - 1 open wwitch

      void setup()
      {
      pinMode(sensor, INPUT_PULLUP);
      }

      void loop()
      {
      state = digitalRead(sensor);

      if (state == HIGH){
      	tone(buzzer, 400);
      }
      else{
      	noTone(buzzer);
      }
      delay(200);
      

      }


      What i am trying to do is have 3 door sensors running from one arduino uno as they will be in different door. I realise that this is probably some thing but how would i go about changing the code to make this happen?

      I appreciate any help. Thanks

      Best Regrads;

      dbemowskD Offline
      dbemowskD Offline
      dbemowsk
      wrote on last edited by
      #2

      @henry-liu So, you are saying that you want 3 different sensors ( 2 doors and a window) to connect to a single arduino uno, and you want to power it with batteries, correct? If that is the case, there are some issues you should think about:
      first, you would end up running a lot of wire to these sensors. Not that that can't be done, but you would probably be better off with individual sensors.
      Second, unless you are using larger batteries to power the Uno, you are not going to get much life out of your batteries running an uno.
      Third, you don't have any of the MySensors code in the sketch that you posted.

      Vera Plus running UI7 with MySensors, Sonoffs and 1-Wire devices
      Visit my website for more Bits, Bytes and Ramblings from me: http://dan.bemowski.info/

      SchlogS 1 Reply Last reply
      0
      • dbemowskD dbemowsk

        @henry-liu So, you are saying that you want 3 different sensors ( 2 doors and a window) to connect to a single arduino uno, and you want to power it with batteries, correct? If that is the case, there are some issues you should think about:
        first, you would end up running a lot of wire to these sensors. Not that that can't be done, but you would probably be better off with individual sensors.
        Second, unless you are using larger batteries to power the Uno, you are not going to get much life out of your batteries running an uno.
        Third, you don't have any of the MySensors code in the sketch that you posted.

        SchlogS Offline
        SchlogS Offline
        Schlog
        wrote on last edited by
        #3

        @dbemowsk
        Thank about using ESP8266 (wifi sensor ) hook to each sensor , you can easily use battery's for them. Then Just setup the Arduino with it own ESP8266 this way your Arduino can be powered for a wall plug and you sensor can send a single when the door or windows sensors are moved.
        You can find a large list of different ESP8266 shields and a lot of code on the net to help you program them.

        dbemowskD 1 Reply Last reply
        0
        • SchlogS Schlog

          @dbemowsk
          Thank about using ESP8266 (wifi sensor ) hook to each sensor , you can easily use battery's for them. Then Just setup the Arduino with it own ESP8266 this way your Arduino can be powered for a wall plug and you sensor can send a single when the door or windows sensors are moved.
          You can find a large list of different ESP8266 shields and a lot of code on the net to help you program them.

          dbemowskD Offline
          dbemowskD Offline
          dbemowsk
          wrote on last edited by
          #4

          @schlog I agree with you. I was responding to the original post.

          Vera Plus running UI7 with MySensors, Sonoffs and 1-Wire devices
          Visit my website for more Bits, Bytes and Ramblings from me: http://dan.bemowski.info/

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


          20

          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