Navigation

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

    Posts made by Hausner

    • Local heating override.

      Hi,

      I need some help.

      I have a Node controlling my floorheating, but now I want to make a "local" override button, incl diode indicating lights.

      My idea is to build it all in a clear plastic housing (so I can see the relay lights). I then thounght about using a tactile button as "override" and some 3mm leds as indicators. Green = Auto, Red = "Manuel" and Blue = Overridden.

      This Is my working scetch on a Nano.

      /**
       * 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
       * Example sketch showing how to control physical relays. 
       * This example will remember relay state after power failure.
       * http://www.mysensors.org/build/relay
       */ 
      
      #include <MySigningNone.h>
      #include <MyTransportNRF24.h>
      #include <MyTransportRFM69.h>
      #include <MyHwATMega328.h>
      #include <MySensor.h>
      #include <SPI.h>
      
      // NRFRF24L01 radio driver (set low transmit power by default) 
      MyTransportNRF24 radio(RF24_CE_PIN, RF24_CS_PIN, RF24_PA_LEVEL_GW);  
      //MyTransportRFM69 radio;
      // Message signing driver (none default)
      //MySigningNone signer;
      // Select AtMega328 hardware profile
      MyHwATMega328 hw;
      // Construct MySensors library
      #define NUMBER_OF_RELAYS 8
      const int RELAY[] = {A0, A1, A2, A3, A4, 6, 7, 8};
      #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
      
      MySensor gw(radio, hw);
      
      void setup()  
      {   
        // Initialize library and add callback for incoming messages
        gw.begin(incomingMessage, 12, true, 0);
        // Send the sketch version information to the gateway and Controller
        gw.sendSketchInfo("Relay", "1.0");
      
        // Fetch relay status
        for (int sensor=1, pin=0; sensor<=NUMBER_OF_RELAYS;sensor++, pin++) {
          // Register all sensors to gw (they will be created as child devices)
          gw.present(sensor, S_LIGHT);
          // Then set relay pins in output mode
          pinMode(RELAY[pin], OUTPUT);    
          // Set relay to last known state (using eeprom storage) 
          digitalWrite(RELAY[pin], gw.loadState(sensor)?RELAY_ON:RELAY_OFF);
        }
      }
      
      void loop() 
      {
        // Alway process incoming messages whenever possible
        gw.process();
      }
      
      void incomingMessage(const MyMessage &message) {
        // We only expect one type of message from controller. But we better check anyway.
        if (message.type==V_LIGHT) {
           // Change relay state
           digitalWrite(RELAY[message.sensor-1], message.getBool()?RELAY_ON:RELAY_OFF);
           // Store state in eeprom
           gw.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());
         } 
      }
      

      I need to put in 3 LEDS and a button somewhere. Any help would be appriciated.

      posted in My Project
      Hausner
      Hausner
    • Same value from 2 different placed DS18B20

      Hi,

      I'm having a hard time figuring out, why i'm getting the same value from 2 different DS18B20 from the same node. Both DS18 are on Pin 3.

      I know for SURE, that the values/readings can never be the same, as they are placed 2 different places. It's ALWAYS the second DS that somehow get the first DS's value, and that is then transmitted. The node is monitoring a DIY solar water heating system. 1 DS18B20 (S=1) is placed in the collection tank (55 gal water), and the other is placed inside the waterhose to monitor the heat in the panel.

      Sketch:

      // Running DS temperature sensor(s) and relay(s) on one mysensor arduino node
          // Combines Onewire and Relay code
          // 2014-10-14 Pego: Tested and Running on Uno/Clone and MQTT gateway
          
          // Example sketch showing how to send in OneWire temperature readings
          // Example sketch showing how to control physical relays. 
          // This example will remember relay state even after power failure.
          
          #include <MySensor.h>  
          #include <SPI.h>
          #include <DallasTemperature.h>
          #include <OneWire.h>
          
          #define ONE_WIRE_BUS 3 // Pin where dallase sensor is connected 
          #define MAX_ATTACHED_DS18B20 16
          
          #define RELAY_1  5  // Arduino Digital I/O pin number for first relay (second on pin+1 etc)
          #define NUMBER_OF_RELAYS 2 // 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
          
          unsigned long SLEEP_TIME = 30000; // Sleep time between reads (in milliseconds) 30000 orig
          OneWire oneWire(ONE_WIRE_BUS);
          DallasTemperature sensors(&oneWire);
          MySensor gw;
          float lastTemperature[MAX_ATTACHED_DS18B20];
          int numSensors=0;
          boolean receivedConfig = false;
          boolean metric = true; 
          // Initialize temperature message
          MyMessage msg(0,V_TEMP);
          
          void setup()  
          { 
            // Startup OneWire 
            sensors.begin();
          
            // Startup and initialize MySensors library. Set callback for incoming messages. 
            //gw.begin(); 
            gw.begin(incomingMessage, AUTO, true);
          
            // Send the sketch version information to the gateway and Controller
            gw.sendSketchInfo("Temp and Relays", "1.0");
          
            // Fetch the number of attached temperature sensors  
            numSensors = sensors.getDeviceCount();
          
            // Present all sensors to controller
            for (int i=0; i<numSensors && i<MAX_ATTACHED_DS18B20; i++) {   
               gw.present(i, V_TEMP);
            }
          
            // Fetch relay status
            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)
              gw.present(sensor, S_LIGHT);
              // Then set relay pins in output mode
              pinMode(pin, OUTPUT);   
              // Set relay to last known state (using eeprom storage) 
              digitalWrite(pin, gw.loadState(sensor)?RELAY_ON:RELAY_OFF);
            }
          
          }
          
          
          void loop()     
          {     
            // Process incoming messages (like config from server)
            gw.process(); 
          
            // Fetch temperatures from Dallas sensors
            sensors.requestTemperatures(); 
          
            // Read temperatures and send them to controller 
            for (int i=0; i<numSensors && i<MAX_ATTACHED_DS18B20; i++) {
           
              // Fetch and round temperature to one decimal
              float temperature = static_cast<float>(static_cast<int>((gw.getConfig().isMetric?sensors.getTempCByIndex(i):sensors.getTempFByIndex(i)) * 10.)) / 10.;
           
              // Only send data if temperature has changed more then 1 degC and no error
              if ((lastTemperature[i]) != temperature && temperature != -127.00 && temperature != 85.00) { //added integer
           
                // Send in the new temperature
                gw.send(msg.setSensor(i).set(temperature,1));
                lastTemperature[i]=temperature;
              }
            delay(1000);
            }
            //gw.sleep(SLEEP_TIME); //no sleep for relays!!!!
          }
          
          void incomingMessage(const MyMessage &message) {
            // We only expect one type of message from controller. But we better check anyway.
            if (message.type==V_LIGHT) {
               // Change relay state
               digitalWrite(message.sensor-1+RELAY_1, message.getBool()?RELAY_ON:RELAY_OFF);
               // Store state in eeprom
               gw.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());
             } 
          }
      

      Readings on node serial port:

      repeater started, id 41
      send: 41-41-33-0 s=255,c=0,t=18,pt=0,l=5,st=ok:1.4.1
      send: 41-41-33-0 s=255,c=3,t=6,pt=1,l=1,st=ok:33
      read: 0-33-41 s=255,c=3,t=6,pt=0,l=1:M
      send: 41-41-33-0 s=255,c=3,t=11,pt=0,l=15,st=ok:Temp and Relays
      send: 41-41-33-0 s=255,c=3,t=12,pt=0,l=3,st=ok:1.0
      send: 41-41-33-0 s=0,c=0,t=0,pt=0,l=5,st=ok:1.4.1
      send: 41-41-33-0 s=1,c=0,t=0,pt=0,l=5,st=ok:1.4.1
      send: 41-41-33-0 s=1,c=0,t=3,pt=0,l=5,st=ok:1.4.1
      send: 41-41-33-0 s=2,c=0,t=3,pt=0,l=5,st=ok:1.4.1
      send: 41-41-33-0 s=0,c=1,t=0,pt=7,l=5,st=ok:30.1
      send: 41-41-33-0 s=1,c=1,t=0,pt=7,l=5,st=ok:24.0
      read: 0-33-41 s=2,c=1,t=2,pt=0,l=1:1
      Incoming change for sensor:2, New status: 1
      send: 41-41-33-0 s=0,c=1,t=0,pt=7,l=5,st=ok:30.2
      send: 41-41-33-0 s=0,c=1,t=0,pt=7,l=5,st=ok:30.6
      send: 41-41-33-0 s=0,c=1,t=0,pt=7,l=5,st=ok:31.1
      send: 41-41-33-0 s=0,c=1,t=0,pt=7,l=5,st=ok:31.0
      send: 41-41-33-0 s=0,c=1,t=0,pt=7,l=5,st=ok:30.8
      send: 41-41-33-0 s=0,c=1,t=0,pt=7,l=5,st=ok:30.1
      send: 41-41-33-0 s=0,c=1,t=0,pt=7,l=5,st=ok:29.9
      send: 41-41-33-0 s=0,c=1,t=0,pt=7,l=5,st=ok:29.8
      send: 41-41-33-0 s=0,c=1,t=0,pt=7,l=5,st=ok:29.6
      send: 41-41-33-0 s=0,c=1,t=0,pt=7,l=5,st=ok:29.5
      send: 41-41-33-0 s=0,c=1,t=0,pt=7,l=5,st=ok:29.2
      send: 41-41-33-0 s=1,c=1,t=0,pt=7,l=5,st=ok:29.2
      send: 41-41-33-0 s=1,c=1,t=0,pt=7,l=5,st=ok:24.0
      send: 41-41-33-0 s=0,c=1,t=0,pt=7,l=5,st=ok:27.7
      send: 41-41-33-0 s=0,c=1,t=0,pt=7,l=5,st=ok:27.3
      send: 41-41-33-0 s=0,c=1,t=0,pt=7,l=5,st=ok:27.0
      send: 41-41-33-0 s=0,c=1,t=0,pt=7,l=5,st=ok:26.5
      read: 0-33-41 s=2,c=1,t=2,pt=0,l=1:0
      Incoming change for sensor:2, New status: 0
      send: 41-41-33-0 s=0,c=1,t=0,pt=7,l=5,st=ok:26.2
      send: 41-41-33-0 s=0,c=1,t=0,pt=7,l=5,st=ok:26.1
      send: 41-41-33-0 s=0,c=1,t=0,pt=7,l=5,st=ok:26.0
      send: 41-41-33-0 s=1,c=1,t=0,pt=7,l=5,st=ok:24.1
      send: 41-41-33-0 s=1,c=1,t=0,pt=7,l=5,st=ok:26.0
      send: 41-41-33-0 s=0,c=1,t=0,pt=7,l=5,st=ok:26.1
      send: 41-41-33-0 s=1,c=1,t=0,pt=7,l=5,st=ok:24.1
      send: 41-41-33-0 s=0,c=1,t=0,pt=7,l=5,st=ok:26.2
      send: 41-41-33-0 s=0,c=1,t=0,pt=7,l=5,st=ok:26.3
      send: 41-41-33-0 s=0,c=1,t=0,pt=7,l=5,st=ok:26.4
      send: 41-41-33-0 s=1,c=1,t=0,pt=7,l=5,st=ok:26.5
      send: 41-41-33-0 s=0,c=1,t=0,pt=7,l=5,st=ok:26.5
      send: 41-41-33-0 s=1,c=1,t=0,pt=7,l=5,st=ok:24.1
      send: 41-41-33-0 s=0,c=1,t=0,pt=7,l=5,st=ok:26.6
      send: 41-41-33-0 s=0,c=1,t=0,pt=7,l=5,st=ok:26.7
      send: 41-41-33-0 s=0,c=1,t=0,pt=7,l=5,st=ok:26.8
      send: 41-41-33-0 s=1,c=1,t=0,pt=7,l=5,st=ok:24.2
      send: 41-41-33-0 s=1,c=1,t=0,pt=7,l=5,st=ok:24.1
      send: 41-41-33-0 s=1,c=1,t=0,pt=7,l=5,st=ok:26.9
      send: 41-41-33-0 s=0,c=1,t=0,pt=7,l=5,st=ok:27.0
      send: 41-41-33-0 s=1,c=1,t=0,pt=7,l=5,st=ok:24.1
      send: 41-41-33-0 s=0,c=1,t=0,pt=7,l=5,st=ok:27.1
      send: 41-41-33-0 s=0,c=1,t=0,pt=7,l=5,st=ok:27.3
      send: 41-41-33-0 s=0,c=1,t=0,pt=7,l=5,st=ok:27.4
      send: 41-41-33-0 s=0,c=1,t=0,pt=7,l=5,st=ok:27.5
      send: 41-41-33-0 s=0,c=1,t=0,pt=7,l=5,st=ok:27.6
      send: 41-41-33-0 s=0,c=1,t=0,pt=7,l=5,st=ok:27.7
      send: 41-41-33-0 s=0,c=1,t=0,pt=7,l=5,st=ok:27.8
      send: 41-41-33-0 s=0,c=1,t=0,pt=7,l=5,st=ok:27.9
      send: 41-41-33-0 s=0,c=1,t=0,pt=7,l=5,st=ok:28.0
      send: 41-41-33-0 s=1,c=1,t=0,pt=7,l=5,st=ok:24.2
      send: 41-41-33-0 s=0,c=1,t=0,pt=7,l=5,st=ok:28.1
      send: 41-41-33-0 s=0,c=1,t=0,pt=7,l=5,st=ok:28.2
      send: 41-41-33-0 s=0,c=1,t=0,pt=7,l=5,st=ok:28.3
      send: 41-41-33-0 s=0,c=1,t=0,pt=7,l=5,st=ok:28.5
      send: 41-41-33-0 s=0,c=1,t=0,pt=7,l=5,st=ok:28.6
      send: 41-41-33-0 s=1,c=1,t=0,pt=7,l=5,st=ok:28.7
      send: 41-41-33-0 s=0,c=1,t=0,pt=7,l=5,st=ok:28.8
      send: 41-41-33-0 s=1,c=1,t=0,pt=7,l=5,st=ok:24.2
      send: 41-41-33-0 s=0,c=1,t=0,pt=7,l=5,st=ok:28.9
      send: 41-41-33-0 s=1,c=1,t=0,pt=7,l=5,st=ok:28.9
      send: 41-41-33-0 s=0,c=1,t=0,pt=7,l=5,st=ok:29.0
      send: 41-41-33-0 s=1,c=1,t=0,pt=7,l=5,st=ok:29.0
      send: 41-41-33-0 s=0,c=1,t=0,pt=7,l=5,st=ok:29.1
      send: 41-41-33-0 s=1,c=1,t=0,pt=7,l=5,st=ok:24.1
      send: 41-41-33-0 s=0,c=1,t=0,pt=7,l=5,st=ok:29.2
      send: 41-41-33-0 s=1,c=1,t=0,pt=7,l=5,st=ok:29.2
      send: 41-41-33-0 s=0,c=1,t=0,pt=7,l=5,st=ok:29.3
      send: 41-41-33-0 s=1,c=1,t=0,pt=7,l=5,st=ok:24.2
      send: 41-41-33-0 s=0,c=1,t=0,pt=7,l=5,st=ok:29.4
      send: 41-41-33-0 s=1,c=1,t=0,pt=7,l=5,st=ok:29.5
      send: 41-41-33-0 s=0,c=1,t=0,pt=7,l=5,st=ok:29.5
      send: 41-41-33-0 s=0,c=1,t=0,pt=7,l=5,st=ok:29.6
      send: 41-41-33-0 s=0,c=1,t=0,pt=7,l=5,st=ok:29.7
      send: 41-41-33-0 s=1,c=1,t=0,pt=7,l=5,st=ok:24.2
      send: 41-41-33-0 s=1,c=1,t=0,pt=7,l=5,st=ok:24.1
      send: 41-41-33-0 s=0,c=1,t=0,pt=7,l=5,st=ok:29.8
      send: 41-41-33-0 s=1,c=1,t=0,pt=7,l=5,st=ok:24.2
      send: 41-41-33-0 s=0,c=1,t=0,pt=7,l=5,st=ok:29.9
      send: 41-41-33-0 s=0,c=1,t=0,pt=7,l=5,st=ok:30.0
      send: 41-41-33-0 s=1,c=1,t=0,pt=7,l=5,st=ok:24.1
      send: 41-41-33-0 s=0,c=1,t=0,pt=7,l=5,st=ok:30.1
      send: 41-41-33-0 s=1,c=1,t=0,pt=7,l=5,st=ok:24.2
      send: 41-41-33-0 s=0,c=1,t=0,pt=7,l=5,st=ok:30.3
      read: 0-33-41 s=2,c=1,t=2,pt=0,l=1:1
      Incoming change for sensor:2, New status: 1
      

      As you can see, every once in a while S=1 reports the same value as S=0. I've tried to add a delay in the loop section, but without any luck. So now I'm stuck 😞

      posted in Troubleshooting
      Hausner
      Hausner
    • RE: Motion (PIR), actuator and Temp sensor

      Ok, finally got it to work with this:

      // Example sketch showing how to control physical relays. 
      // This example will remember relay state even after power failure.
      
      #include <MySensor.h>
      #include <SPI.h>
      #include <DallasTemperature.h>
      #include <OneWire.h>
      
      #define ONE_WIRE_BUS 3 // Pin where dallase sensor is connected 
      #define MAX_ATTACHED_DS18B20 16
      OneWire oneWire(ONE_WIRE_BUS);
      DallasTemperature sensors(&oneWire);
      float lastTemperature[MAX_ATTACHED_DS18B20];
      int numSensors=0;
      //boolean receivedConfig = false;
      boolean metric = true;
      #define RELAY_1 5  // Arduino Digital I/O pin number for first relay (second on pin+1 etc)
      #define RELAY_2 6
      #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
      
      // Motion sensor defs
      unsigned long SLEEP_TIME = 10000; // Sleep time between reports (in milliseconds)
      #define DIGITAL_INPUT_SENSOR 4   // 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 3   // Id of the sensor child
      
      boolean lastTrippedState;
      
      MySensor gw;
      //
      MyMessage msgTemp(0, V_TEMP);
      MyMessage msgRelay2(2, V_LIGHT);
      MyMessage msgMotion(3, V_TRIPPED);
      
      void setup()  
      {   
        gw.begin(incomingMessage, AUTO, true);
        gw.sendSketchInfo("Temp/Relay/Motion Sensor", "1.0");
        //
        gw.present(1, S_LIGHT);
        pinMode(RELAY_1, OUTPUT);
        //
        gw.present(2, S_LIGHT);
        pinMode(RELAY_2, OUTPUT);
        digitalWrite(RELAY_1, gw.loadState(1)? RELAY_ON : RELAY_OFF);
        digitalWrite(RELAY_2, gw.loadState(1)? RELAY_ON : RELAY_OFF);
        pinMode(DIGITAL_INPUT_SENSOR, INPUT);      // sets the motion sensor digital pin as input
        //
        gw.present(CHILD_ID, S_MOTION);
        
        // Fetch the number of attached temperature sensors  
        //numSensors = sensors.getDeviceCount();
      
        // Present all sensors to controller
        //for (int i=0; i<numSensors && i<MAX_ATTACHED_DS18B20; i++) {   
           gw.present(0, S_TEMP);
        //}
      }
      //
      void loop() 
      {
        gw.process();
        boolean tripped = digitalRead(DIGITAL_INPUT_SENSOR) == HIGH;
        if (tripped != lastTrippedState)
        {  
          Serial.println(tripped? "tripped" : "not tripped");
          gw.send(msgMotion.set(tripped?"1":"0"));  // Send tripped value to gw//
          //digitalWrite(RELAY_1, tripped? 1 : 0);
        }
        lastTrippedState = tripped;
        
        // Fetch temperatures from Dallas sensors
        sensors.requestTemperatures(); 
      
        // Read temperatures and send them to controller 
        //for (int i=0; i<numSensors && i<MAX_ATTACHED_DS18B20; i++) {
      
          // Fetch and round temperature to one decimal
          float temperature = static_cast<float>(static_cast<int>((gw.getConfig().isMetric?sensors.getTempCByIndex(0):sensors.getTempFByIndex(0)) * 10.)) / 10.;
      
          // Only send data if temperature has changed more then 1 degC and no error
          if (int(lastTemperature[0]) != int(temperature) && temperature != -127.00) { //added integer
      
            // Send in the new temperature
            gw.send(msgTemp.setSensor(0).set(temperature,1));
            lastTemperature[0]=temperature;
          }
         //}
      }
      
      void incomingMessage(const MyMessage &message) {
        // 
        if (message.type==V_LIGHT && message.sensor == 2) 
        {
          // Change relay state
          digitalWrite(RELAY_2, message.getBool()?RELAY_ON:RELAY_OFF);
          // Store state in eeprom
          gw.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());
        }
      }
      
      posted in Hardware
      Hausner
      Hausner
    • RE: Sensebender Micro

      Would this work with a 3,7V Li-Ion 18650 cell? Because I've got a S... load from old laptops

      posted in Announcements
      Hausner
      Hausner
    • RE: Motion (PIR), actuator and Temp sensor

      @hek said:

      If you want to sleep the node, then using pin-interrrupt is a great way of waking the node when motion is detected.

      You can use use the radio-irq pin for you sensors. It is currently not used by the mysensors library.

      So, not need to wire the radio IRQ PIN at all?

      posted in Hardware
      Hausner
      Hausner
    • RE: Motion (PIR), actuator and Temp sensor

      Ok, so basicly you are saying, that the PIR DOESN'T require an irq pin on the arduino?

      posted in Hardware
      Hausner
      Hausner
    • Motion (PIR), actuator and Temp sensor

      Hi,

      I'm trying to make and sensor, as subject says. I've got temp (DS18B20) and actuator working, but not the PIR (HC-SR501).

      PINs as follow:
      RADIO IRQ = PIN2
      Temp = PIN3
      PIR data = PIN4
      Actuator = PIN 5,6

      My question is now, does a PIR require an Interrupt PIN on the arduino (PIN 2,3) , or can I use any PIN?

      posted in Hardware
      Hausner
      Hausner
    • RE: Monitor a DIY solarpanel with ASC712 - HELP

      No, serial monitor was just for testing. I would like to push it to mqtt.

      I found the V_VOLTAGE and V_CURRENT, and the serial monotir showed up correctly as 38/39.

      posted in Troubleshooting
      Hausner
      Hausner
    • Monitor a DIY solarpanel with ASC712 - HELP

      Has anyone gotten a ASC712 to work with a actuator node?

      I'm trying to monitor my diy solar panel, so that I can see what it is producing(if).

      I've tried with the code below, but I can't get the node to send the readings to the gateway. I'm using a 30A ASC712 to do the readings. (Don't mind the motion sensor part).

      My last code:

      // Example sketch showing how to control physical relays. 
      // This example will remember relay state even after power failure.
      
      #include <MySensor.h>
      #include <SPI.h>
      const int analogIn = A0;
      int mVperAmp = 66; // use 100 for 20A Module and 66 for 30A Module
      int RawValue= 0;
      int ACSoffset = 2500; 
      double Voltage = 0;
      double Amps = 0;
      double Voltage_new = 0;
      double Amps_new = 0;
      
      #define RELAY_1 6  // Arduino Digital I/O pin number for first relay (second on pin+1 etc)
      #define NUMBER_OF_RELAYS 2 // 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
      
      // Motion sensor defs
      unsigned long SLEEP_TIME = 10000; // Sleep time between reports (in milliseconds)
      #define DIGITAL_INPUT_SENSOR 3   // The digital input you attached your motionsensor.  (Only 2 and 3 generates interrupt!)
      #define INTERRUPT DIGITAL_INPUT_SENSOR-2 // Usually the interrupt = pin -2 (on uno/nano anyway)
      #define CHILD_ID 3   // Id of the sensor child
      volatile int state = LOW;
      boolean lockLow = true;
      boolean lastTripped = 0;
      
      MySensor gw;
      MyMessage msgMotion(CHILD_ID, V_TRIPPED);
      MyMessage msgvolt(4, V_VOLTAGE);
      MyMessage msgcur(5, V_CURRENT);
      MyMessage msg(CHILD_ID, V_LIGHT);
      
      void setup()  
      {   
        // Initialize library and add callback for incoming messages
        gw.begin(incomingMessage, AUTO, true);
        // Send the sketch version information to the gateway and Controller
        gw.sendSketchInfo("Relay/Motion Sensor", "1.0");
      
        // Fetch relay status
        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)
          gw.present(sensor, S_LIGHT);
          // Then set relay pins in output mode
          pinMode(pin, OUTPUT);   
          // Set relay to last known state (using eeprom storage) 
          digitalWrite(pin, gw.loadState(sensor)?RELAY_ON:RELAY_OFF);
        }
        
        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);
        // attachInterrupt(DIGITAL_INPUT_SENSOR, ON, CHANGE);
        //delay(30000);
        gw.present(4, V_VOLTAGE);
        gw.present(5, V_CURRENT);
      }
      
      
      void loop() 
      {
        // Alway process incoming messages whenever possible
        gw.process();
      
        //boolean tripped = (digitalRead(DIGITAL_INPUT_SENSOR) == HIGH);
        //  if (lastTripped != tripped ) {
      //	gw.send(msgMotion.set(tripped?"1":"0")); // Send new state
      //	lastTripped=tripped;
      //   }
        
        //Serial.print("Raw Value = " ); // shows pre-scaled value 
        //Serial.print(RawValue);
        //gw.send(msgvolt);
        //Serial.print("\t mV = "); // shows the voltage measured 
        //Serial.print(Voltage,3); // the '3' after voltage allows you to display 3 digits after decimal point
        //Serial.print("\t Amps = "); // shows the voltage measured
        for ( int i=0; i<=20; i++ ){
          RawValue += analogRead(analogIn);
          delay(50);
        }
        Voltage = (RawValue / 1023.0) * 5000; // Gets you mV
        Amps = ((Voltage - ACSoffset) / mVperAmp);
        
        //gw.send(msgcur);
        Serial.print("mV = "); // shows the voltage measured
        Serial.println(Voltage);
        //Serial.println(Amps,3); // the '3' after voltage allows you to display 3 digits after             decimal point
        //delay(2500);
      }
      void incomingMessage(const MyMessage &message) {
        // We only expect one type of message from controller. But we better check anyway.
       if (message.type==V_LIGHT) {
       // Change relay state
       digitalWrite(message.sensor-1+RELAY_1, message.getBool()?RELAY_ON:RELAY_OFF);
       // Store state in eeprom
       gw.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());
       }
      }
      

      Any help would be appreciated 🙂

      PS: Att HEK - why isn't there a "insert code" button, just like the "insert link" button?

      posted in Troubleshooting
      Hausner
      Hausner
    • RE: Motion/actuator sensor

      Turned out that the Nano was faulty.

      I rebuilded the setup with a new Nano, and it's now working as designed 🙂

      posted in Troubleshooting
      Hausner
      Hausner
    • RE: Motion/actuator sensor

      @jendrush said:

      @Hausner Have you considered sensor failure?

      Yes, but I've tried to load the default actuator and motion sensor sketches from the library, and both works fine, so I don't think I have faulty sensors.

      posted in Troubleshooting
      Hausner
      Hausner
    • Motion/actuator sensor

      Hi

      I need some help now. I have been staring at the below code for quiet some time now, but I just can find the error.

      The code should be sending a tripped signal to the controller, and the controller should return an ON/OFF to 1 of the 2 actuators. I can control the actuators just fine ON/OFF from the controller, but the motion sensor then start to flip HIGH/LOW at the interval assigned from the sensitivity potmeter.

      Here is the code

        #include <MySensor.h>
        #include <SPI.h>
      
       #define RELAY_1 6  // Arduino Digital I/O pin number for first relay (second on pin+1 etc)
       #define NUMBER_OF_RELAYS 2 // 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
      
        // Motion sensor defs
        unsigned long SLEEP_TIME = 10000; // 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 3   // Id of the sensor child
      volatile int state = LOW;
      boolean lockLow = true;
      boolean lastTripped = 0;
      
      MySensor gw;
      MyMessage msgMotion(CHILD_ID, V_TRIPPED);
      //MyMessage msgRelay(CHILD_ID, V_LIGHT);
      MyMessage msg(CHILD_ID, V_LIGHT);
      
      void setup()  
      {   
      // Initialize library and add callback for incoming messages
        gw.begin(incomingMessage, AUTO, true);
        // Send the sketch version information to the gateway and Controller
        gw.sendSketchInfo("Relay/Motion Sensor", "1.0");
      
        // Fetch relay status
        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)
      gw.present(sensor, S_LIGHT);
      // Then set relay pins in output mode
      pinMode(pin, OUTPUT);   
      // Set relay to last known state (using eeprom storage) 
      digitalWrite(pin, gw.loadState(sensor)?RELAY_ON:RELAY_OFF);
       }
      
        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);
      // attachInterrupt(DIGITAL_INPUT_SENSOR, ON, CHANGE);
      delay(30000);
      }
      
      
      void loop() 
      {
      // Alway process incoming messages whenever possible
      gw.process();
      
      boolean tripped = (digitalRead(DIGITAL_INPUT_SENSOR) == HIGH);
      if (lastTripped != tripped ) {
      gw.send(msgMotion.set(tripped?"1":"0")); // Send new state
      lastTripped=tripped;
       }
      }
      
      
      void incomingMessage(const MyMessage &message) {
      // We only expect one type of message from controller. But we better check anyway.
       if (message.type==V_LIGHT) {
       // Change relay state
       digitalWrite(message.sensor-1+RELAY_1, message.getBool()?RELAY_ON:RELAY_OFF);
       // Store state in eeprom
       gw.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());
       }
      }
      

      With the above code I get this on the sensor serial:

      send: 30-30-0-0 s=3,c=1,t=16,pt=0,l=1,st=ok:0
      send: 30-30-0-0 s=3,c=1,t=16,pt=0,l=1,st=ok:1
      send: 30-30-0-0 s=3,c=1,t=16,pt=0,l=1,st=ok:0
      send: 30-30-0-0 s=3,c=1,t=16,pt=0,l=1,st=ok:1
      send: 30-30-0-0 s=3,c=1,t=16,pt=0,l=1,st=ok:0
      send: 30-30-0-0 s=3,c=1,t=16,pt=0,l=1,st=ok:1
      send: 30-30-0-0 s=3,c=1,t=16,pt=0,l=1,st=ok:0
      send: 30-30-0-0 s=3,c=1,t=16,pt=0,l=1,st=ok:1
      send: 30-30-0-0 s=3,c=1,t=16,pt=0,l=1,st=ok:0
      send: 30-30-0-0 s=3,c=1,t=16,pt=0,l=1,st=ok:1
      send: 30-30-0-0 s=3,c=1,t=16,pt=0,l=1,st=ok:0
      send: 30-30-0-0 s=3,c=1,t=16,pt=0,l=1,st=ok:1

      every ~4 second.. PLS help 🙂

      posted in Troubleshooting
      Hausner
      Hausner
    • RE: Looking for Case, Battery and PCB for Window Sensor with Tempsens and Battery measurement

      Yes there is:

      http://www.aliexpress.com/wholesale?catId=0&initiative_id=SB_20150202022329&SearchText=AA+battery+holder

      posted in Hardware
      Hausner
      Hausner
    • Light motion sensor i "bedroom"

      Hi

      I'm looking for ideas to place a motion detector to control the ceilinglight in a childrooom.

      What I would like is a arduino with a relay controlled by a controller, in my case openhab, but, what I need is:

      1. ability to be controlled by controller ON/OFF (got it covered)
      2. ability to react on motion - how should this be done at nighttime, not turning on the light when the kid turns in bed? (NOT covered)
      3. scheduled ON/OFF (got it covered)

      Have you done anything similar, then I would appreciate some hints to get my project moving, as i'm stuck at #2 🙂

      posted in General Discussion
      Hausner
      Hausner
    • RE: DIY Outdoor LED

      I have done something like this on my shed, to light up the pathway running beside the it.

      I bought 20 1W LED's on aliexpress http://www.aliexpress.com/item/New-10x-1W-High-Brightness-LED-Flood-Light-Lamp-Bulb-90-100Lm-Warm-White-3-2/32223688453.html (they can be found cheaper a piece if you buy more)

      Only diffence is, that I get the 12v power from a car battery, but it's still 12v. (battery charged by solarcells) The 4 serial connected LED's used to light the pathway connects to 12v via a relayswitch controlled by a arduino mini pro. Which again is controllede via openhab MQTT.

      posted in General Discussion
      Hausner
      Hausner
    • RE: 230V power supply to Arduino

      I have with succes used these:

      http://www.aliexpress.com/item/Travel-Convenient-EU-Plug-Wall-USB-Charger-Adapter-For-Samsung-Galaxy-S5-S4-S3-Note-3/32220133044.html

      They are really easy to dismatle, and the result is this - https://www.dropbox.com/s/ep43uyve5v0msv6/20141206_214210.jpg?dl=0

      At $1.10 I didn't even think about making my own PSU 🙂

      posted in Hardware
      Hausner
      Hausner
    • RE: Non Polarized Capacitor .22 uF rated 400 volt

      The plan is to make some LED lights without the need for a wall plug transformer, as they take up space and are fairly hard to hide away.

      So I'm planning to make some small 220vac->12/5vdc converters with as little components as possible.

      Link to plan: http://www.instructables.com/id/LED-TUBE-LGHT-AC/

      posted in Hardware
      Hausner
      Hausner
    • RE: Non Polarized Capacitor .22 uF rated 400 volt

      Thank you for pointing me in the right direction.

      Do you think this will do? http://dk.farnell.com/vishay-roederstein/f17724222000/cap-film-pet-220nf-400vac-rad/dp/1612245?ost=0.22uF+400vac

      posted in Hardware
      Hausner
      Hausner
    • Non Polarized Capacitor .22 uF rated 400 volt

      Hi,

      Does anyone know where I can find some Non Polarized Capacitor .22 uF rated 400 volt?

      I live in Europe, so anything from there would be nice 🙂

      I'm trying to make some 220v LED lights, as in NO trafo/adaptor for the light, just straight to the wall outlet.

      posted in Hardware
      Hausner
      Hausner
    • RE: mqtt/ethernet gateway - node id?

      I have openhab too and it works fine.

      Have you checked that openhab has connected to the mqtt gateway?

      posted in Controllers
      Hausner
      Hausner
    • RE: mqtt/ethernet gateway - node id?

      You have to set them yourself, unless you have controller

      posted in Controllers
      Hausner
      Hausner
    • RE: Communication problem (maybe)

      @daulagari

      Thank you. I'm gonna try with this

      if (abs(lastTemperature[i] - temperature) >= 0.2 && temperature != -127.00) {
      posted in Troubleshooting
      Hausner
      Hausner
    • RE: Motion, Temperature and Relay in 1 node

      Cool 🙂

      This is my initial sketch, but i'm still tuning it.
      http://forum.mysensors.org/topic/597/motion-relay-sensor-sketch-help

      I need to figure out only to send GW messages on an update.

      posted in Hardware
      Hausner
      Hausner
    • Motion/Relay sensor sketch help

      Hi

      This is my attempt do merge the motion and relay actuator sketch.

      It's working, but I had tp put in some delays, so I didn't get flooded with log updates.

      The goal with this is to have the arduino mini pro control a PiR and a 2 channel relay. The PiR should trigger relay_1 and my controller should be in control over relay_2.

      It, to my BIG supprise, actually work! But I don't think that the code is no way near optimal! So what I would like, is some optimization hits/examples.

      Here's the sketch:

       // Example sketch showing how to control physical relays. 
       // This example will remember relay state even after power failure.
       
       #include <MySensor.h>
       #include <SPI.h>
       
       #define RELAY_1 6  // Arduino Digital I/O pin number for first relay (second on pin+1 etc)
       #define NUMBER_OF_RELAYS 2 // 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
       
       // Motion sensor defs
       unsigned long SLEEP_TIME = 10000; // 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 3   // Id of the sensor child
       
       MySensor gw;
       MyMessage msg(CHILD_ID, V_TRIPPED);
       
       void setup()  
       {   
         // Initialize library and add callback for incoming messages
         gw.begin(incomingMessage, AUTO, true);
         // Send the sketch version information to the gateway and Controller
         gw.sendSketchInfo("Relay/Motion Sensor", "1.0");
       
         // Fetch relay status
         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)
           gw.present(sensor, S_LIGHT);
           // Then set relay pins in output mode
           pinMode(pin, OUTPUT);   
           // Set relay to last known state (using eeprom storage) 
           digitalWrite(pin, gw.loadState(sensor)?RELAY_ON:RELAY_OFF);
         }
         
         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() 
       {
         // Alway process incoming messages whenever possible
         gw.process();
         
         // Read digital motion value
         if (digitalRead(DIGITAL_INPUT_SENSOR) == HIGH) {
           boolean tripped = digitalRead(DIGITAL_INPUT_SENSOR) == HIGH;       
           Serial.println(tripped);
           gw.send(msg.set(tripped?"1":"0"));  // Send tripped value to gw
           //gw.sleep(INTERRUPT,CHANGE, SLEEP_TIME);
           digitalWrite(RELAY_1, 1);
           delay(5000);
         } else {
           digitalWrite(RELAY_1, 0);
           boolean tripped = digitalRead(DIGITAL_INPUT_SENSOR) == LOW;
           delay(5000);
           gw.send(msg.set(tripped?"1":"0"));  // Send tripped value to gw
         }
       }
       
       void incomingMessage(const MyMessage &message) {
         // We only expect one type of message from controller. But we better check anyway.
         if (message.type==V_LIGHT) {
            // Change relay state
            digitalWrite(message.sensor-1+RELAY_1, message.getBool()?RELAY_ON:RELAY_OFF);
            // Store state in eeprom
            gw.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());
          }
        }
      posted in Development
      Hausner
      Hausner
    • RE: Motion, Temperature and Relay in 1 node

      @tbowmo

      Yes, I was aware of the necessary wallplug, but that is OK as I would need to run the mains power to the relay anyway.

      Well, I better start coding then 🙂

      posted in Hardware
      Hausner
      Hausner
    • Motion, Temperature and Relay in 1 node

      Hi,

      I've been thinking about building motion, temperature and relay in 1 node, but would that be possible with a mini pro or a nano?

      posted in Hardware
      Hausner
      Hausner
    • RE: Communication problem (maybe)

      It isn't??

      hmm... now i'm puzzled!

      Cause this is 2 temp nodes

      0;0;3;0;9;read: 24-23-0 s=0,c=1,t=0,pt=7,l=5:23.8
      

      My relay actuator is 22

      posted in Troubleshooting
      Hausner
      Hausner
    • RE: Communication problem (maybe)

      @hek said:

      delay(10)

      I assume that is milliseconds, but does that mean that the radio will be powered on during that delay, and will the node repeat incoming messages during that?

      If so, I think a much bigger delay would be better, like 30000 or even more.

      posted in Troubleshooting
      Hausner
      Hausner
    • RE: Communication problem (maybe)

      @hek

      Because it looks like that the sleep function is messing with the repeater function. With sleep enabled, almost all messages to the relay actuator node gets lost.

      posted in Troubleshooting
      Hausner
      Hausner
    • RE: Communication problem (maybe)

      Temperatur sensor

       // Example sketch showing how to send in OneWire temperature readings
       #include <MySensor.h>  
       #include <SPI.h>
       #include <DallasTemperature.h>
       #include <OneWire.h>
       
       #define ONE_WIRE_BUS 3 // Pin where dallase sensor is connected 
       #define MAX_ATTACHED_DS18B20 16
       unsigned long SLEEP_TIME = 30000; // Sleep time between reads (in milliseconds)
       OneWire oneWire(ONE_WIRE_BUS);
       DallasTemperature sensors(&oneWire);
       MySensor gw;
       float lastTemperature[MAX_ATTACHED_DS18B20];
       int numSensors=0;
       boolean receivedConfig = false;
       boolean metric = true; 
       // Initialize temperature message
       MyMessage msg(0,V_TEMP);
       
       //int BATTERY_SENSE_PIN = A0; // select the input pin for the battery sense point
       //int oldBatteryPcnt = 0;
       
       void setup()  
       { 
         // Startup OneWire 
         sensors.begin();
       
         // Startup and initialize MySensors library. Set callback for incoming messages. 
         gw.begin(); 
       
         // Send the sketch version information to the gateway and Controller
         gw.sendSketchInfo("Temperature Sensor", "1.0");
       
         // Fetch the number of attached temperature sensors  
         numSensors = sensors.getDeviceCount();
       
         // Present all sensors to controller
         for (int i=0; i<numSensors && i<MAX_ATTACHED_DS18B20; i++) {   
            gw.present(i, S_TEMP);
         }
         
         // use the 1.1 V internal reference
         //analogReference(INTERNAL);
       }
       
       
       void loop()     
       {     
         // Process incoming messages (like config from server)
         gw.process(); 
       
         // Fetch temperatures from Dallas sensors
         sensors.requestTemperatures(); 
      
         // Read temperatures and send them to controller 
         for (int i=0; i<numSensors && i<MAX_ATTACHED_DS18B20; i++) {
      
         // Fetch and round temperature to one decimal
         float temperature = static_cast<float>(static_cast<int>  ((gw.getConfig().isMetric?sensors.getTempCByIndex(i):sensors.getTempFByIndex(i)) * 10.)) / 10.;
      
      // Only send data if temperature has changed and no error
      if (lastTemperature[i] != temperature && temperature != -127.00) {
      
        // Send in the new temperature
        gw.send(msg.setSensor(i).set(temperature,1));
        lastTemperature[i]=temperature;
      }
         }
      
      // get the battery Voltage
      //int sensorValue = analogRead(BATTERY_SENSE_PIN);
      //Serial.println(sensorValue);
      // 1M, 470K divider across battery and using internal ADC ref of 1.1V
      // Sense point is bypassed with 0.1 uF cap to reduce noise at that point
       // ((1e6+470e3)/470e3)*1.1 = Vmax = 3.44 Volts
       // 3.44/1023 = Volts per bit = 0.003363075
      //float batteryV = sensorValue * 0.004106;
      //int batteryPcnt = sensorValue / 10;
       //Serial.print("Battery Voltage: ");
         //Serial.print(batteryV);
         //Serial.println(" V");
         //Serial.print("Battery percent: ");
         //Serial.print(batteryPcnt);
         //Serial.println(" %");
         //if (oldBatteryPcnt != batteryPcnt) {
         // Power up radio after sleep
         //gw.sendBatteryLevel(batteryPcnt);
         //oldBatteryPcnt = batteryPcnt;
         //}
      
         //gw.sleep(SLEEP_TIME);
       }
      

      The temp sensor has been build according to this: http://mysensors.org/build/temp
      1 small exception though. I have used 5v->3.3v aparters for the radios, but that shouldn't matter.
      10Pcs-lot-Socket-Adapter-Plate-Board-For-8Pin-NRF24L01-Wireless-Transceive-Module-51-Free-Shipping.jpg

      posted in Troubleshooting
      Hausner
      Hausner
    • RE: Communication problem (maybe)

      @daulagari

      By 1-way node I mean a reporting node. It only reports a temperature, nothing else. So therefore 1 way traffic TO the GW/controller.

      A relay node on the other hand has to receive also, else you can't flip on/off the relays.

      This is roughly 1 minute worth of controller log:

       2014-11-13 04:49:27 - Helena_temp_LastUpdate state updated to 2014-11-13T04:49:27
       2014-11-13 04:49:28 - Temperature_GF_Helena state updated to 26.7
       2014-11-13 04:49:28 - Helena_temp_LastUpdate state updated to 2014-11-13T04:49:28
       2014-11-13 04:49:29 - Temperature_GF_Helena state updated to 26.6
       2014-11-13 04:49:29 - Helena_temp_LastUpdate state updated to 2014-11-13T04:49:29
       2014-11-13 04:49:30 - Temperature_GF_Helena state updated to 26.7
       2014-11-13 04:49:30 - Helena_temp_LastUpdate state updated to 2014-11-13T04:49:30
       2014-11-13 04:49:39 - Temperature_GF_Helena state updated to 26.6
       2014-11-13 04:49:39 - Helena_temp_LastUpdate state updated to 2014-11-13T04:49:39
       2014-11-13 04:50:07 - Temperature_GF_Living state updated to 24.3
       2014-11-13 04:50:07 - Living_temp_LastUpdate state updated to 2014-11-13T04:50:07
       2014-11-13 04:50:08 - Temperature_GF_Living state updated to 24.2
       2014-11-13 04:50:08 - Living_temp_LastUpdate state updated to 2014-11-13T04:50:08
       2014-11-13 04:50:12 - Temperature_GF_Living state updated to 24.3
       2014-11-13 04:50:12 - Living_temp_LastUpdate state updated to 2014-11-13T04:50:12
       2014-11-13 04:50:14 - Temperature_GF_Living state updated to 24.2
       2014-11-13 04:50:14 - Living_temp_LastUpdate state updated to 2014-11-13T04:50:14
       2014-11-13 04:50:15 - Temperature_GF_Helena state updated to 26.7
       2014-11-13 04:50:15 - Helena_temp_LastUpdate state updated to 2014-11-13T04:50:15
       2014-11-13 04:50:16 - Temperature_GF_Helena state updated to 26.6
       2014-11-13 04:50:16 - Helena_temp_LastUpdate state updated to 2014-11-13T04:50:16
       2014-11-13 04:50:16 - Temperature_GF_Living state updated to 24.3
       2014-11-13 04:50:16 - Living_temp_LastUpdate state updated to 2014-11-13T04:50:16
       2014-11-13 04:50:16 - Temperature_GF_Living state updated to 24.2
       2014-11-13 04:50:16 - Living_temp_LastUpdate state updated to 2014-11-13T04:50:16
       2014-11-13 04:50:18 - Temperature_GF_Living state updated to 24.3
       2014-11-13 04:50:18 - Living_temp_LastUpdate state updated to 2014-11-13T04:50:18
       2014-11-13 04:50:19 - Temperature_GF_Helena state updated to 26.7
       2014-11-13 04:50:19 - Helena_temp_LastUpdate state updated to 2014-11-13T04:50:19
       2014-11-13 04:50:20 - Temperature_GF_Helena state updated to 26.6
       2014-11-13 04:50:20 - Helena_temp_LastUpdate state updated to 2014-11-13T04:50:20
       2014-11-13 04:50:20 - Temperature_GF_Living state updated to 24.2
       2014-11-13 04:50:20 - Living_temp_LastUpdate state updated to 2014-11-13T04:50:20
       2014-11-13 04:50:20 - Temperature_GF_Helena state updated to 26.7
       2014-11-13 04:50:20 - Helena_temp_LastUpdate state updated to 2014-11-13T04:50:20
       2014-11-13 04:50:20 - Temperature_GF_Living state updated to 24.3
       2014-11-13 04:50:20 - Living_temp_LastUpdate state updated to 2014-11-13T04:50:20
       2014-11-13 04:50:22 - Temperature_GF_Helena state updated to 26.6
       2014-11-13 04:50:22 - Helena_temp_LastUpdate state updated to 2014-11-13T04:50:22
       2014-11-13 04:50:23 - Temperature_GF_Living state updated to 24.2
       2014-11-13 04:50:23 - Living_temp_LastUpdate state updated to 2014-11-13T04:50:23
       2014-11-13 04:50:24 - Temperature_GF_Living state updated to 24.3
       2014-11-13 04:50:24 - Living_temp_LastUpdate state updated to 2014-11-13T04:50:24
       2014-11-13 04:50:26 - Temperature_GF_Helena state updated to 26.7
       2014-11-13 04:50:26 - Helena_temp_LastUpdate state updated to 2014-11-13T04:50:26
       2014-11-13 04:50:26 - Temperature_GF_Living state updated to 24.2
       2014-11-13 04:50:26 - Living_temp_LastUpdate state updated to 2014-11-13T04:50:26
       2014-11-13 04:50:27 - Temperature_GF_Living state updated to 24.3
       2014-11-13 04:50:27 - Living_temp_LastUpdate state updated to 2014-11-13T04:50:27
       2014-11-13 04:50:29 - Temperature_GF_Helena state updated to 26.6
       2014-11-13 04:50:29 - Helena_temp_LastUpdate state updated to 2014-11-13T04:50:29
      

      As you can see i'm getting way more than 1 reading a second. I think this is happening because of the rounding up/down of the temperature readings.

      posted in Troubleshooting
      Hausner
      Hausner
    • RE: Communication problem (maybe)

      UPDATE:

      I was getting a bit frustrated with the relay node not working, so as a last resort, i decided to reset all the nodes. Starting with the temp nodes and the relay at the end.

      And I'll be damned! The system has now been running 3-4 hours with only a single hickup! (a relay failed on first request)

      So this tells me, that if you only have "1-way send" battery nodes in the mesh eg. temp sensors, then the "intelligent" mesh works fine, but as soon as you introduce main powered "recieve" nodes to the setup, it starts to fail (big time!). So pgo, you were right! I have just seen the same as you.

      At the temp sensors, I have removed the sleep command. The only problem now is that i'm getting flooded with temp readings! Anyone know of a simple solution to only have reading every 1 min without killing the radio?

      posted in Troubleshooting
      Hausner
      Hausner
    • RE: Communication problem (maybe)

      I have now converted the 3 temp sensors to mains power and removed the sleep function, but the problem is still the same 😞

      I even let the temp nodes be repeaters! I looks like the GW can't SEND to the nodes, receiving is just fine. I'm getting "spammed" with temp readings atm.

      I have already tried with a CAP on the GW radio, but still out of luck 😞

      Somehow this tells me, that mysensors is not for me 😞

      posted in Troubleshooting
      Hausner
      Hausner
    • RE: Communication problem (maybe)

      @pgo

      Yes, I have 3 temp nodes running on battery which uses the sleepmode.

      But it doesn't matter if they are runnig or not, the result with the relay node is the same. With the battery nodes offline it does however seem more stable. At least I can get 3-4 times as many relay on/off before it fails.

      I'm running the default MQTT GW, DallasTemperature Nodes and Relaynode sketches. OpenHAB as controller.

      Something tells me, that I might have to go back to the serial GW on a Raspberry and then use the GPIO pins to control the relay. When that was running, I never had a single problem with messages getting dropped.

      posted in Troubleshooting
      Hausner
      Hausner
    • RE: Communication problem (maybe)

      @niccodemi said:

      Same here, relay is powered separately.

      Do you have the arduino and relay on shared GND?

      posted in Troubleshooting
      Hausner
      Hausner
    • RE: Communication problem (maybe)

      I first tried with the nano, but (ofcause) that was insuffient.

      So now the 8-channel relay is powered externally, via JD-VCC and GND. The nano has a 5v to the 5v on the relay pin which is next to the INx pins. Nothing on the GND.

      posted in Troubleshooting
      Hausner
      Hausner
    • RE: Communication problem (maybe)

      Yes, I figured that out, but the problem is still there...

      Only 5-10 relay on/off, then it fails.

      It actually looks like the GW never sends the new status. I see faild on GW, but nothing on the node?

      posted in Troubleshooting
      Hausner
      Hausner
    • RE: Communication problem (maybe)

      I only see version 1.4 on the download page. 😞

      posted in Troubleshooting
      Hausner
      Hausner
    • Communication problem (maybe)

      Hi,

      I have a UNO R3 as a MQTT GW and some temp sensors (mini pro 5v) and 1 actuator relay sensor (a nano).

      The problem is that the comm to the actuator node keeps "partly" dropping out. Yes, I know it sound wierd, but this is what happens.

      On relay actuator powerup, everything works as planned. I can see the relay on the GW console. The temp sensors then use the relay actuator sensor as a repeater to report temp. It all works. So far so good.

      Now, if I send some commands to the relay actuator (switch on a relay) it works, but no more than 5-10 times, then the GW reports

         <<30 16 00 13 4D 79 4D 51 54 54 2F 32 32 2F 32 2F 56 5F 4C 49 47 48 54 30 
        0;0;3;0;9;send: 0-0-22-22 s=2,c=1,t=2,pt=0,l=1,st=fail:0
      

      The relay node however keeps functioning as a repeater node, even though, it has stopped to respond on actuator "SET" commands.

      This is the relay actuator booting seen from the GW

         0;0;3;0;9;read: 22-22-0 s=255,c=0,t=18,pt=0,l=3:1.4
         0;0;3;0;9;read: 22-22-0 s=255,c=3,t=6,pt=1,l=1:0
         0;0;3;0;9;send: 0-0-22-22 s=255,c=3,t=6,pt=0,l=1,st=ok:M
         0;0;3;0;9;read: 22-1-0 s=255,c=3,t=6,pt=1,l=1:0
         0;0;3;0;9;send: 0-0-1-22 s=255,c=3,t=6,pt=0,l=1,st=fail:M
         0;0;3;0;9;read: 22-22-0 s=255,c=3,t=11,pt=0,l=5:Relay
         0;0;3;0;9;read: 22-22-0 s=255,c=3,t=12,pt=0,l=3:1.0
         0;0;3;0;9;read: 22-22-0 s=1,c=0,t=3,pt=0,l=3:1.4
         0;0;3;0;9;read: 22-22-0 s=2,c=0,t=3,pt=0,l=3:1.4
         0;0;3;0;9;read: 22-22-0 s=3,c=0,t=3,pt=0,l=3:1.4
         0;0;3;0;9;read: 22-22-0 s=4,c=0,t=3,pt=0,l=3:1.4
         0;0;3;0;9;read: 22-22-0 s=5,c=0,t=3,pt=0,l=3:1.4
      

      and seen from the node:

       repeater started, id 22
       send: 22-22-0-0 s=255,c=0,t=18,pt=0,l=3,st=ok:1.4
       send: 22-22-0-0 s=255,c=3,t=6,pt=1,l=1,st=ok:0
       read: 0-0-22 s=255,c=3,t=6,pt=0,l=1:M
       send: 22-22-0-0 s=255,c=3,t=11,pt=0,l=5,st=ok:Relay
       send: 22-22-0-0 s=255,c=3,t=12,pt=0,l=3,st=ok:1.0
       send: 22-22-0-0 s=1,c=0,t=3,pt=0,l=3,st=ok:1.4
       send: 22-22-0-0 s=2,c=0,t=3,pt=0,l=3,st=ok:1.4
       send: 22-22-0-0 s=3,c=0,t=3,pt=0,l=3,st=ok:1.4
       send: 22-22-0-0 s=4,c=0,t=3,pt=0,l=3,st=ok:1.4
       send: 22-22-0-0 s=5,c=0,t=3,pt=0,l=3,st=ok:1.4
      

      The GW and relay node are now only 20cm apart because I thought it could be a bad signal problem, but then again, it works fine in it's original place when it's only repeating temp sensors. As soon as I send the actuator "switch on" commands, the relay actuator part starts to fail.

      Any advise would be highly appreciated 🙂

      posted in Troubleshooting
      Hausner
      Hausner
    • RE: MQTT batterylevel reporting

      I'm using OpenHab as controller.

      It worked pretty good when i had a raspberry as a serial gateway reporting to Openhab, but now I've switched to a MQTT gateway on an UNO. That works fine for a few temp sensors, but i'm having serious trouble getting a 8-channel relay node to work. It works for about 1-2 hours then it stops responding 😞 Then i have to powercycle it, to get it running again.

      Currently the temp sensors report this:

      0;0;3;0;9;read: 1-1-0 s=255,c=3,t=0,pt=1,l=1:81
      

      for a battery reading (81%).

      posted in OpenHAB
      Hausner
      Hausner
    • MQTT batterylevel reporting

      Hi

      I've migrated from serial to mqtt. With the serial connection I got the sensors to report the batterylevel, but I can't get it to work with the MQTT GW.

      I've seen, that there's a "default" battery reporting line in MySensor.h

           void sendBatteryLevel(uint8_t level, bool ack);
      

      But how do I adapt that to mqtt?

      Can I just add the line at the end of the default temperature sensor loop?

      posted in OpenHAB
      Hausner
      Hausner
    • RE: Static ParentID

      @hek

      Thank you! It looks like it's working.

      The relay is now talking directly to the GW. The 2 right-side temp sensors however, are now using the relay node as a repeater 😛

      I can live with that (still working as designed) only thing now, is that I think I have a faulty wirering connection to the radio on the relay node. After a while it goes "offline", but the fun part is that if I powercycle it, it's back online.

      posted in Troubleshooting
      Hausner
      Hausner
    • RE: Static ParentID

      @Hek

      So instead of
      gw.begin(incomingMessage, AUTO, true);

      it should be
      gw.begin(incomingMessage, AUTO, true, 0);

      for the relay node?

      posted in Troubleshooting
      Hausner
      Hausner
    • Static ParentID

      Hi,

      This might be a trivial question, but how the f.. do I set a static parent node id?

      My setup is a MQTT gateway, 1 relay node and 3 temp nodes.
      setup.png

      Disance in picture is equal to real life.

      My problem is that, as long as temp2/3 sensors are not running, then the relay works fine.
      As soon as I enable temp 2/3, the relay node thinks that it should communicate with those, as they are closer (which they are)

      The problem here is that the temp nodes are battery operated, so they sleep most of the time, hence I loose comm to the relay node. Therefore I really need to make the relay node talk to the GW with a static ID.

      I've tried to change parentNodeId=AUTO to parentNodeId=0 in MySensor.h on the relay node, but without any working result 😞

      posted in Troubleshooting
      Hausner
      Hausner
    • RE: Ethernet Gateway problem

      Dan S.
      Not to hijack your tread, but I've had similar problems. First the "check wires" thing, next dropping out at random times.

      I started with this R3 and this shield which is a ENC28J60, but couldn't get it to work properly.

      Then I bought this shield , plugged it in, and uploaded the Ethernet GW without mods, except IP of cause, and it has worked ever since.

      posted in Troubleshooting
      Hausner
      Hausner
    • RE: Temperature sensor WITH battery monitor

      DOH!!! Stupid me!

      Forgot the temp only transmits on temp change...

      it's working now 🙂

      posted in Troubleshooting
      Hausner
      Hausner
    • RE: Temperature sensor WITH battery monitor

      Here's my sketch for the tempnode:

      // Example sketch showing how to send in OneWire temperature readings
      #include <MySensor.h>
      #include <SPI.h>
      #include <DallasTemperature.h>
      #include <OneWire.h>

      #define ONE_WIRE_BUS 3 // Pin where dallase sensor is connected
      #define MAX_ATTACHED_DS18B20 16
      unsigned long SLEEP_TIME = 120000; // Sleep time between reads (in milliseconds)
      OneWire oneWire(ONE_WIRE_BUS);
      DallasTemperature sensors(&oneWire);
      MySensor gw;
      float lastTemperature[MAX_ATTACHED_DS18B20];
      int numSensors=0;
      boolean receivedConfig = false;
      boolean metric = true;
      // Initialize temperature message
      MyMessage msg(0,V_TEMP);

      int BATTERY_SENSE_PIN = A0; // select the input pin for the battery sense point
      int oldBatteryPcnt = 0;

      void setup()
      {
      // Startup OneWire
      sensors.begin();

      // Startup and initialize MySensors library. Set callback for incoming messages.
      gw.begin();

      // Send the sketch version information to the gateway and Controller
      gw.sendSketchInfo("Temperature Sensor", "1.0");

      // Fetch the number of attached temperature sensors
      numSensors = sensors.getDeviceCount();

      // Present all sensors to controller
      for (int i=0; i<numSensors && i<MAX_ATTACHED_DS18B20; i++) {
      gw.present(i, S_TEMP);
      }

      // use the 1.1 V internal reference
      analogReference(INTERNAL);
      }

      void loop()
      {
      // Process incoming messages (like config from server)
      gw.process();

      // Fetch temperatures from Dallas sensors
      sensors.requestTemperatures();

      // Read temperatures and send them to controller
      for (int i=0; i<numSensors && i<MAX_ATTACHED_DS18B20; i++) {

      // Fetch and round temperature to one decimal
      float temperature = static_cast<float>(static_cast<int>((gw.getConfig().isMetric?sensors.getTempCByIndex(i):sensors.getTempFByIndex(i)) * 10.)) / 10.;
      
      // Only send data if temperature has changed and no error
      if (lastTemperature[i] != temperature && temperature != -127.00) {
      
        // Send in the new temperature
        gw.send(msg.setSensor(i).set(temperature,1));
        lastTemperature[i]=temperature;
      }
      

      }

      // get the battery Voltage
      int sensorValue = analogRead(BATTERY_SENSE_PIN);
      Serial.println(sensorValue);
      // 1M, 470K divider across battery and using internal ADC ref of 1.1V
      // Sense point is bypassed with 0.1 uF cap to reduce noise at that point
      // ((1e6+470e3)/470e3)*1.1 = Vmax = 3.44 Volts
      // 3.44/1023 = Volts per bit = 0.003363075
      float batteryV = sensorValue * 0.004106;
      int batteryPcnt = sensorValue / 10;
      Serial.print("Battery Voltage: ");
      Serial.print(batteryV);
      Serial.println(" V");
      Serial.print("Battery percent: ");
      Serial.print(batteryPcnt);
      Serial.println(" %");
      if (oldBatteryPcnt != batteryPcnt) {
      // Power up radio after sleep
      gw.sendBatteryLevel(batteryPcnt);
      oldBatteryPcnt = batteryPcnt;
      }

      gw.sleep(SLEEP_TIME);
      }

      posted in Troubleshooting
      Hausner
      Hausner
    • Temperature sensor WITH battery monitor

      Hi,

      I'm new to all of this arduino stuff, but I've managed to get a Serial GW and 2 tempsensors going.

      Now I would like to add the battery monitor to the temp sensor sketch, to monitor the 3,7V LiPo batteries.

      What I've done is, merged the battery sketch setup with the temp sketch setup, and also done the same with the Void sections.

      No errors on upload - weee!

      Problem is now, that I only get the Volt reading from the Node and no temperature reading anymore. 😞

      So where did I go wrong?

      posted in Troubleshooting
      Hausner
      Hausner