Navigation

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

    Corvl

    @Corvl

    7
    Reputation
    62
    Posts
    835
    Profile views
    0
    Followers
    0
    Following
    Joined Last Online

    Corvl Follow

    Best posts made by Corvl

    • Device to remotely turn a thermostat

      My house is getting all automated by now , thanks to vera and Z-wave. And now Arduino comes into play !! 🙂

      My heating system is also automated , by means of Fibaro relais which turns things (the system itself or pumps) on and off. And radiators have danfoss Z-wave thermostats attached to it.

      But my floorheating ..... that was a different story. It had a special thermostat with a temperature sensor going a device which measures the water in the floorheating system.

      Allready demolished a danfoss Z-wave thermostate , trying to make the tempretaure sensor external , but no joy.

      Huray for Arduino.

      Building the gateway was easy enough, building a servo-actuator with an arduino UNO was also very easy.

      On vera there was an issue with the slider , with the slider the servo only moves 90 degrees. someone helped me changing some code on the sketch:


      fixed it by replacing the line:

      myservo.write(SERVO_MAX + (SERVO_MIN-SERVO_MAX)/100 * val); // sets the servo position 0-180

      by the following 2 lines of code:

          val = map(val, 0, 100, 0, 180); // scale 0%-100% between 0 and 180)
          myservo.write(val);       // sets the servo position 0-180
      

      Now the servo was moving the full 180 degrees by means of the slider.

      Than came the mechanical part, I had to make quite a bracket to hold the servo. Initially I had a standard 3 kg/cm servo , but it wasn't enough to completely close the valve. I ended up using a big scale servo with 14 kg/cm on 7V. Offcourse the servo is powered by a seperate 7V, max 5A power supply

      Initially the plan was to attach the servo directly to the thermostat , at that time I didn't know the themostat not only turns , but also moves in-and outwards .....

      Plan 2 was to use a timing belt system with 2 sprockets , also this didn't work , because the servo pulled the thermostat towards it

      Plan 3 finally worked , I routed out of trespa a bracket where the servo could go freely in and out , but not turn itself.
      This trespa ( white) attached to the metal bracket. Now the servo can do it's normal thing , turn the lever , but also move in and outward

      Here 2 pictures:
      20141209_194903.jpg 20141209_194836.jpg

      A succesfull project I must say 🙂

      posted in My Project
      Corvl
      Corvl
    • RE: Building an IR controller

      pffff , 84 pages ..... it is something I have to read I guess .

      Thanks for the info ..... I will report here if it is working ......

      Cor

      posted in Troubleshooting
      Corvl
      Corvl
    • RE: Relais sketch, auto switch on again after x seconds

      @ BartE , thanks a lot , I changed all the _Off to _OFF and the same with the On , gw. wait as well. also the 500 to 5000

      Working perfectly !

      Many thanks

      I haven't had a definite anwer yet if libabry 2.x works on vera , I have only read about problems . For the moment I stick to 1.5

      edit : one small thing I just noticed , when I switch via the vera Gui the relais to off , it nicely goes back to on after 5 seconds , but it doesn't report back to vera that it is again in an on state.

      is there still something wrong with the code?

      Again many thanks,
      Cor

      For future reference:

      // 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  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
      
      MySensor gw;
      
      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", "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) 
           if (gw.loadState(sensor) == RELAY_OFF) {
           digitalWrite(pin, RELAY_OFF);
           gw.wait(5000);
           digitalWrite(pin, RELAY_ON);
      }
        }
      }
      
      
      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
       if (message.getBool() == RELAY_OFF) {
      digitalWrite(message.sensor-1+RELAY_1, RELAY_OFF);
      gw.wait(5000);
      digitalWrite(message.sensor-1+RELAY_1, RELAY_ON);
      }
           // 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 General Discussion
      Corvl
      Corvl

    Latest posts made by Corvl

    • RE: Relais sketch, auto switch on again after x seconds

      @ BartE , thanks a lot , I changed all the _Off to _OFF and the same with the On , gw. wait as well. also the 500 to 5000

      Working perfectly !

      Many thanks

      I haven't had a definite anwer yet if libabry 2.x works on vera , I have only read about problems . For the moment I stick to 1.5

      edit : one small thing I just noticed , when I switch via the vera Gui the relais to off , it nicely goes back to on after 5 seconds , but it doesn't report back to vera that it is again in an on state.

      is there still something wrong with the code?

      Again many thanks,
      Cor

      For future reference:

      // 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  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
      
      MySensor gw;
      
      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", "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) 
           if (gw.loadState(sensor) == RELAY_OFF) {
           digitalWrite(pin, RELAY_OFF);
           gw.wait(5000);
           digitalWrite(pin, RELAY_ON);
      }
        }
      }
      
      
      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
       if (message.getBool() == RELAY_OFF) {
      digitalWrite(message.sensor-1+RELAY_1, RELAY_OFF);
      gw.wait(5000);
      digitalWrite(message.sensor-1+RELAY_1, RELAY_ON);
      }
           // 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 General Discussion
      Corvl
      Corvl
    • RE: Stay on version 1.5 or move to 2.1.1 on my vera plus and vera 3?

      Thanks a lot , that is a big re-assurance , since that servo is hooked up on my heating system...... and it is still winter.

      Still , there are 2 or 3 threads here on this forum saying they cab's get version 2.x to work with vera on Ui7.

      I have a spare vera lite on Ui7 I will try this version 2.x on the vera lite first. But it will be for next week.

      Thanks a lot so far!,
      Cor

      posted in Vera
      Corvl
      Corvl
    • RE: Stay on version 1.5 or move to 2.1.1 on my vera plus and vera 3?

      I would like to add some more stuff as well, and hopefully , with the newer version that doorsensor is working better.

      But is 2.11 working on vera?
      And the above sketch , of the servo actuator , is that one still compatible?

      Thanks,
      Cor

      posted in Vera
      Corvl
      Corvl
    • Stay on version 1.5 or move to 2.1.1 on my vera plus and vera 3?

      Hello everyone,

      I run version 1.5 on both my vera's and Ethernet gateways and someone hinted to go to version 2.x since the newer codes don't work with 1.5

      I also read on this forum there are issues with version 2.x and library.
      Is it usefull to stay on version 1.5 or I better upgrade?

      I run not that many nodes , an important one, servo actuator which is working good. And a door sensor with temperature sensor which is working not so good , it doesn't report alway , so an extra piece of code is inserted so it reports at least every 30 seconds. Maybe with the new library and codes this is solved , and it reports a change immediately?

      This is the code for the servo actuator I use , will it still work with version 2.11?

      // Example showing how to create an atuator for a servo.
      // Connect red to +5V, Black or brown to GND and the last cable to Digital pin 3.
      // The servo consumes much power and should probably have its own powersource.'
      // The arduino might spontanally restart if too much power is used (happend
      // to me when servo tried to pass the extreme positions = full load).
      // Contribution by: Derek Macias
      
      
      #include <MySensor.h>
      #include <SPI.h>
      #include <Servo.h> 
      
      #define SERVO_DIGITAL_OUT_PIN 3
      #define SERVO_MIN 0 // Fine tune your servos min. 0-180
      #define SERVO_MAX 180 // Fine tune your servos max. 0-180
      #define DETACH_DELAY 4000 // Tune this to let your movement finish before detaching the servo
      #define CHILD_ID 10   // Id of the sensor child
      
      MySensor gw;
      MyMessage msg(CHILD_ID, V_DIMMER);
      Servo myservo;  // create servo object to control a servo 
                      // a maximum of eight servo objects can be created Sensor gw(9,10);
      unsigned long timeOfLastChange = 0;
      bool attachedServo = false;
                  
      void setup() 
      { 
        // Attach method for incoming messages
        gw.begin(incomingMessage);
      
        // Send the sketch version information to the gateway and Controller
        gw.sendSketchInfo("Servo", "1.0");
      
        // Register all sensors to gw (they will be created as child devices)
        gw.present(CHILD_ID, S_COVER);
      
        // Request last servo state at startup
        gw.request(CHILD_ID, V_DIMMER);
      } 
      
      void loop() 
      { 
        gw.process();
        if (attachedServo && millis() - timeOfLastChange > DETACH_DELAY) {
           myservo.detach();
           attachedServo = false;
        }
      } 
      
      void incomingMessage(const MyMessage &message) {
        myservo.attach(SERVO_DIGITAL_OUT_PIN);   
        attachedServo = true;
        if (message.type==V_DIMMER) { // This could be M_ACK_VARIABLE or M_SET_VARIABLE
           int val = message.getInt();
          val = map(val, 0, 100, 0, 180); // scale 0%-100% between 0 and 180)
              myservo.write(val);       // sets the servo position 0-180
           // Write some debug info
           Serial.print("Servo changed. new state: ");
           Serial.println(val);
         } else if (message.type==V_UP) {
           Serial.println("Servo UP command");
           myservo.write(SERVO_MIN);
           gw.send(msg.set(100));
         } else if (message.type==V_DOWN) {
           Serial.println("Servo DOWN command");
           myservo.write(SERVO_MAX); 
           gw.send(msg.set(0));
         } else if (message.type==V_STOP) {
           Serial.println("Servo STOP command");
           myservo.detach();
           attachedServo = false;
      
         }
         timeOfLastChange = millis();
      }```
      posted in Vera
      Corvl
      Corvl
    • RE: Relais sketch, auto switch on again after x seconds

      Thanks,

      I am thinking of upgrading to 2.x , not sure yet if that is wise. Just made another topic for some questions.

      Thanks so far,
      Cor

      posted in General Discussion
      Corvl
      Corvl
    • RE: Relais sketch, auto switch on again after x seconds

      @ Boots33: both my vera's are running with version 1.5 . Can I just update , will the sketches wich are now running still work?

      posted in General Discussion
      Corvl
      Corvl
    • RE: Relais sketch, auto switch on again after x seconds

      No big deal 😰

      I tried with the code from mfalkvidd , change what I though looked good.

      But I get the error in compiling:

      RelayActuator.ino: In function 'void setup()':
      RelayActuator.ino:28:30: error: 'RELAY_Off' was not declared in this scope
      RelayActuator.ino:30:10: error: 'wait' was not declared in this scope
      RelayActuator.ino:31:19: error: 'RELAY_On' was not declared in this scope
      RelayActuator.ino: In function 'void incomingMessage(const MyMessage&)':
      RelayActuator.ino:47:27: error: 'RELAY_Off' was not declared in this scope
      RelayActuator.ino:49:9: error: 'wait' was not declared in this scope
      RelayActuator.ino:50:40: error: 'RELAY_On' was not declared in this scope
      Error compiling

      This is what I did:
      I changed exactly what was in that code , but since I didn't have "loadState" but I did have "gw.loadState" I changed it in "gw.loadState" but also "Loadstate"gives an error compling.

      // 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  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
      
      MySensor gw;
      
      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", "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) 
       if (gw.loadState(sensor) == RELAY_Off) {
      digitalWrite(pin, RELAY_Off);
      wait(5000);
      digitalWrite(pin, RELAY_On);
      }
        }
      }
      
      
      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
       if (message.getBool() == RELAY_Off) {
      digitalWrite(message.sensor-1+RELAY_1, RELAY_Off);
      wait(500);
      digitalWrite(message.sensor-1+RELAY_1, RELAY_On);
      }
           // 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 General Discussion
      Corvl
      Corvl
    • RE: Gateway in Client Mode and 2 Controller?

      @ Fotofieber;

      I have bridges both vera's. What I want is the other vera ( too far away for a z-wave device) to be able to switch on and off the main vera. ( in case it freezes).

      I have now build a second ethernet controller , which is near the main vera. So I was just wondering if I could controll a node ( relais) via the ethernet gateway which is than on both vera's.

      Cor

      posted in General Discussion
      Corvl
      Corvl
    • Relais sketch, auto switch on again after x seconds

      Hello everyone,

      I just build a simple single relais , using the sketch from the examples. ( see also below) . Is it possible to change it a bit , so the relais when switched off , switches on again automatically after for example 5 seconds?

      Thanks,
      Cor

      // 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  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
      
      MySensor gw;
      
      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", "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);
        }
      }
      
      
      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(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 General Discussion
      Corvl
      Corvl
    • RE: Ethernet gateway shows up on vera , but doens't want to include devices

      Wierd Wierd wierd.

      Deleting the node was easy , I just had to restart the vera controller again.

      I tried to include the relais again , and now it workes fine , although it only found 1 node ( the relais) and not the "other" node ( the one with the chip picture on the vera tile) .

      Is that a problem?

      Thanks,
      Cor

      posted in Troubleshooting
      Corvl
      Corvl