Skip to content
  • MySensors
  • OpenHardware.io
  • Categories
  • Recent
  • Tags
  • Popular
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo
CorvlC

Corvl

@Corvl
About
Posts
63
Topics
15
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Relais sketch, auto switch on again after x seconds
    CorvlC Corvl

    @ 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());
       } 
    }```
    General Discussion

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

    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

    Vera

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

    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

    Vera

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

    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();
    }```
    Vera

  • Relais sketch, auto switch on again after x seconds
    CorvlC Corvl

    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

    General Discussion

  • Relais sketch, auto switch on again after x seconds
    CorvlC Corvl

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

    General Discussion

  • Relais sketch, auto switch on again after x seconds
    CorvlC Corvl

    No big deal :cold_sweat:

    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());
       } 
    }
    General Discussion

  • Gateway in Client Mode and 2 Controller?
    CorvlC Corvl

    @ 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

    General Discussion

  • Relais sketch, auto switch on again after x seconds
    CorvlC Corvl

    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());
       } 
    }```
    General Discussion

  • Ethernet gateway shows up on vera , but doens't want to include devices
    CorvlC Corvl

    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

    Troubleshooting

  • Gateway in Client Mode and 2 Controller?
    CorvlC Corvl

    Just checking if I have the same question, since I am not sure about "client mode".

    Is it possible to controll the ethernet gateway with 2 vera's ?

    Thanks,
    Cor

    General Discussion

  • Ethernet gateway shows up on vera , but doens't want to include devices
    CorvlC Corvl

    Thanks rejoe2,

    Before I can continue I need to somehow exclude the node I made. Do you know how I can exclude it from the vera plus , so I can troubleshoor further on the vera 3 with this new gateway?

    Thanks,
    Cor

    Troubleshooting

  • Ethernet gateway shows up on vera , but doens't want to include devices
    CorvlC Corvl

    Hello everyone!

    I build today a second ethernet gateway for another vera ( on the same network). After some issues , since it had the same mac adress , I got it to work , I can ping the new ethernet gateway and have included it in the vera 3 (UI7).

    All seems normall sofar.

    Than I build a relais actuator, and it won't include on that new gateway.
    I tried to include it on the gateway I allready have ( Vera plus ) and that works fine. Meaning , the relais is build correctly.

    First how do I exclude this relais I just build , I pressed the delete button on the vera plus for the devices . ( as a test i wanted to include them again , but I couldn't , so the relais needs to be excluded somehow) .
    Anyone knows how?

    Than , something is probably wrong with the new ethernet gateway , since it does who up on the vera 3 and it all looks fine ( it says: Connected to:192.168.68.14:5003) How do I further troubleshoot?

    Thanks,
    Cor

    Troubleshooting

  • Backup internet acces
    CorvlC Corvl

    What is mysensors when internet fails on you.....

    That happened to me today.
    I am about 3000 miles away from home , and no connection to my house anymore. I expect my modem gave up ( which happends at least once a year). Or power failure or .....?????? I don't know. Anyway , Internet is not working at my residence. No one is there to take a look or reset.

    On my vera 3 I allready have the ping sensor and on the modem a wallplug which resets the modem when the ping sensor is "red". Looking at teamviewer the internet was down arround 0200 AM. that's about the time when vera does a heal.
    Maybe the modem was switched off for a reset and during the heal or a vera restart the wallplug has not been switched on. Than it would be a self induced problem, which would not be there without the home automation. Anyway , friday night when I am home I need to investigate, it is very frustrating.

    But now , my question; if it is a modem breakdown , automation malfunktion , power failure or internet provider failure , I would like to have an internet backup.

    I am thinking arduino which detects if the main internet connection is down ( for more than x minutes) , starts up the backup internet ( thinking of cellphone and prepaid databundle) , sends out a notification and able to do minimum homeauthomation ( in my case connect to vera 3) and capture webcam streams and sends out periodic images.

    Anyone allready has something like that or has an idea how to set this up? if it is even possible?

    thanks,
    Cor

    My Project

  • What is wrong with this node?
    CorvlC Corvl

    Looks like I got the same ..... I have a nano with a temp sensor on it and reed switch , and 8 out of 10 times it sends it status change. but sometimes it doesn't.

    send: 2-2-0-0 s=0,c=1,t=0,pt=7,l=5,st=fail:25.0
    send: 2-2-0-0 s=0,c=1,t=0,pt=7,l=5,st=fail:25.1
    send: 2-2-0-0 s=17,c=1,t=16,pt=2,l=2,st=fail:1
    send: 2-2-0-0 s=0,c=1,t=0,pt=7,l=5,st=fail:25.2
    send: 2-2-0-0 s=17,c=1,t=16,pt=2,l=2,st=fail:0
    send: 2-2-0-0 s=0,c=1,t=0,pt=7,l=5,st=fail:25.3
    send: 2-2-0-0 s=17,c=1,t=16,pt=2,l=2,st=fail:1
    send: 2-2-255-255 s=255,c=3,t=7,pt=0,l=0,st=fail:
    

    I ended up removing a part in the sketch that it not only sends with the status change but every 30 seconds. Not ideal , but good enough.

    Hopefully you find out the issue.

    Cor

    Troubleshooting

  • Changing from serial to ethernet gateway
    CorvlC Corvl

    aha , cheap chinese clone.:astonished:

    It is a nano , doesn't have a power input. also the ethernet adapter has no seperate power connector.

    Vinn and ground should work , and I didn't do it wrong..... wierd ..... thankfully it is working via the USB connector . I will leave it as it is in that case.

    Troubleshooting

  • Changing from serial to ethernet gateway
    CorvlC Corvl

    That was easy....... worked the first time and very well ....

    I worried for nothing :-)

    One question though; When all was funktioning fine I soldered a 12v DC (1A) adapter on the ground and Vin. The arduino normally started up ,but didn't work. I tried another 12vDC (2A) adapter , and exactly the same.

    When I Plug the arduino Uno in my computer via USB or a USB charger via the USB-port , all works fine. Anyone has an idea why this is?

    Thanks for all the help ,
    Cor

    Troubleshooting

  • Changing from serial to ethernet gateway
    CorvlC Corvl

    Many Thanks Dan.
    It is always a bit scary when you don't know that much about electronics.

    Cor

    Troubleshooting

  • Changing from serial to ethernet gateway
    CorvlC Corvl

    @Dan-S. said:

    so that it does not use the same SCK/CK/MISO/SO/MI.MOSI

    Cool that it will be working , do you have any ide than how I connect the radio? Will the sketch work than, without changing a lot of the configuration?

    thanks,
    Cor

    Troubleshooting

  • Anyone using electronic transformers to power the nodes?
    CorvlC Corvl

    http://www.dx.com/s/5v+power+supply

    http://www.dx.com/s/12v+power+supply

    For example

    Hardware
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • MySensors
  • OpenHardware.io
  • Categories
  • Recent
  • Tags
  • Popular