Navigation

    • Register
    • Login
    • OpenHardware.io
    • Categories
    • Recent
    • Tags
    • Popular
    1. Home
    2. edsteve
    3. Posts
    • Profile
    • Following
    • Followers
    • Topics
    • Posts
    • Best
    • Groups

    Posts made by edsteve

    • RE: MOSFET as relay to keep ESP on until GPIO is low

      Thx for the link.
      For more info about the solution in this video perfectly explained:
      #101 Long lasting DIY "Amazon Dash Button" using an ESP8266 – 06:36
      — Andreas Spiess

      He uses a NDP6020 for Mosfet. The datasheet says:
      Vgs(th) (Max) @ id: 1V @250uA
      Gate Charge (Qg) @ Vgs:35nC @ 5V

      Is 1V the max i can connect to the Gate? That can't be true!?

      posted in Hardware
      edsteve
      edsteve
    • RE: MOSFET as relay to keep ESP on until GPIO is low

      @kimot
      Do you have a common P-Channel Mosfet in mind which works for this project? I am struggling finding the right one.

      posted in Hardware
      edsteve
      edsteve
    • RE: MOSFET as relay to keep ESP on until GPIO is low

      Hmm... it worked for a while with the 10K resistor but now not any more.
      I guess i have to change the Mosfet to a P-Channel version.

      posted in Hardware
      edsteve
      edsteve
    • RE: MOSFET as relay to keep ESP on until GPIO is low

      Thanks. I understand that my MOSFET is not the best choice. But that's the only one i have here right now.

      The 10K resistor solved my problem. Works great. Thanks for the tip.

      posted in Hardware
      edsteve
      edsteve
    • MOSFET as relay to keep ESP on until GPIO is low

      Hi,

      Aim:
      When a door contact reed switch is triggered it should turn ON the Wemos D1, send some data to IFTTT and turn itself OFF after that.

      Function:
      So the Wemos D1 is OFF all the time (to save battery) till the reed switch (SW) turns on the Wemos D1. When the Wemos is ON it triggers the MOSFET by setting GPIO5 to HIGH and keeps itself alive (even without the reed switch) until GIOP5 is set to LOW which turns off the Wemos.

      Problems:
      But i get strange behavior. In general it works. But after the GPIO is set to LOW the hole thing still draws 0,03Amps. And sometimes it draws 0.1Amps and i have no idea why.

      Did i use the right parts? Should i add a resistor somewhere?

      Here is my code (which only explains the function) and some schematics.

      int SWITCH = 5;
      
      void setup() {
      
        pinMode(SWITCH, OUTPUT);
        digitalWrite(SWITCH, HIGH);   // Trigger the MOSFET to stay ON
      
        // Do stuff.... for example send data to IFTT with the ESP8266_To_IFTTT 
      
        digitalWrite(SWITCH, LOW);    // Turn off the Wemos D1
      }
      
      // the loop function runs over and over again forever
      void loop() {
      yield();                      // do nothing
      }
      

      alt text

      posted in Hardware
      edsteve
      edsteve
    • RE: Domoticz V_TEXT sensor now bidirectional

      Thanks. Found it.

      posted in Domoticz
      edsteve
      edsteve
    • RE: Domoticz V_TEXT sensor now bidirectional

      Hey,

      yes. I think that has to do with this error i am getting since i updated Domoticz:

      2018-07-07 10:56:10.962 Error: MySensors: Text update received for unknown node_id: 2, child_id: 87
      2018-07-07 10:56:12.638 Error: MySensors: Text update received for unknown node_id: 2, child_id: 87
      2018-07-07 10:56:14.307 Error: MySensors: Text update received for unknown node_id: 2, child_id: 87
      2018-07-07 11:06:06.240 Error: MySensors: Text update received for unknown node_id: 2, child_id: 87
      2018-07-07 11:06:08.005 Error: MySensors: Text update received for unknown node_id: 2, child_id: 87
      2018-07-07 11:06:09.660 Error: MySensors: Text update received for unknown node_id: 2, child_id: 87
      2018-07-07 11:16:01.821 Error: MySensors: Text update received for unknown node_id: 2, child_id: 87
      2018-07-07 11:16:03.607 Error: MySensors: Text update received for unknown node_id: 2, child_id: 87
      2018-07-07 11:16:05.250 Error: MySensors: Text update received for unknown node_id: 2, child_id: 87
      2018-07-07 11:25:54.471 Error: MySensors: Text update received for unknown node_id: 2, child_id: 87
      2018-07-07 11:25:56.130 Error: MySensors: Text update received for unknown node_id: 2, child_id: 87
      2018-07-07 11:25:57.782 Error: MySensors: Text update received for unknown node_id: 2, child_id: 87
      2018-07-07 11:35:51.868 Error: MySensors: Text update received for unknown node_id: 2, child_id: 87
      2018-07-07 11:35:53.537 Error: MySensors: Text update received for unknown node_id: 2, child_id: 87
      2018-07-07 11:35:55.196 Error: MySensors: Text update received for unknown node_id: 2, child_id: 87
      2018-07-07 11:45:47.051 Error: MySensors: Text update received for unknown node_id: 2, child_id: 87
      2018-07-07 11:45:48.865 Error: MySensors: Text update received for unknown node_id: 2, child_id: 87
      2018-07-07 11:45:50.579 Error: MySensors: Text update received for unknown node_id: 2, child_id: 87
      2018-07-07 11:55:47.429 Error: MySensors: Text update received for unknown node_id: 2, child_id: 87
      2018-07-07 11:55:49.137 Error: MySensors: Text update received for unknown node_id: 2, child_id: 87
      2018-07-07 11:55:50.788 Error: MySensors: Text update received for unknown node_id: 2, child_id: 87
      

      I don't know which sensor is involved with that Error.
      How do i debug that if i don't know my node-ID's? 😉

      posted in Domoticz
      edsteve
      edsteve
    • RE: HC-SR04 (Distance) only sends data with connected serial converter?

      Thanks for your reply.
      I was dealing with it for 3 hours now. Grml. But as usual i figured it out right after this post. The trigger pin was connected to the wrong Arduino pin (4 instead of 6). Of course i didin't check it, because it still worked with connected serial converter. How strange.

      So i guess this post can be deleted due to waste of space.

      Cheeers
      ED

      posted in Troubleshooting
      edsteve
      edsteve
    • HC-SR04 (Distance) only sends data with connected serial converter?

      Hallo,

      Hardware:
      i have an Arduino pro mini 5V connected to a HC-SR04 sensor and using the standard mysensors code unchanged. It runs on a 3,7V battery with a stepUp Buck converter to 5V (LM2596) which i use in many projects. The data is sent via NRF24L01+ which has it's own converter.

      It works flawless when the USB to Serial adapter (FT232BL) is connected. Every 5 seconds a reading.
      But when i let the sensor "run by itself" i can see that the sensor gets registered in Domoticz, but Domoticz does not receive any data. When i plug in the serial converter. Domoticz gets all the data as it should be.

      I also unplugged the power wires from the serial converter to see if it is a power issue. But same result.
      I do actually get a reading sometimes. Maybe every 2 minutes or so instead of every 5 seconds. But even that has the wrong values (always 0cm)

      Drives me crazy. What is that?

      Thx for thinking with me
      ED

      posted in Troubleshooting
      edsteve
      edsteve
    • RE: Battery status does not show in Domoticz

      Sorry guys. Not at home lately. I will report if and what solved my problem when i am back.

      posted in Domoticz
      edsteve
      edsteve
    • RE: Battery status does not show in Domoticz

      @gohan
      I also have that info from the domoticz forum and i tried it. Tailing the new log file... still no more details. I give up...
      Maaaybe... when i have motivation again i will try to read about @sunberg84 solution. But i am just not a linux expert.

      Grml... never like it to live with an unsolved problem. But thx for the effort everyone.

      Here is the link to the domoticz forum about the logging problem

      posted in Domoticz
      edsteve
      edsteve
    • RE: Battery status does not show in Domoticz

      That's another question i have since a while now:
      How can i change the domoticz log to more debugging details? Hard to find that information. I can't find any values in the standard-log.

      posted in Domoticz
      edsteve
      edsteve
    • RE: Battery status does not show in Domoticz

      Thanks for replies.
      Yes it can handle out of range. My weather sensor works just fine with 120% 🙂

      Where would you start digging for the reason? A log file I can check?

      posted in Domoticz
      edsteve
      edsteve
    • Battery status does not show in Domoticz

      Hi,

      i was on the way building a relay node with battery status report. The Node sends the data as you can see from the serial monitor:

      Incoming change for sensor:1, New status: 1
      TSP:MSG:READ 0-0-5 s=1,c=1,t=2,pt=0,l=1,sg=0:0
      Incoming change for sensor:1, New status: 0
      Battery voltage: 4137 mV
      Battery percent: 104 %
      TSP:MSG:SEND 5-5-0-0 s=255,c=3,t=0,pt=1,l=1,sg=0,ft=0,st=ok:104
      TSP:SANCHK:OK
      

      But it does not show in Domoticz:
      0_1499628978651_Capture.PNG

      This is my sensor sketch:

      // Enable debug prints to serial monitor
      #define MY_DEBUG
      
      // Enable and select radio type attached
      #define MY_RADIO_NRF24
      //#define MY_RADIO_RFM69
      
      // Enable repeater functionality for this node
      #define MY_REPEATER_FEATURE
      
      #include <MySensors.h>
      
      #define RELAY_1  3  // Arduino Digital I/O pin number for first relay (second on pin+1 etc)
      #define NUMBER_OF_RELAYS 1 // Total number of attached relays
      #define RELAY_ON 1  // GPIO value to write to turn on attached relay
      #define RELAY_OFF 0 // GPIO value to write to turn off attached relay
      
      #define BATTERY_REPORT_CYCLE 2
      #define VMIN 3200           // Min Battery level
      #define VMAX 4100           // Max Battery level
      
      int batteryReportCounter = BATTERY_REPORT_CYCLE - 1;
      
      void before()
      {
          for (int sensor=1, pin=RELAY_1; sensor<=NUMBER_OF_RELAYS; sensor++, pin++) {
              // Then set relay pins in output mode
              pinMode(pin, OUTPUT);
              // Set relay to last known state (using eeprom storage)
              digitalWrite(pin, loadState(sensor)?RELAY_ON:RELAY_OFF);
          }
      }
      
      void setup()
      {
      }
      
      void presentation()
      {
          // Send the sketch version information to the gateway and Controller
          sendSketchInfo("Relay", "1.0");
      
          for (int sensor=1, pin=RELAY_1; sensor<=NUMBER_OF_RELAYS; sensor++, pin++) {
              // Register all sensors to gw (they will be created as child devices)
              present(sensor, S_BINARY);
          }
      }
      
      
      void loop()
      {
      }
      
      void receive(const MyMessage &message)
      {
          // We only expect one type of message from controller. But we better check anyway.
          if (message.type==V_STATUS) {
              // Change relay state
              digitalWrite(message.sensor-1+RELAY_1, message.getBool()?RELAY_ON:RELAY_OFF);
              // Store state in eeprom
              saveState(message.sensor, message.getBool());
              // Write some debug info
              Serial.print("Incoming change for sensor:");
              Serial.print(message.sensor);
              Serial.print(", New status: ");
              Serial.println(message.getBool());
          }
          
          batteryReportCounter ++;
          bool forceTransmit = true;
         // Check battery
         if (batteryReportCounter >= BATTERY_REPORT_CYCLE) {
          long batteryVolt = readVcc();
          Serial.print("Battery voltage: "); Serial.print(batteryVolt); Serial.println(" mV");
          uint8_t batteryPcnt = constrain(map(batteryVolt,VMIN,VMAX,0,100),0,255);   
          Serial.print("Battery percent: "); Serial.print(batteryPcnt); Serial.println(" %");
          sendBatteryLevel(batteryPcnt);
          batteryReportCounter = 0;
         }
      }
      
      long readVcc() {
        // set the reference to Vcc and the measurement to the internal 1.1V reference
        ADMUX = _BV(REFS0) | _BV(MUX3) | _BV(MUX2) | _BV(MUX1);
        delay(2); // Wait for Vref to settle
        ADCSRA |= _BV(ADSC); // Start conversion
        while (bit_is_set(ADCSRA,ADSC)); // measuring
        uint8_t low  = ADCL; // must read ADCL first - it then locks ADCH  
        uint8_t high = ADCH; // unlocks both
        long result = (high<<8) | low;
        result = 1125300L / result; // Calculate Vcc (in mV); 1125300 = 1.1*1023*1000
        return result; // Vcc in millivolts
      }
      

      Can't figure it out 😞
      Hope someone can point me in the right direction.

      posted in Domoticz
      edsteve
      edsteve
    • RE: openHAB 2.0 binding

      @TimO
      I use Nano Neo as Hardware with Armbian Linux and OpenHabian on top. The bundle:list showed me mysensors.
      I don't find any Things. Where do i have to put this info: /dev/ttyUSB0 or /dev/ttyACM0?? In which config file?
      Now i get an error with karaf saying "connection refused" when i try:

      ssh -p 8101 openhab@localhost
      

      Yesterday it worked... the karaf thing make it even more difficult.

      EDIT: I just found out that i have to make a demo.things file with the code for the serial gateway.... And for sure that was not the last file which needs manual editing. I go back to Domoticz. Till OpenHab becomes same easy.

      posted in OpenHAB
      edsteve
      edsteve
    • RE: openHAB 2.0 binding

      Hi,

      just a quick question:
      OpenHab2 can be used without touching any code right?
      I use mysensors serial gateway. Tried to set it up all day yesterday from skratch. Also with OpenHabian. But no success.
      So it seems i still have to edit files and folders manually in order to get it running right?

      I got Domoticz working after short time. Was expecting OpenHab2 makes it even more easy 😕

      posted in OpenHAB
      edsteve
      edsteve
    • RE: <SOLVED>Domoticz adds constantly new devices when using manual DeviceAddress for DS18B20

      Yeahaa. Thanks so much. I really appreciate it!
      Some small changes with temp4 and works like a charm. If you don't accept my offer. Then the transfer goes to mysensors community 🙂

      Here the working code IF someone need it or i loose mine 😉

      #define MY_RADIO_NRF24
      #define MY_DEBUG
      #include <MySensors.h>
      #include <SPI.h>
      #include <OneWire.h>
      #include <DallasTemperature.h>
      
      // Data wire is plugged into port 2 on the Arduino 
      #define ONE_WIRE_BUS 4 
      #define TEMPERATURE_PRECISION 10 
       
      // Setup a oneWire instance to communicate with any OneWire devices (not just Maxim/Dallas temperature ICs) 
      OneWire oneWire(ONE_WIRE_BUS); 
      
      // Pass our oneWire reference to Dallas Temperature. 
      DallasTemperature sensors(&oneWire); 
      
      #define NODE_ID 1
      #define CHILD_ID_WIND 1
      #define CHILD_ID_TEMP1 3
      #define CHILD_ID_TEMP2 4
      #define CHILD_ID_TEMP3 5
      #define CHILD_ID_TEMP4 6
      #define CHILD_ID_TEMP5 7
      
      unsigned int val_wspeed;
      unsigned int val_wgust;
      unsigned int val_wdirection;
      
      
      unsigned int last_wspeed;
      unsigned int last_wgust;
      unsigned int last_wdirection;
      
      
      DeviceAddress  temp1 = { 0x28, 0xEE, 0xB6, 0xB1, 0x27, 0x16, 0x01, 0x1F };
      DeviceAddress  temp2 = { 0x28, 0xEE, 0xE1, 0x20, 0x28, 0x16, 0x01, 0xEA };
      DeviceAddress  temp3 = { 0x28, 0xEE, 0x0D, 0xAA, 0x24, 0x16, 0x02, 0x8A };
      DeviceAddress  temp4 = { 0x28, 0xEE, 0x7D, 0xA8, 0x24, 0x16, 0x02, 0xE0 };
      DeviceAddress  temp5 = { 0x28, 0xFF, 0xF6, 0x8F, 0x62, 0x16, 0x03, 0x7F };
      
      
      
      MyMessage msgWSpeed(CHILD_ID_WIND, V_WIND);
      MyMessage msgWGust(CHILD_ID_WIND, V_GUST);
      MyMessage msgWDirection(CHILD_ID_WIND, V_DIRECTION);
      MyMessage msg(0,V_TEMP);
      
      void setup(void) 
      {
        // start serial port
        Serial.begin(115200);
        Serial.println("Dallas Temperature IC Control Library Demo");
      
        // Start up the library
        sensors.begin();
      
        // report parasite power requirements
        Serial.print("Parasite power is: "); 
        if (sensors.isParasitePowerMode()) Serial.println("ON");
        else Serial.println("OFF");
      
        // set the resolution to 9 bit
        sensors.setResolution(temp1, TEMPERATURE_PRECISION);
        sensors.setResolution(temp2, TEMPERATURE_PRECISION);
        sensors.setResolution(temp3, TEMPERATURE_PRECISION);
        sensors.setResolution(temp4, TEMPERATURE_PRECISION);
        sensors.setResolution(temp5, TEMPERATURE_PRECISION);
      
      }
      
      void presentation()
      {
          present(CHILD_ID_WIND, S_WIND);
          present(CHILD_ID_TEMP1, S_TEMP);
          present(CHILD_ID_TEMP2, S_TEMP);
          present(CHILD_ID_TEMP3, S_TEMP);
          present(CHILD_ID_TEMP4, S_TEMP);
          present(CHILD_ID_TEMP5, S_TEMP);
      }
      
      void loop()
      {  
        // call sensors.requestTemperatures() to issue a global temperature 
        // request to all devices on the bus
        Serial.print("Requesting temperatures...");
        sensors.requestTemperatures();
        Serial.println("DONE");
      
        // print the device information
        float east = sensors.getTempC(temp1);
        Serial.print("East C: ");
        Serial.println(east);
        send(msg.setSensor(CHILD_ID_TEMP1).set(east,1));
      
        float north = sensors.getTempC(temp2);
        Serial.print("North  C: ");
        Serial.println(north);
        send(msg.setSensor(CHILD_ID_TEMP2).set(north,1));
      
        float west = sensors.getTempC(temp5);
        Serial.print("West  C: ");
        Serial.println(west);
        send(msg.setSensor(CHILD_ID_TEMP5).set(west,1));
      
        float south = sensors.getTempC(temp3);
        Serial.print("South C: ");
        Serial.println(south);
        send(msg.setSensor(CHILD_ID_TEMP3).set(south,1));
      
        float out = sensors.getTempC(temp4);
        Serial.print("Test  C: ");
        Serial.println(out); 
        send(msg.setSensor(CHILD_ID_TEMP4).set(out,1)); 
        
        // calculating wind direction form temperature differences
          if (north > south && north > west && north > east ) {
          Serial.println("SOUTH");
          unsigned int val_wdirection = 180; 
             send(msgWDirection.set(val_wdirection));
             Serial.print("WD: ");
             Serial.println(val_wdirection);
          }
      
          if (east > north && east > west && east > south ) {
          Serial.println("WEST");
          unsigned int val_wdirection = 280; 
             send(msgWDirection.set(val_wdirection));
             Serial.print("WD: ");
             Serial.println(val_wdirection);
          }
      
           if (south > north && south > west && south > east ) {
          Serial.println("NORTH");
          unsigned int val_wdirection = 0; 
             send(msgWDirection.set(val_wdirection));
             Serial.print("WD: ");
             Serial.println(val_wdirection);
          }
      
          if (west > north && west > south && west > east ) {
          Serial.println("EAST");
          unsigned int val_wdirection = 90; 
             send(msgWDirection.set(val_wdirection));
             Serial.print("WD: ");
             Serial.println(val_wdirection);
          }
        
        //domoticz must see speed and gust so i give random numbers for testing
        unsigned int val_wspeed = 17; 
          if(last_wspeed != val_wspeed)
          { 
             last_wspeed = val_wspeed;
             send(msgWSpeed.set(val_wspeed, 1));
             Serial.print("WS: ");
             Serial.println(val_wspeed);
          }
          
          unsigned int val_wgust = 5; 
          if(last_wgust != val_wgust)
          { 
             last_wgust = val_wgust;
             send(msgWGust.set(val_wgust, 1));
             Serial.print("WG: ");
             Serial.println(val_wgust);
          }
      
            delay (5000);
      }
      
      posted in Domoticz
      edsteve
      edsteve
    • RE: <SOLVED>Domoticz adds constantly new devices when using manual DeviceAddress for DS18B20

      I understand what you mean. Thanks for your answer.
      But i still have trouble to write your solution into code. If it's not too much work for you. Can you help me out?

      If that solves the problem. Please send me your paypal email.

      posted in Domoticz
      edsteve
      edsteve
    • <SOLVED>Domoticz adds constantly new devices when using manual DeviceAddress for DS18B20

      Hi,

      after two days testing and trying i give up. BUT i am a programming noob. So i am sure the error is in the code easy to spot for others.

      Situation:
      Arduino Pro Mini has fife DS18B20 sensors attached. Sending data via serial gateway to domoticz which runs on NanoPi (Raspberry compatible). When i use the mysensors temp sketch all works well without problems.
      But i can't use the "standard sketch" because the mysensors code is not assigning DeviceAdreses manually which i need for this project.

      So here is my code:

      #define MY_RADIO_NRF24
      #define MY_DEBUG
      #include <MySensors.h>
      #include <SPI.h>
      #include <OneWire.h>
      #include <DallasTemperature.h>
      
      // Data wire is plugged into port 2 on the Arduino 
      #define ONE_WIRE_BUS 4 
      #define TEMPERATURE_PRECISION 10 
       
      // Setup a oneWire instance to communicate with any OneWire devices (not just Maxim/Dallas temperature ICs) 
      OneWire oneWire(ONE_WIRE_BUS); 
      
      // Pass our oneWire reference to Dallas Temperature. 
      DallasTemperature sensors(&oneWire); 
      
      #define NODE_ID 1
      #define CHILD_ID_WIND 1
      #define CHILD_ID_TEMP 3
      
      unsigned int val_wspeed;
      unsigned int val_wgust;
      unsigned int val_wdirection;
      
      
      unsigned int last_wspeed;
      unsigned int last_wgust;
      unsigned int last_wdirection;
      
      DeviceAddress  temp1 = { 0x28, 0xEE, 0xB6, 0xB1, 0x27, 0x16, 0x01, 0x1F };
      DeviceAddress  temp2 = { 0x28, 0xEE, 0xE1, 0x20, 0x28, 0x16, 0x01, 0xEA };
      DeviceAddress  temp3 = { 0x28, 0xEE, 0x0D, 0xAA, 0x24, 0x16, 0x02, 0x8A };
      DeviceAddress  temp4 = { 0x28, 0xEE, 0x7D, 0xA8, 0x24, 0x16, 0x02, 0xE0 };
      DeviceAddress  temp5 = { 0x28, 0xFF, 0xF6, 0x8F, 0x62, 0x16, 0x03, 0x7F };
      
      
      MyMessage msgWSpeed(CHILD_ID_WIND, V_WIND);
      MyMessage msgWGust(CHILD_ID_WIND, V_GUST);
      MyMessage msgWDirection(CHILD_ID_WIND, V_DIRECTION);
      MyMessage msg(CHILD_ID_TEMP,V_TEMP);
      
      void setup(void) 
      {
        // start serial port
        Serial.begin(115200);
        Serial.println("Dallas Temperature IC Control Library Demo");
      
        // Start up the library
        sensors.begin();
      
        // report parasite power requirements
        Serial.print("Parasite power is: "); 
        if (sensors.isParasitePowerMode()) Serial.println("ON");
        else Serial.println("OFF");
      
        // set the resolution to 9 bit
        sensors.setResolution(temp1, TEMPERATURE_PRECISION);
        sensors.setResolution(temp2, TEMPERATURE_PRECISION);
        sensors.setResolution(temp3, TEMPERATURE_PRECISION);
        sensors.setResolution(temp4, TEMPERATURE_PRECISION);
        sensors.setResolution(temp5, TEMPERATURE_PRECISION);
      
      }
      
      void presentation()
      {
          present(CHILD_ID_WIND, S_WIND);
          present(CHILD_ID_TEMP, S_WIND);
      }
      
      void loop()
      {  
        // call sensors.requestTemperatures() to issue a global temperature 
        // request to all devices on the bus
        Serial.print("Requesting temperatures...");
        sensors.requestTemperatures();
        Serial.println("DONE");
      
        // print the device information
        float east = sensors.getTempC(temp1);
        Serial.print("East C: ");
        Serial.println(east);
        send(msg.setSensor(temp1).set(east,1));
      
        float north = sensors.getTempC(temp2);
        Serial.print("North  C: ");
        Serial.println(north);
        send(msg.setSensor(temp2).set(north,1));
      
        float west = sensors.getTempC(temp5);
        Serial.print("West  C: ");
        Serial.println(west);
        send(msg.setSensor(temp4).set(west,1));
      
        float south = sensors.getTempC(temp3);
        Serial.print("South C: ");
        Serial.println(south);
        send(msg.setSensor(temp5).set(south,1));
      
        float temp33 = sensors.getTempC(temp4);
        Serial.print("Test  C: ");
        Serial.println(temp33); 
        send(msg.setSensor(temp33).set(temp33,1)); 
        
        // calculating wind direction form temperature differences
          if (north > south && north > west && north > east ) {
          Serial.println("SOUTH");
          unsigned int val_wdirection = 180; 
             send(msgWDirection.set(val_wdirection));
             Serial.print("WD: ");
             Serial.println(val_wdirection);
          }
      
          if (east > north && east > west && east > south ) {
          Serial.println("WEST");
          unsigned int val_wdirection = 280; 
             send(msgWDirection.set(val_wdirection));
             Serial.print("WD: ");
             Serial.println(val_wdirection);
          }
      
           if (south > north && south > west && south > east ) {
          Serial.println("NORTH");
          unsigned int val_wdirection = 0; 
             send(msgWDirection.set(val_wdirection));
             Serial.print("WD: ");
             Serial.println(val_wdirection);
          }
      
          if (west > north && west > south && west > east ) {
          Serial.println("EAST");
          unsigned int val_wdirection = 90; 
             send(msgWDirection.set(val_wdirection));
             Serial.print("WD: ");
             Serial.println(val_wdirection);
          }
      	
      	//domoticz must see speed and gust so i give random numbers for testing
      	unsigned int val_wspeed = 17; 
          if(last_wspeed != val_wspeed)
          { 
             last_wspeed = val_wspeed;
             send(msgWSpeed.set(val_wspeed, 1));
             Serial.print("WS: ");
             Serial.println(val_wspeed);
          }
          
          unsigned int val_wgust = 5; 
          if(last_wgust != val_wgust)
          { 
             last_wgust = val_wgust;
             send(msgWGust.set(val_wgust, 1));
             Serial.print("WG: ");
             Serial.println(val_wgust);
          }
      
            delay (5000);
      }
      

      Problem:
      Domoticz adds more and more temp sensors in the Device List. Randomly i would say. Sometimes fife new devices within 10 minutes. Sometimes none for one hour.
      What is causing that?

      I get this compiling warning from Arduino IDE which i don't know how to solve. Is that the problem?

      C:\Users\ed\Documents\Arduino\Wind-Test\Wind-Test-incl-temp\Wind-Test-incl-temp.ino: In function 'void loop()':
      
      C:\Users\ed\Documents\Arduino\Wind-Test\Wind-Test-incl-temp\Wind-Test-incl-temp.ino:122:27: warning: invalid conversion from 'uint8_t* {aka unsigned char*}' to 'uint8_t {aka unsigned char}' [-fpermissive]
      
         send(msg.setSensor(temp1).set(east,1));
      
                                 ^
      
      In file included from C:\Users\ed\Documents\Arduino\libraries\MySensors/MySensors.h:333:0,
      
                       from C:\Users\ed\Documents\Arduino\Wind-Test\Wind-Test-incl-temp\Wind-Test-incl-temp.ino:3:
      
      C:\Users\ed\Documents\Arduino\libraries\MySensors/core/MyMessage.cpp:217:12: note: initializing argument 1 of 'MyMessage& MyMessage::setSensor(uint8_t)'
      
       MyMessage& MyMessage::setSensor(uint8_t _sensor)
      

      What i tried on hardware side:

      • Changed Arduino
      • Changed 4 out of 5 temp sensors
      • Changed Radio

      Here newly added temp-sensors for the last 20 minutes
      alt text

      Any ideas, hints or even solutions?
      15USD for solution. Totally worth it 🙂

      Cheers
      ED

      posted in Domoticz
      edsteve
      edsteve
    • RE: <SOLVED> What is wrong with my S_Wind V_Direction value? Never changes...

      Thanks for still coping with me. Tried playing with your suggestions but no success as well.
      But i found the problem.

      SOLUTION:
      I just gave the wind-sensor-node a different NODE_ID manually and now it updates the direction value.
      Seems there was some problems with old data when i used this arduino as a temp sensor.

      posted in Domoticz
      edsteve
      edsteve
    • RE: <SOLVED> What is wrong with my S_Wind V_Direction value? Never changes...

      My mistake. I actually edit it right after i posted. But i think you were faster than me 🙂
      Yeah. I read about the magic number 16. Thats why i test with 15 😄
      If i understand that right Domoticz goes from 0 to 16 instead of 0 to 360. So 15 should do fine.
      So now i am out of guesses and clues 😕

      posted in Domoticz
      edsteve
      edsteve
    • RE: <SOLVED> What is wrong with my S_Wind V_Direction value? Never changes...

      Wow. I am happy to see answers 🙂

      @mfalkvidd
      Thats the serial log, which seems okay to me:

      0 MCO:BGN:INIT NODE,CP=RNNNA--,VER=2.1.1
      3 TSM:INIT
      4 TSF:WUR:MS=0
      11 TSM:INIT:TSP OK
      13 TSF:SID:OK,ID=1
      14 TSM:FPAR
      51 TSF:MSG:SEND,1-1-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
      69 TSF:MSG:READ,0-0-1,s=255,c=3,t=8,pt=1,l=1,sg=0:0
      73 TSF:MSG:FPAR OK,ID=0,D=1
      789 TSF:MSG:READ,3-3-1,s=255,c=3,t=8,pt=1,l=1,sg=0:1
      878 TSF:MSG:READ,8-8-1,s=255,c=3,t=8,pt=1,l=1,sg=0:1
      2058 TSM:FPAR:OK
      2059 TSM:ID
      2060 TSM:ID:OK
      2062 TSM:UPL
      2065 TSF:MSG:SEND,1-1-0-0,s=255,c=3,t=24,pt=1,l=1,sg=0,ft=0,st=OK:1
      2075 TSF:MSG:READ,0-0-1,s=255,c=3,t=25,pt=1,l=1,sg=0:1
      2079 TSF:MSG:PONG RECV,HP=1
      2082 TSM:UPL:OK
      2084 TSM:READY:ID=1,PAR=0,DIS=1
      2088 TSF:MSG:SEND,1-1-0-0,s=255,c=3,t=15,pt=6,l=2,sg=0,ft=0,st=OK:0100
      2096 TSF:MSG:READ,0-0-1,s=255,c=3,t=15,pt=6,l=2,sg=0:0100
      2103 TSF:MSG:SEND,1-1-0-0,s=255,c=0,t=17,pt=0,l=5,sg=0,ft=0,st=OK:2.1.1
      2113 TSF:MSG:SEND,1-1-0-0,s=255,c=3,t=6,pt=1,l=1,sg=0,ft=0,st=OK:0
      2125 TSF:MSG:READ,0-0-1,s=255,c=3,t=6,pt=0,l=1,sg=0:M
      2131 TSF:MSG:SEND,1-1-0-0,s=1,c=0,t=9,pt=0,l=0,sg=0,ft=0,st=OK:
      2138 MCO:REG:REQ
      2141 TSF:MSG:SEND,1-1-0-0,s=255,c=3,t=26,pt=1,l=1,sg=0,ft=0,st=OK:2
      2147 TSF:MSG:READ,0-0-1,s=255,c=3,t=27,pt=1,l=1,sg=0:1
      2152 MCO:PIM:NODE REG=1
      2154 MCO:BGN:INIT OK,TSP=1
      2159 TSF:MSG:SEND,1-1-0-0,s=1,c=1,t=8,pt=7,l=5,sg=0,ft=0,st=OK:12.0
      WS: 12
      2167 TSF:MSG:SEND,1-1-0-0,s=1,c=1,t=9,pt=7,l=5,sg=0,ft=0,st=OK:4.0
      WG: 4
      2176 TSF:MSG:SEND,1-1-0-0,s=1,c=1,t=10,pt=3,l=2,sg=0,ft=0,st=OK:15
      WD: 3
      

      @AWI
      I tried. Without success.

      Is there a clue why it is 20NNE? Also the temperature shows 20 in the picture from first post. Even though there is only the nrf24l01 connected. No sensor. Maybe the problem is related to this number. Just guessing also 🙂
      I used this arduino with a temp sensor before. Can that be conected? Hmm

      posted in Domoticz
      edsteve
      edsteve
    • <SOLVED> What is wrong with my S_Wind V_Direction value? Never changes...

      Hi,

      I am using a "dummy-sketch" to keep it simple. The sketch sends and updates the data for windspeed and gust to the Domoticz controller whenever i change the values in the skript. But when i change the value for val_wdirection the wind direction never changes in Domoticz. How come?

      It seems there is something wrong with this part of the sketch, right?

          unsigned int val_wdirection = 15; 
          if(last_wdirection != val_wdirection)
          { 
             last_wdirection = val_wdirection;
             send(msgWDirection.set(val_wdirection, 1));
             Serial.print("WD: ");
             Serial.println(val_wdirection);
          }
      

      And this is the complete sketch:

      #define MY_RADIO_NRF24
      #define MY_DEBUG
      #include <MySensors.h>
      #include <SPI.h>
      
      #define CHILD_ID_WIND 1
      
      unsigned int val_wspeed;
      unsigned int val_wgust;
      unsigned int val_wdirection;
      
      
      unsigned int last_wspeed;
      unsigned int last_wgust;
      unsigned int last_wdirection;
      
      MyMessage msgWSpeed(CHILD_ID_WIND, V_WIND);
      MyMessage msgWGust(CHILD_ID_WIND, V_GUST);
      MyMessage msgWDirection(CHILD_ID_WIND, V_DIRECTION);
      
      
      void presentation()
      {
          present(CHILD_ID_WIND, S_WIND);
      }
      
      void loop()
      {  
      //  gw.process();
       
      //  currentTime = millis();
        
          unsigned int val_wspeed = 12; 
          if(last_wspeed != val_wspeed)
          { 
             last_wspeed = val_wspeed;
             send(msgWSpeed.set(val_wspeed, 1));
             Serial.print("WS: ");
             Serial.println(val_wspeed);
          }
          
          unsigned int val_wgust = 4; 
          if(last_wgust != val_wgust)
          { 
             last_wgust = val_wgust;
             send(msgWGust.set(val_wgust, 1));
             Serial.print("WG: ");
             Serial.println(val_wgust);
          }
        
          unsigned int val_wdirection = 15; 
          if(last_wdirection != val_wdirection)
          { 
             last_wdirection = val_wdirection;
             send(msgWDirection.set(val_wdirection, 1));
             Serial.print("WD: ");
             Serial.println(val_wdirection);
          }
      }
      

      alt text
      The wind direction always say 20NNE. Temp and Chill also says 20 degrees and i have no idea where the number 20 comes from.

      I drives me crazy. I don't know what to do 😕

      posted in Domoticz
      edsteve
      edsteve
    • RE: 💬 Soil Moisture Sensor

      Yeah. It would be great if someone can tell us about the hardware and wiring used in this sketch.

      posted in Announcements
      edsteve
      edsteve
    • RE: Humidity and Temp examples. Where are they?

      Okay. So that means all the MySensor examples in the Arduino IDE only use Mysensors.h and no external library.

      Thx for the info. That explains it.

      posted in General Discussion
      edsteve
      edsteve
    • Humidity and Temp examples. Where are they?

      Hi,

      in the Arduino IDE i am missing the Dallas Temperature examples and the humidity examples. I think everybody using it. Why is it not there?
      So confusing with all different libraries and versions for beginners.... Would be good if at least the examples are complete with the most used sketches.

      Or am i missing something?
      Cheeers
      ED

      posted in General Discussion
      edsteve
      edsteve
    • RE: Two motion sensors on one Arduino. How?

      Nobody? 😞

      posted in Hardware
      edsteve
      edsteve
    • RE: Knock sensor keeps knocking. Alternative?

      I just found out that i adjusted the sound sensor the wrong way. I thought the LED should go ON when i knock on the mic and should be OFF if no sound is detected.
      Instead the knob on the sound sensor has to be turned left till the LED goes OFF. And then turn half round back to the right side so that the LED is ON. It will stay on. With or without a knock.

      But then it works with the sketch.

      As usual: Problem is the noob user 😉 Maybe i am not the only one.

      posted in Hardware
      edsteve
      edsteve
    • Knock sensor keeps knocking. Alternative?

      Hi,

      i was posting this issue at the Secret knock sensor under announcements. But maybe better here.

      I tried to get the secret knock sensor working. I connected only a radio and this sound sensor on a Arduino Mini Pro:
      alt text

      After uploading the example code from Arduino IDE the serial monitor shows me constant knocks. Seven knocks per second. On and on and on. This keeps going on even i unplug the Digital pin 5 which is connected to the DO of the sound sensor.
      Yes. I adjusted the sound sensor that the LED only blinks, when i knock on the mic. I tried a different Arduino and a different sound sensor and different wire.

      What else can i try? Are there any similar solutions out there?

      posted in Hardware
      edsteve
      edsteve
    • RE: 💬 Secret Knock Sensor

      Hmm. I connected a sound sensor to Arduino Mini Pro (with external power source), adjusted the sensitivity (so the LED only blinks when i knock on the mic), uploaded the example sketch. But the serial monitor shows me constantly knocks. Maybe 7 knocks per second. On and on....
      I set the threshold value in the sketch to 10 and 100 and 200. But no change.
      When i disconnect the sound sensors DO pin from Arduino. It's the same... constant knocks.

      What am i doing wrong?

      P.S.: Digital 0 is what pin on the Arduino? Pin2?

      posted in Announcements
      edsteve
      edsteve
    • RE: Two motion sensors on one Arduino. How?

      Huff. I am too nooobish in programming 😞
      Can anyone tell me how to change the example code to get a second motion sensor on pin2 working with Domoticz?

      Here the example:

      // Enable debug prints
      // #define MY_DEBUG
      
      // Enable and select radio type attached
      #define MY_RADIO_NRF24
      //#define MY_RADIO_RFM69
      
      #include <SPI.h>
      #include <MySensors.h>
      
      unsigned long SLEEP_TIME = 120000; // Sleep time between reports (in milliseconds)
      #define DIGITAL_INPUT_SENSOR 3   // The digital input you attached your motion sensor.  (Only 2 and 3 generates interrupt!)
      #define CHILD_ID 1   // Id of the sensor child
      
      // Initialize motion message
      MyMessage msg(CHILD_ID, V_TRIPPED);
      
      void setup()  
      {  
        pinMode(DIGITAL_INPUT_SENSOR, INPUT);      // sets the motion sensor digital pin as input
      }
      
      void presentation()  {
        // Send the sketch version information to the gateway and Controller
        sendSketchInfo("Motion Sensor", "1.0");
      
        // Register all sensors to gw (they will be created as child devices)
        present(CHILD_ID, S_MOTION);
      }
      
      void loop()     
      {     
        // Read digital motion value
        boolean tripped = digitalRead(DIGITAL_INPUT_SENSOR) == HIGH; 
              
        Serial.println(tripped);
        send(msg.set(tripped?"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 Hardware
      edsteve
      edsteve
    • RE: Two motion sensors on one Arduino. How?

      Cool. There is even a noob solution. For now 🙂

      posted in Hardware
      edsteve
      edsteve
    • RE: Two motion sensors on one Arduino. How?

      Thanks for your answer. Great that it is possible even-though it will take some time for me as a noob.
      But as usual: every problem has a solution. Just have to find (ask for) it 💃

      posted in Hardware
      edsteve
      edsteve
    • Two motion sensors on one Arduino. How?

      Hey,

      pin 2 and 3 can get interrupt on Arduino. Pin 2 is used for radio already. So only one pin left.
      I am so much of a noob that i can't tell if there is a solution for that problem?
      Anybody knows how to get two motion sensors running on one Arduino?

      That would safe me money, time and space 🙂

      Thx
      ED

      posted in Hardware
      edsteve
      edsteve
    • RE: Serial Gateway not recognized

      Wow.
      Proof of beeing a real noob:

      I thought it will recognize the gateway automatically. But seems i must add it manual.
      Stupid me. Sorry wasting time and space.

      posted in Domoticz
      edsteve
      edsteve
    • RE: Serial Gateway not recognized

      I am not sure what you mean by "settings"? Where can i do hardware settings?
      Here is how my Hardware section looks like:
      0_1476105855079_upload-f4fdbfa2-7027-44ab-bf78-172eb678a976

      posted in Domoticz
      edsteve
      edsteve
    • Serial Gateway not recognized

      Hi,

      Domoticz is running on a NanoPi Linux. I just started with Domoticz. The gateway was recognized 2 days ago, but after i accidentally removed the sdcard while running it won't recognize the gateway any more. Made a fresh Domoticz installation. But no entry in the Hardware section 😞

      So my gateway is connected to ttyUSB0 according to dmesg. Correct?

      [  400.935722] ch341 6-1:1.0: device disconnected
      [  406.871835] ehci_irq: highspeed device connect
      [  407.080056] ehci_irq: highspeed device disconnect
      [  407.080087] ohci_irq: fullspeed or lowspeed device connect
      [  407.510120] usb 8-1: new full-speed USB device number 2 using sunxi-ohci
      [  407.731631] ch341 8-1:1.0: ch341-uart converter detected
      [  407.772934] usb 8-1: ch341-uart converter now attached to ttyUSB0
      
      

      This is the only thing that happens after starting Domoticz:

      2016-10-10 20:22:52.046 Domoticz V3.5744 (c)2012-2016 GizMoCuz
      2016-10-10 20:22:52.047 Build Hash: 289b09a, Date: 2016-10-09 15:14:57
      2016-10-10 20:22:52.047 Startup Path: /root/domoticz/
      2016-10-10 20:22:52.133 Sunrise: 07:12:00 SunSet:19:10:00
      2016-10-10 20:22:52.133 EventSystem: reset all events...
      2016-10-10 20:22:52.163 Active notification subsystems: (0/12)
      2016-10-10 20:22:52.195 WebServer(HTTP) started on address: :: with port 8080
      2016-10-10 20:22:52.220 WebServer(SSL) started on address: :: with port 443
      2016-10-10 20:22:52.222 Proxymanager started.
      2016-10-10 20:22:52.225 Starting shared server on: :::6144
      2016-10-10 20:22:52.225 TCPServer: shared server started...
      2016-10-10 20:22:52.226 RxQueue: queue worker started...
      2016-10-10 20:22:54.229 EventSystem: reset all events...
      2016-10-10 20:22:54.230 EventSystem: reset all device statuses...
      2016-10-10 20:22:54.232 EventSystem: Started
      2016-10-10 20:22:54.950 Incoming connection from: 192.168.1.155
      

      So. No gateway found. 😞
      This is my Gateway sketch from Arduini IDE examples:

      
      // Enable debug prints to serial monitor
      #define MY_DEBUG 
      
      
      // Enable and select radio type attached
      #define MY_RADIO_NRF24
      //#define MY_RADIO_RFM69
      
      // Set LOW transmit power level as default, if you have an amplified NRF-module and
      // power your radio separately with a good regulator you can turn up PA level. 
      #define MY_RF24_PA_LEVEL RF24_PA_LOW
      
      // Enable serial gateway
      #define MY_GATEWAY_SERIAL
      
      // Define a lower baud rate for Arduino's running on 8 MHz (Arduino Pro Mini 3.3V & SenseBender)
      #if F_CPU == 8000000L
      #define MY_BAUD_RATE 38400
      #endif
      
      // Flash leds on rx/tx/err
      #define MY_LEDS_BLINKING_FEATURE
      // Set blinking period
      #define MY_DEFAULT_LED_BLINK_PERIOD 300
      
      // Inverses the behavior of leds
      //#define MY_WITH_LEDS_BLINKING_INVERSE
      
      // Enable inclusion mode
      #define MY_INCLUSION_MODE_FEATURE
      // Enable Inclusion mode button on gateway
      #define MY_INCLUSION_BUTTON_FEATURE
      
      // Inverses behavior of inclusion button (if using external pullup)
      //#define MY_INCLUSION_BUTTON_EXTERNAL_PULLUP
      
      // Set inclusion mode duration (in seconds)
      #define MY_INCLUSION_MODE_DURATION 60 
      // Digital pin used for inclusion mode button
      #define MY_INCLUSION_MODE_BUTTON_PIN  3 
      
      // Uncomment to override default HW configurations
      //#define MY_DEFAULT_ERR_LED_PIN 4  // Error led pin
      //#define MY_DEFAULT_RX_LED_PIN  6  // Receive led pin
      //#define MY_DEFAULT_TX_LED_PIN  5  // the PCB, on board LED
      
      #include <SPI.h>
      #include <MySensors.h>  
      
      void setup() { 
        // Setup locally attached sensors
      }
      
      void presentation() {
       // Present locally attached sensors 
      }
      
      void loop() { 
        // Send locally attached sensor data here 
      }
      

      When i connect the Gateway to my windows PC the serial monior shows this:

      0;255;3;0;9;Starting gateway (RNNGA-, 2.0.0)
      0;255;3;0;9;TSM:INIT
      0;255;3;0;9;TSM:RADIO:OK
      0;255;3;0;9;TSM:GW MODE
      0;255;3;0;9;TSM:READY
      0;255;3;0;14;Gateway startup complete.
      0;255;0;0;18;2.0.0
      0;255;3;0;9;No registration required
      0;255;3;0;9;Init complete, id=0, parent=0, distance=0, registration=1
      

      I don't see what can be wrong. What else can i check or change?

      Cheeers from Sumatra
      ED

      posted in Domoticz
      edsteve
      edsteve
    • RE: Where to get the RIGHT libraries?

      Thanks for the info tbo.
      I read in forums that the mysensors page is not always up to date because it's manually updated that's why i wasn't sure which info to trust. I trust yours now 🙂

      posted in General Discussion
      edsteve
      edsteve
    • Where to get the RIGHT libraries?

      Hi,

      i do love that project and it's kind of addictive 🙂 I wish i could contribute some work, but i am just starting. If there is some primitive work to do. Let me know 🙂

      I am sure many noobs like me have the problem that there are soooo many different tutorials out there. And so many different ways of the "right" way how to install the correct libraries for Arduino IDE which seems to be an important thing not to have messed up libraries.

      Can someone please tell me which one to use/follow? I don't think they are all the same.

      1. Download button from mysensors API & Download: https://github.com/mysensors/Arduino/archive/master.zip
      2. Github button from mysensors API & Download but there are NO libraries: https://github.com/mysensors/Arduino/tree/master
      3. Install through Arduino IDE library manager: https://www.mysensors.org/about/arduino#installing-the-sensor-libraries
      4. From here (not sure what that is): https://ci.mysensors.org/job/Verifiers/job/MySensorsArduino/
      5. Or from Doxygen or is there something else?

      Next: Where to get the workings examples from?

      Thanks for making my life easier 🙂
      ED

      posted in General Discussion
      edsteve
      edsteve
    • RE: [SOLVED] Long distance radios not working with mySensors code (nrf24l01+)

      Hey Vidd,

      Thanks for your perfect answer and the diagram. Useful info for newbie like me 🙂
      I tried external power for the radio and it worked right away. I got mislead from the fact that the radio worked with a simple test code but not with mysensors code.

      posted in Hardware
      edsteve
      edsteve
    • [SOLVED] Long distance radios not working with mySensors code (nrf24l01+)

      Hi,

      i am playing with mysensors and OpenHAB for a little while now and have around 6 sensors running just fine. I use the standard NRF24L01+ radios but want to have two more sensors with the NRF24L01+ long-range version so i can meassure the temperature in my compost experiment. So i bought these two:
      http://cgi.ebay.de/ws/eBayISAPI.dll?ViewItem&item=231799511604#ht_1500wt_1161

      But the mysensors code is not working with the long-range versions. When i take a already working sensor and change the radio with the long-range version. Nothing happens. Even the serial monitor is empty. Not even an error like "radio init failed"... just empty.

      I tried this test: http://shanes.net/simple-nrf24l01-with-arduino-sketch-and-setup/
      And i can get it running successfully. Means the hardware is working but isn't compatible with the mysensors code. Or am i doing something wrong?

      This is what i tried already:

      • reinstalled Arduino IDE
      • changed the USB ports and cables and tried on different Arduino Nanos

      Here is one of my running sketches which only runs on the short-range radios 😞
      Hope somebody telling me how stupid i am 😉

      #include <MySensor.h>  
      #include <SPI.h>
      
      unsigned long SLEEP_TIME = 120000; // Sleep time between reports (in milliseconds)
      #define DIGITAL_INPUT_SENSOR 3   // The digital input you attached your motion sensor.  (Only 2 and 3 generates interrupt!)
      #define INTERRUPT DIGITAL_INPUT_SENSOR-2 // Usually the interrupt = pin -2 (on uno/nano anyway)
      #define CHILD_ID 1   // Id of the sensor child
      #define NODE_ID 11
      
      MySensor gw;
      // Initialize motion message
      MyMessage msg(CHILD_ID, V_TRIPPED);
      
      void setup()  
      {  
        gw.begin(NULL, NODE_ID, true);
      
        // Send the sketch version information to the gateway and Controller
        gw.sendSketchInfo("Motion Sensor", "1.0");
      
        pinMode(DIGITAL_INPUT_SENSOR, INPUT);      // sets the motion sensor digital pin as input
        // Register all sensors to gw (they will be created as child devices)
        gw.present(CHILD_ID, S_MOTION);
        
      }
      
      void loop()     
      {     
        // Read digital motion value
        boolean tripped = digitalRead(DIGITAL_INPUT_SENSOR) == HIGH; 
              
        Serial.println(tripped);
        gw.send(msg.set(tripped?"1":"0"));  // Send tripped value to gw 
       
        // Sleep until interrupt comes in on motion sensor. Send update every two minute. 
        gw.sleep(INTERRUPT,CHANGE, SLEEP_TIME);
      }
      
      
      posted in Hardware
      edsteve
      edsteve
    • RE: Serial Gateway connection to Openhab

      I know... it's an old thread. And i know openHAB2 is there. But it's still Alpha and i am beginner. Maybe not a good idea 😉

      Somehow my sensors will not bind. I downloaded and installed all fresh.
      When i start openHAB with sudo it loads normal but nodes never connected to openHAB 😞

      EDIT:
      I just made a new install combined the infos from these instructions and that worked for me:
      https://github.com/openhab/openhab/wiki/Linux-and-OS-X#apt-get
      http://www.makeuseof.com/tag/getting-started-openhab-home-automation-raspberry-pi/

      Thx for your answer Tim0 and sorry for posting in wrong thread

      posted in OpenHAB
      edsteve
      edsteve