Navigation

    • Register
    • Login
    • Search
    • OpenHardware.io
    • Categories
    • Recent
    • Tags
    • Popular
    1. Home
    2. Rene046
    • Continue chat with Rene046
    • Start new chat with Rene046
    • Flag Profile
    • Profile
    • Following
    • Followers
    • Blocks
    • Topics
    • Posts
    • Best
    • Groups

    Rene046

    @Rene046

    3
    Reputation
    70
    Posts
    398
    Profile views
    0
    Followers
    0
    Following
    Joined Last Online

    Rene046 Follow

    Posts made by Rene046

    • RE: šŸ’¬ Soil Moisture Sensor

      o and i forget to ask if this product is a better option .

      https://nl.aliexpress.com/item/Soil-moisture-probe-antioxidant-anti-corrosion-Soil-hygrometer-test-probe-Moisture-detection-sensor-Soil-moisture-detect/32829609385.html?spm=a2g0z.10010108.1000016.1.6403300d7IQapA&isOrigTitle=true

      Soil moisture probe antioxidant anti-corrosion Soil hygrometer test probe Moisture detection sensor Soil moisture detect probe

      $7.60
      posted in Announcements
      Rene046
    • RE: šŸ’¬ Soil Moisture Sensor

      @manutremo

      how did you wire you normal fork sensor, i get different reading when using a voltage divider if i switch the polarization.
      i used this to connect it.
      http://www.electronicwings.com/sensors-modules/soil-moisture-sensor
      using pin digital 6 and 7 as alternating power, and pin A0 to read

      And how do other people protect there capacitive sensor electronics from water .. rain

      posted in Announcements
      Rene046
    • Get date from Domoticz into Node

      Hi there,

      How can i take the data from a dimmer position out of Domoticz from my node, so i can use it to control a Mosfet.

      I tried without luck..
      request( Dimvalue, V_DIMMER );

      but think its not that simple...

      kind regards Rene

      posted in Troubleshooting
      Rene046
    • RE: Analog to digital how ?

      All working fine sometimes the pir reaction could be a bid faster, and sometimes i get a false reading think i'll have to put the pir signal lines to the ground with an resistor.

      Any advice is welcome, to make thing faster, and less complex.
      else use this with fun......

      
      
      
      #define MY_RADIO_NRF24
      #define MY_REPEATER_FEATURE
      #define MY_DEBUG
      
      #include <Wire.h>        // Wire library t.b.v. I²C
      #include <MySensors.h>
      
      byte GPIOA  = 0x12;      // GPIOA adres in 16-bit mode, is directe aansturing 1e groep van 8 I/O poorten.
      byte GPIOB  = 0x13;      // GPIOA adres in 16-bit mode, is directe aansturing 1e groep van 8 I/O poorten.
      
      boolean sensorBovenActive;    // Status of Pir motion sensor 2.
      boolean sensorOnderActive;    // Status of Pir motion sensor 1.
      boolean sensorKelderActive;    // Status of Pir motion sensor 0.
      
      int PIR0new;      // Pir motion sensor 0 updated value "Kelder".
      int PIR0old;      // Pir motion sensor 0 old value "Kelder".
      int PIR1new;      // Pir motion sensor 1 updated value "sensorOnderActive".
      int PIR1old;      // Pir motion sensor 1 old value "sensorOnderActive".
      int PIR2new;      // Pir motion sensor 2 updated value. "sensorBovenActive"
      int PIR2old;      // Pir motion sensor 2 old value. sensorBovenActive"
      
      int StairDelay = 250; // Delay for stairs
      int StairOn = 30000; // Delay to keep stair light on
      
      #define MY_NODE_ID 30
      #define CHILD_ID_PIR00 31   // Id of the sensor child
      #define CHILD_ID_PIR01 32   // Id of the sensor child
      #define CHILD_ID_PIR02 33   // Id of the sensor child
      
      void presentation(){
      // Send the sketch version information to the gateway and Controller
        sendSketchInfo("Trap Controller", "4.0");
      
      // Register all sensors to gw (they will be created as child devices)
        present(CHILD_ID_PIR00, S_MOTION, "PIR Sensor Kelder");
        present(CHILD_ID_PIR01, S_MOTION, "PIR Sensor Trap Onder");
        present(CHILD_ID_PIR02, S_MOTION, "PIR Sensor Trap Boven");
      } 
      
      // Initialize motion message
       MyMessage msgPIR00(CHILD_ID_PIR00, V_TRIPPED);
       MyMessage msgPIR01(CHILD_ID_PIR01, V_TRIPPED);
       MyMessage msgPIR02(CHILD_ID_PIR02, V_TRIPPED);
      
      // the setup routine runs once when you press reset:
      void setup() {
        
       Wire.begin(); // wake up I2C bus 
       // set I/O pins to outputs
       Wire.beginTransmission(0x20); // Start adress of mcp23017
       Wire.write(0x00); // IODIRA register
       Wire.write(0x00); // set all of port A to outputs
       Wire.endTransmission();
       Wire.beginTransmission(0x20);
       Wire.write(0x01); // IODIRB register
       Wire.write(0x00); // set all of port B to outputs
       Wire.endTransmission();
      }
      
      // the loop routine runs over and over again forever:
      void loop() {
       Pir0lezen();
       Pir1lezen();
       Pir2lezen();
       effneerop();
       effopneer();
       effKelder();
      }
      
      void Pir0lezen() {
        int PIR0new = analogRead(A0);
        if (PIR0new >=900) {
        sensorKelderActive = true;
        // Send status to Domoticz
        send (msgPIR00.set(sensorKelderActive?"1":"0"));
        Serial.println("PIR0new----");
        Serial.println(PIR0new);
        PIR0old = PIR0new;
        sensorKelderActive = false;
        send (msgPIR00.set(sensorKelderActive));
      }}
      
      void Pir1lezen() {
        int PIR1new = analogRead(A1);
        if (PIR1new != PIR1old && PIR1new >=710) {
        sensorOnderActive = true ;
        sensorBovenActive = false ;
        // Send status to Domoticz
        send (msgPIR01.set(sensorOnderActive?"1":"0"));
        Serial.println("PIR1----");
        Serial.println(PIR1new);
        PIR1old = PIR1new;
        
      }}
      
      void Pir2lezen() {
        int PIR2new = analogRead(A2);
        if (PIR2new != PIR2old && PIR2new >=710) {
        sensorBovenActive = true ;
        sensorOnderActive = false ;
        // Send status to Domoticz
        send (msgPIR02.set(sensorBovenActive?"1":"0"));
        Serial.println("PIR2----");
        Serial.println(PIR2new);
        PIR2old = PIR2new;
        
      }}
      
      void effopneer() {
          if (sensorOnderActive==true && sensorBovenActive==false){
          Serial.println("PIR1--aan");
          sensorOnderActive = false ;  
          setLEDA(B01111111);  // Tree 1
          delay(StairDelay); 
          setLEDA(B00111111);  // Tree 2
          delay(StairDelay); 
          setLEDA(B00011111);  // Tree 3
          delay(StairDelay); 
          setLEDA(B00001111);  // Tree 4
          delay(StairDelay); 
          setLEDA(B00000111);  // Tree 5
          delay(StairDelay); 
          setLEDA(B00000011);  // Tree 6
          delay(StairDelay); 
          setLEDA(B00000001);  // Tree 7
          delay(StairDelay); 
          setLEDA(B00000000);  // Tree 8
          delay(StairDelay); 
          setLEDB(B01111111);  // Tree 9
          delay(StairDelay); 
          setLEDB(B00111111);  // Tree 10
          delay(StairDelay); 
          setLEDB(B00011111);  // Tree 11
          delay(StairDelay); 
          setLEDB(B00001111);  // Tree 12
          delay(StairDelay); 
          setLEDB(B00000111);  // Tree 13
          delay(StairDelay); 
          setLEDB(B00000011);  // Tree 14
          send (msgPIR01.set(sensorOnderActive)); // switch off before delay
          delay(StairOn); 
          setLEDA(B11111111);  // all off
          setLEDB(B11111111);  // all off
          Serial.println("PIR1--uit");
      }}
      
      void effneerop() {
        if (sensorOnderActive==false && sensorBovenActive==true){
          Serial.println("PIR2--aan");
          sensorBovenActive = false ;
          setLEDB(B11111011);  // Tree 14
          delay(StairDelay); 
          setLEDB(B11110011);  // Tree 13
          delay(StairDelay); 
          setLEDB(B11100011);  // Tree 12
          delay(StairDelay); 
          setLEDB(B11000011);  // Tree 11
          delay(StairDelay); 
          setLEDB(B10000111);  // Tree 10
          delay(StairDelay); 
          setLEDB(B00000011);  // Tree 9
          delay(StairDelay); 
          setLEDA(B11111110);  // Tree 8
          delay(StairDelay); 
          setLEDA(B11111100);  // Tree 7
          delay(StairDelay); 
          setLEDA(B11111000);  // Tree 6
          delay(StairDelay); 
          setLEDA(B11110000);  // Tree 5
          delay(StairDelay); 
          setLEDA(B11100000);  // Tree 4
          delay(StairDelay); 
          setLEDA(B11000000);  // Tree 3
          delay(StairDelay); 
          setLEDA(B10000000);  // Tree 2
          delay(StairDelay); 
          setLEDA(B00000000);  // Tree 1
          send (msgPIR02.set(sensorBovenActive));
          delay(StairOn); 
          setLEDA(B11111111);  // all off
          setLEDB(B11111111);  // all off
          Serial.println("PIR2--uit");
      }}
      
      void effKelder() {
      }
      
      void setLEDA(byte value)
      {
      
       Wire.beginTransmission(0x20);
       Wire.write(GPIOA);                            // gpioa
       Wire.write(byte(value));                      // set LEDs volgens waarde 'value'
       Wire.endTransmission();
      }
      
      void setLEDB(byte value)
      {
      
       Wire.beginTransmission(0x20);
       Wire.write(GPIOB);                            // gpiob
       Wire.write(byte(value));                      // set LEDs volgens waarde 'value'
       Wire.endTransmission();
      }
      
      void bonuseff() {
        
          setLEDB(B11111011);  // Tree 14
          delay(StairDelay); 
          setLEDB(B11110111);  // Tree 13
          delay(StairDelay); 
          setLEDB(B11101111);  // Tree 12
          delay(StairDelay); 
          setLEDB(B11011111);  // Tree 11
          delay(StairDelay); 
          setLEDB(B10111111);  // Tree 10
          delay(StairDelay); 
          setLEDB(B01111111);  // Tree 9
          delay(StairDelay); 
          setLEDA(B11111110);  // Tree 8
          delay(StairDelay); 
          setLEDA(B11111101);  // Tree 7
          delay(StairDelay); ;
          setLEDA(B11111011);  // Tree 6
          delay(StairDelay); ;
          setLEDA(B11110111);  // Tree 5
          delay(StairDelay); 
          setLEDA(B11101111);  // Tree 4
          delay(StairDelay); 
          setLEDA(B11011111);  // Tree 3
          delay(StairDelay); 
          setLEDB(B10111110);  // Tree 2
          delay(StairDelay); 
          setLEDB(B01111111);  // Tree 1
          delay(StairDelay); 
          setLEDA(B10111111);  // Tree 2
          delay(StairDelay); 
          setLEDA(B11011111);  // Tree 3
          delay(StairDelay); 
          setLEDA(B11101111);  // Tree 4
          delay(StairDelay); 
          setLEDA(B11110111);  // Tree 5
          delay(StairDelay); 
          setLEDA(B11111011);  // Tree 6
          delay(StairDelay); 
          setLEDA(B11111101);  // Tree 7
          delay(StairDelay); 
          setLEDA(B11111110);  // Tree 8
          delay(StairDelay); 
          setLEDB(B01111111);  // Tree 9
          delay(StairDelay); 
          setLEDB(B10111111);  // Tree 10
          delay(StairDelay); 
          setLEDB(B11011111);  // Tree 11
          delay(StairDelay); 
          setLEDB(B11101111);  // Tree 12
          delay(StairDelay); 
          setLEDB(B11110111);  // Tree 13
          delay(StairDelay); 
          setLEDB(B11111011);  // Tree 14
      }```
      posted in Troubleshooting
      Rene046
    • RE: Analog to digital how ?

      @mfalkvidd

      Thx

      I already got it running after a long night ...lol

      here is what i have sofar...

      #define MY_RADIO_NRF24
      #define MY_REPEATER_FEATURE
      #define MY_DEBUG
      //#include <SPI.h>
      #include <MySensors.h>
      boolean sensorUpperActive;
      // boolean sensorBottomActive;
      int sensorBottomActive;
      int PIR1new;
      int PIR1old;
      int PIR2new;
      int PIR2old;
      
      boolean PIR00;
      #define MY_NODE_ID 30
      #define CHILD_ID_PIR00 31   // Id of the sensor child
      #define CHILD_ID_PIR01 32   // Id of the sensor child
      #define CHILD_ID_PIR02 33   // Id of the sensor child
      
      void presentation()
      {
      // Send the sketch version information to the gateway and Controller
        sendSketchInfo("PIR Sensor", "4.0");
      
      // Register all sensors to gw (they will be created as child devices)
        present(CHILD_ID_PIR00, S_MOTION, "PIR Sensor 0");
        present(CHILD_ID_PIR01, S_MOTION, "PIR Sensor 1");
        present(CHILD_ID_PIR02, S_MOTION, "PIR Sensor 2");
       
       }
      // Initialize motion message
       MyMessage msgPIR00(CHILD_ID_PIR00, V_TRIPPED);
       MyMessage msgPIR01(CHILD_ID_PIR01, V_TRIPPED);
       MyMessage msgPIR02(CHILD_ID_PIR02, V_TRIPPED);
      
      // the setup routine runs once when you press reset:
      void setup() {
        // initialize serial communication at 9600 bits per second:
      //  Serial.begin(9600);
        pinMode(LED_BUILTIN, OUTPUT);
      
      }
      
      // the loop routine runs over and over again forever:
      void loop() {
       Pir0lezen();
       
       Pir1lezen();
       Pir2lezen();
       effopneer();
       effneerop();
       Tegelijk();
       
      //  delay(1000);        // delay in between reads for stability
      }
      
      void Pir0lezen() {
        int PIR0 = analogRead(A0);
        if (analogRead(A0) >=700) 
        {
        Serial.println("PIR0----");
        Serial.println(PIR0);
        PIR00 = true;
      }}
      
      void Pir1lezen() {
        int PIR1new = analogRead(A1);
        if (PIR1new != PIR1old && PIR1new >=700) {
        sensorBottomActive = true ;
        send (msgPIR01.set(sensorBottomActive?"1":"0"));
        // Send status to Domoticz
        Serial.println("PIR1----");
        Serial.println(PIR1new);
        PIR1old = PIR1new;
      }}
      
      void Pir2lezen() {
        int PIR2new = analogRead(A2);
        if (PIR2new != PIR2old && PIR2new >=700) {
        sensorUpperActive = true ;
        send (msgPIR02.set(sensorUpperActive?"1":"0"));
        // Send status to Domoticz
        Serial.println("PIR2----");
        Serial.println(PIR2new);
        PIR2old = PIR2new;
       }
      }
      
      void effopneer() {
        if (sensorBottomActive==true && sensorUpperActive==false){
        // do something
        digitalWrite(LED_BUILTIN, HIGH);   // turn the LED on (HIGH is the voltage level)
        delay(100);                       // wait for a second
        digitalWrite(LED_BUILTIN, LOW);    // turn the LED off by making the voltage LOW
        sensorBottomActive = false ;  
        send (msgPIR01.set(sensorBottomActive));
        Serial.println("PIR1--uit");
        }
      }
      
      void effneerop() {
        if (sensorBottomActive==false && sensorUpperActive==true){
        digitalWrite(LED_BUILTIN, HIGH);   // turn the LED on (HIGH is the voltage level)
        delay(500);                       // wait for a second
        digitalWrite(LED_BUILTIN, LOW);    // turn the LED off by making the voltage LOW
        sensorUpperActive = false ;  
        send (msgPIR02.set(sensorUpperActive));
        Serial.println("PIR2--uit");
        }
      }
      
      void  Tegelijk() {
        if (sensorBottomActive==true && sensorUpperActive==true){
        digitalWrite(LED_BUILTIN, HIGH);   // turn the LED on (HIGH is the voltage level)
        delay(5000);                       // wait for a second
        digitalWrite(LED_BUILTIN, LOW);    // turn the LED off by making the voltage LOW
        sensorUpperActive = false ; 
        sensorBottomActive = false ;  
        send (msgPIR01.set(sensorUpperActive));
        send (msgPIR01.set(sensorBottomActive));
        Serial.println("PIR1&2--uit");
      }
      }
      
      posted in Troubleshooting
      Rene046
    • RE: Analog to digital how ?
      #define MY_RADIO_NRF24
      #define MY_REPEATER_FEATURE
      #define MY_DEBUG
      //#include <SPI.h>
      #include <MySensors.h>
      boolean sensorUpperActive;
      boolean sensorBottomActive;
      boolean PIR00;
      #define MY_NODE_ID 30
      #define CHILD_ID_PIR00 31   // Id of the sensor child
      #define CHILD_ID_PIR01 32   // Id of the sensor child
      #define CHILD_ID_PIR02 33   // Id of the sensor child
      
      void presentation()
      {
      // Send the sketch version information to the gateway and Controller
        sendSketchInfo("PIR Sensor", "4.0");
      
      // Register all sensors to gw (they will be created as child devices)
        present(CHILD_ID_PIR00, S_MOTION, "PIR Sensor 0");
        present(CHILD_ID_PIR01, S_MOTION, "PIR Sensor 1");
        present(CHILD_ID_PIR02, S_MOTION, "PIR Sensor 2");
       
       }
      // Initialize motion message
       MyMessage msgPIR00(CHILD_ID_PIR00, V_TRIPPED);
       MyMessage msgPIR01(CHILD_ID_PIR01, V_TRIPPED);
       MyMessage msgPIR02(CHILD_ID_PIR02, V_TRIPPED);
      
      // the setup routine runs once when you press reset:
      void setup() {
        // initialize serial communication at 9600 bits per second:
      //  Serial.begin(9600);
        pinMode(LED_BUILTIN, OUTPUT);
      
      }
      
      // the loop routine runs over and over again forever:
      void loop() {
       Pir0lezen();
       Pir1lezen();
       Pir2lezen();
       effopneer();
       effneerop();
       Tegelijk();
       
      //  delay(1000);        // delay in between reads for stability
      }
      
      void Pir0lezen() {
        int PIR0 = analogRead(A0);
        if (analogRead(A0) >=700) 
        {
        Serial.println("PIR0----");
        Serial.println(PIR0);
        PIR00 = true;
        // Send status to Domoticz
      }}
      
      
      void Pir1lezen() {
        int PIR1 = analogRead(A1);
        if (analogRead(A1) >=700) {
        sensorBottomActive = true;
        // Send status to Domoticz
        Serial.println("PIR1----");
        Serial.println(PIR1);
         
      }}
      
      void Pir2lezen() {
        int PIR2 = analogRead(A2);
        if (analogRead(A2) >=700) {
        sensorUpperActive = true;
        // Send status to Domoticz
        Serial.println("PIR2----");
        Serial.println(PIR2);
        
      }}
      
      void effopneer() {
        if (sensorBottomActive==true && sensorUpperActive==false){
        // do something
        digitalWrite(LED_BUILTIN, HIGH);   // turn the LED on (HIGH is the voltage level)
        delay(100);                       // wait for a second
        digitalWrite(LED_BUILTIN, LOW);    // turn the LED off by making the voltage LOW
        sensorBottomActive = false ;  
        Serial.println("PIR1--uit");
        }
      }
      
      void effneerop() {
        if (sensorBottomActive==false && sensorUpperActive==true){
        digitalWrite(LED_BUILTIN, HIGH);   // turn the LED on (HIGH is the voltage level)
        delay(500);                       // wait for a second
        digitalWrite(LED_BUILTIN, LOW);    // turn the LED off by making the voltage LOW
        sensorUpperActive = false ;  
        Serial.println("PIR2--uit");
        }
      }
      
      void  Tegelijk() {
        if (sensorBottomActive==true && sensorUpperActive==true){
        digitalWrite(LED_BUILTIN, HIGH);   // turn the LED on (HIGH is the voltage level)
        delay(5000);                       // wait for a second
        digitalWrite(LED_BUILTIN, LOW);    // turn the LED off by making the voltage LOW
        sensorUpperActive = false ; 
        sensorBottomActive = false ;  
        Serial.println("PIR1&2--uit");
      }
      }
      
      posted in Troubleshooting
      Rene046
    • Analog to digital how ?

      Hi there,

      I would like to know what and where i have to look for.

      I reading with my nano 328 port A0, A1, A2 voltage from "3" motion senors
      and get a specific value >700
      if one of those ports gets above this 700
      I would like to send this true mysensors as an normal motion sensor normal true trigger
      but im not using any interrupt
      How do i send this ?

      if (analogRead(A0) >=700)
      {
      send(msgmotion0.set(tripped0?"1":"0"));

      and for the others.
      send(msgmotion0.set(tripped0?"1":"0"));
      send(msgmotion1.set(tripped1?"1":"0"));
      send(msgmotion3.set(tripped3?"1":"0"));

      posted in Troubleshooting
      Rene046
    • RE: Double Pir sensors

      thx.

      Aha i missed those

      sketch is accepted, waiting for second pir sensor to test in real time.

      thx again learned something new again...
      Starting to have fun with Mysensors ...

      For other users who like to try.

      /**
       * The MySensors Arduino library handles the wireless radio link and protocol
       * between your home built sensors/actuators and HA controller of choice.
       * The sensors forms a self healing radio network with optional repeaters. Each
       * repeater and gateway builds a routing tables in EEPROM which keeps track of the
       * network topology allowing messages to be routed to nodes.
       *
       * Created by Henrik Ekblad <henrik.ekblad@mysensors.org>
       * Copyright (C) 2013-2015 Sensnology AB
       * Full contributor list: https://github.com/mysensors/Arduino/graphs/contributors
       *
       * Documentation: http://www.mysensors.org
       * Support Forum: http://forum.mysensors.org
       *
       * This program is free software; you can redistribute it and/or
       * modify it under the terms of the GNU General Public License
       * version 2 as published by the Free Software Foundation.
       *
       *******************************
       *
       * REVISION HISTORY
       * Version 1.0 - Henrik Ekblad
       *
       * DESCRIPTION
       * Motion Sensor example using HC-SR501
       * http://www.mysensors.org/build/motion
       *
       */
      
      // Enable debug prints
      // #define MY_DEBUG
      
      // Enable and select radio type attached
      #define MY_RADIO_NRF24
      //#define MY_RADIO_RFM69
      
      #include <MySensors.h>
      #define MY_NODE_ID 9
      unsigned long SLEEP_TIME = 5000 ; // 120000 Sleep time between reports (in milliseconds)
      #define DIGITAL_INPUT_SENSOR1 2   // The digital input you attached your motion sensor.  (Only 2 and 3 generates interrupt!)
      #define DIGITAL_INPUT_SENSOR2 3   // The digital input you attached your motion sensor.  (Only 2 and 3 generates interrupt!)
      
      #define CHILD_ID_PIR1 21   // Id of the sensor child
      #define CHILD_ID_PIR2 22   // Id of the sensor child
      
      // Enable repeater functionality for this node
      #define MY_REPEATER_FEATURE
      
      // Initialize motion message
      MyMessage msg1(CHILD_ID_PIR1, V_TRIPPED);
      MyMessage msg2(CHILD_ID_PIR2, V_TRIPPED);
      
      void setup()
      {
      	pinMode(DIGITAL_INPUT_SENSOR1, INPUT);      // sets the motion sensor digital pin as input
        pinMode(DIGITAL_INPUT_SENSOR2, INPUT);      // sets the motion sensor digital pin as input
       }
      
      void presentation()
      {
      	// Send the sketch version information to the gateway and Controller
      	sendSketchInfo("PIR Sensor", "3.0");
      
      	// Register all sensors to gw (they will be created as child devices)
      	present(CHILD_ID_PIR1, S_MOTION);
        present(CHILD_ID_PIR2, S_MOTION);
      }
      
      void loop()
      {
      	// Read digital motion value
      	bool tripped = digitalRead(DIGITAL_INPUT_SENSOR1) == HIGH;
        bool tripped2 = digitalRead(DIGITAL_INPUT_SENSOR2) == HIGH;
       
      	Serial.println(tripped);
      	send(msg1.set(tripped?"1":"0"));  // Send tripped value to gw
        
        Serial.println(tripped2);
        send(msg2.set(tripped2?"1":"0"));  // Send tripped value to gw
      	
      	// Sleep until interrupt comes in on motion sensor. Send update every two minute.
      	sleep(digitalPinToInterrupt(DIGITAL_INPUT_SENSOR1), CHANGE, (DIGITAL_INPUT_SENSOR2), CHANGE, SLEEP_TIME);
      }
      
      
      posted in Troubleshooting
      Rene046
    • RE: Double Pir sensors

      thx for helping with last problem
      only problem left is with why
      MyMessage msg(CHILD_ID_PIR2, V_TRIPPED);
      is not accepted.

      /**
       * The MySensors Arduino library handles the wireless radio link and protocol
       * between your home built sensors/actuators and HA controller of choice.
       * The sensors forms a self healing radio network with optional repeaters. Each
       * repeater and gateway builds a routing tables in EEPROM which keeps track of the
       * network topology allowing messages to be routed to nodes.
       *
       * Created by Henrik Ekblad <henrik.ekblad@mysensors.org>
       * Copyright (C) 2013-2015 Sensnology AB
       * Full contributor list: https://github.com/mysensors/Arduino/graphs/contributors
       *
       * Documentation: http://www.mysensors.org
       * Support Forum: http://forum.mysensors.org
       *
       * This program is free software; you can redistribute it and/or
       * modify it under the terms of the GNU General Public License
       * version 2 as published by the Free Software Foundation.
       *
       *******************************
       *
       * REVISION HISTORY
       * Version 1.0 - Henrik Ekblad
       *
       * DESCRIPTION
       * Motion Sensor example using HC-SR501
       * http://www.mysensors.org/build/motion
       *
       */
      
      // Enable debug prints
      // #define MY_DEBUG
      
      // Enable and select radio type attached
      #define MY_RADIO_NRF24
      //#define MY_RADIO_RFM69
      
      #include <MySensors.h>
      #define MY_NODE_ID 9
      unsigned long SLEEP_TIME = 5000 ; // 120000 Sleep time between reports (in milliseconds)
      #define DIGITAL_INPUT_SENSOR1 2   // The digital input you attached your motion sensor.  (Only 2 and 3 generates interrupt!)
      #define DIGITAL_INPUT_SENSOR2 3   // The digital input you attached your motion sensor.  (Only 2 and 3 generates interrupt!)
      
      #define CHILD_ID_PIR1 21   // Id of the sensor child
      #define CHILD_ID_PIR2 22   // Id of the sensor child
      
      // Enable repeater functionality for this node
      #define MY_REPEATER_FEATURE
      
      // Initialize motion message
      MyMessage msg(CHILD_ID_PIR1, V_TRIPPED);
      MyMessage msg(CHILD_ID_PIR2, V_TRIPPED);
      
      void setup()
      {
      	pinMode(DIGITAL_INPUT_SENSOR1, INPUT);      // sets the motion sensor digital pin as input
        pinMode(DIGITAL_INPUT_SENSOR2, INPUT);      // sets the motion sensor digital pin as input
       }
      
      void presentation()
      {
      	// Send the sketch version information to the gateway and Controller
      	sendSketchInfo("PIR Sensor", "3.0");
      
      	// Register all sensors to gw (they will be created as child devices)
      	present(CHILD_ID_PIR1, S_MOTION);
        present(CHILD_ID_PIR2, S_MOTION);
      }
      
      void loop()
      {
      	// Read digital motion value
      	bool tripped = digitalRead(DIGITAL_INPUT_SENSOR1) == HIGH;
        bool tripped2 = digitalRead(DIGITAL_INPUT_SENSOR2) == HIGH;
       
      	Serial.println(tripped);
      	send(msg.set(tripped?"1":"0"));  // Send tripped value to gw
        
        Serial.println(tripped2);
        send(msg.set(tripped2?"1":"0"));  // Send tripped value to gw
      	
      	// Sleep until interrupt comes in on motion sensor. Send update every two minute.
      	sleep(digitalPinToInterrupt(DIGITAL_INPUT_SENSOR1), CHANGE, (DIGITAL_INPUT_SENSOR2), CHANGE, SLEEP_TIME);
      }
      
      
      posted in Troubleshooting
      Rene046
    • Double Pir sensors

      Hi there i could use some help, i tried to expand the mysensors motion sketch but i would like to use 2 pir sensors.

      I changed the sketch and get a strange message;
      #define digitalPinToInterrupt(p) ((p) == 2 ? 0 : ((p) == 3 ? 1 : NOT_AN_INTERRUPT))

                                       ^
      

      exit status 1
      redefinition of 'MyMessage msg'

      i thought nr 2 and 3 are with interrupt.

      Than i think i'll have to change:
      // Sleep until interrupt comes in on motion sensor. Send update every two minute.
      sleep(digitalPinToInterrupt(DIGITAL_INPUT_SENSOR), CHANGE, SLEEP_TIME);

      Well maybe someone have some time to help me.

      /**
       * The MySensors Arduino library handles the wireless radio link and protocol
       * between your home built sensors/actuators and HA controller of choice.
       * The sensors forms a self healing radio network with optional repeaters. Each
       * repeater and gateway builds a routing tables in EEPROM which keeps track of the
       * network topology allowing messages to be routed to nodes.
       *
       * Created by Henrik Ekblad <henrik.ekblad@mysensors.org>
       * Copyright (C) 2013-2015 Sensnology AB
       * Full contributor list: https://github.com/mysensors/Arduino/graphs/contributors
       *
       * Documentation: http://www.mysensors.org
       * Support Forum: http://forum.mysensors.org
       *
       * This program is free software; you can redistribute it and/or
       * modify it under the terms of the GNU General Public License
       * version 2 as published by the Free Software Foundation.
       *
       *******************************
       *
       * REVISION HISTORY
       * Version 1.0 - Henrik Ekblad
       *
       * DESCRIPTION
       * Motion Sensor example using HC-SR501
       * http://www.mysensors.org/build/motion
       *
       */
      
      // Enable debug prints
      // #define MY_DEBUG
      
      // Enable and select radio type attached
      #define MY_RADIO_NRF24
      //#define MY_RADIO_RFM69
      
      #include <MySensors.h>
      #define MY_NODE_ID 9
      unsigned long SLEEP_TIME = 5000 ; // 120000 Sleep time between reports (in milliseconds)
      #define DIGITAL_INPUT_SENSOR1 2   // The digital input you attached your motion sensor.  (Only 2 and 3 generates interrupt!)
      #define DIGITAL_INPUT_SENSOR2 3   // The digital input you attached your motion sensor.  (Only 2 and 3 generates interrupt!)
      
      #define CHILD_ID_PIR1 21   // Id of the sensor child
      #define CHILD_ID_PIR2 22   // Id of the sensor child
      
      // Enable repeater functionality for this node
      #define MY_REPEATER_FEATURE
      
      // Initialize motion message
      MyMessage msg(CHILD_ID_PIR1, V_TRIPPED);
      MyMessage msg(CHILD_ID_PIR2, V_TRIPPED);
      
      void setup()
      {
      	pinMode(DIGITAL_INPUT_SENSOR1, INPUT);      // sets the motion sensor digital pin as input
        pinMode(DIGITAL_INPUT_SENSOR2, INPUT);      // sets the motion sensor digital pin as input
       }
      
      void presentation()
      {
      	// Send the sketch version information to the gateway and Controller
      	sendSketchInfo("PIR Sensor", "3.0");
      
      	// Register all sensors to gw (they will be created as child devices)
      	present(CHILD_ID_PIR1, S_MOTION);
        present(CHILD_ID_PIR2, S_MOTION);
      }
      
      void loop()
      {
      	// Read digital motion value
      	bool tripped = digitalRead(DIGITAL_INPUT_SENSOR1) == HIGH;
        bool tripped2 = digitalRead(DIGITAL_INPUT_SENSOR2) == HIGH;
       
      	Serial.println(tripped);
      	send(msg.set(tripped?"1":"0"));  // Send tripped value to gw
        
        Serial.println(tripped2);
        send(msg.set(tripped2?"1":"0"));  // Send tripped value to gw
      	
      	// Sleep until interrupt comes in on motion sensor. Send update every two minute.
      	sleep(digitalPinToInterrupt(DIGITAL_INPUT_SENSOR), CHANGE, SLEEP_TIME);
      }
      
      
      posted in Troubleshooting
      Rene046