Page 1 of 1

How to add two PIR sensor. stair project

how to add two PIR sensor. stair project

Welcome to the Tweaking4All community forums!
When participating, please keep the Forum Rules in mind!

Topics for particular software or systems: Start your topic link with the name of the application or system.
Examples: "MacOS X - Your question", "MS Word - Your Tip or Trick".

Please note that switching to another language when reading a post will not work!
Posts will not have a translated counterpart.




RSS Feed

Home Forums Hardware Arduino how to add two PIR sensor. stair project

Tagged: , , , ,

This topic contains 5 replies, has 2 voices, and was last updated by  luckykang 7 months, 4 weeks ago.

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • 8289

    luckykang
    Participant

    hi guys is anyone can help me i jst wanna add two pir sensor with these codes top and bottom im bit confuse with wiring and coding is anyone knows how to do it thx  

    8291

    hans
    Keymaster

    Hi Luckychan,

    thank for starting a forum topic.
    I’d start with a simple PIR project first, and with just one PIR. For example this one.
    Next step; replicate that simple project by using 2 PIRs.

    You’d have to add the second PIR to your code, for example with 1 PIR:

    int led = 13;                // the pin that the LED is attached to
    int sensor = 2; // the pin that the PIR sensor is attached to
    int state = LOW; // by default, no motion detected
    int val = 0; // variable to store the sensor status (value)
    void setup() {
      pinMode(led, OUTPUT); // initialize LED as an output
      pinMode(sensor, INPUT); // initialize sensor as an input
      Serial.begin(9600); // initialize serial
    }

    and with 2 PIRs:

    int led = 13;                // the pin that the LED is attached to
    int sensor1 = 2; // the pin that the first PIR sensor is attached to
    int sensor2 = 3; // the pin that the second PIR sensor is attached to
    int state = LOW; // by default, no motion detected
    int val = 0; // variable to store the sensor status (value)
    void setup() {
      pinMode(led, OUTPUT); // initalize LED as an output
      pinMode(sensor1, INPUT); // initialize sensor as an input
      pinMode(sensor2, INPUT); // initialize sensor as an input
      Serial.begin(9600); // initialize serial
    }

    Now you have to incorporate that in you void loop(), but I’m not quite sure what your project is or what it should do.

    8310

    luckykang
    Participant

    The project  i m working on is stair project one PIR sensor bottom stair and one top so when bottom sensor activate the light start from bottom to top when top sensor activate the light start top to bottom and also how to do the wiring also thx

    8312

    luckykang
    Participant

    hey hans can you tell me that the led strip effects codes will work on this led strip led photo attached thx

    Attachments:
    8315

    hans
    Keymaster

    Hey Luckykang,

    I have never work with those, since that one seems to be a 12V model.
    Doesn’t mean it will not work, just that you need a 12V power supply for the main power of the LED strip (not the Arduino!).

    They somehow they look like the older LED strips like the WS2801, but since there is no model/type printed anywhere, it would not know. The only way to find out is by just testing. Keep in mind +12V voor de LED strip, but +5V for the Arduino. Also; the calculation to determine how “heavy” the power supply would be, will be different as well. If you calculate the Amps needed for 5V, the for 12V your need about 1/2 of the amps.

    Also keep in mind that this strip seems to use a Data and Clock signal, unlike the WS2811/WS2812 which do not use a Clock signal.
    And the clock signal might or might not be supported by the library you’ll be using…

    I did find this post in case you’re using FastLED: Arduino Website Topic: Cannot get WS2801 LED’s to work
    I did find something at GitHub in case you’re using NeoPixel: Example library for driving Adafruit WS2801 pixels

    Please keep in mind; I have never used these LEDs, I intentionally picked the WS2811/WS2812 for my projects to keep things simple … 

    Hope this helps!

    8317

    luckykang
    Participant

    The project i m working on is stair project one PIR sensor bottom stair and one top so when bottom sensor activate the light start from bottom to top when top sensor activate the light start top to bottom and also how to do the wiring also thx

    Similar to this video

Viewing 6 posts - 1 through 6 (of 6 total)



You must be logged in to reply to this topic.