Navigation

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

    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
    • RE: Gateway in Client Mode and 2 Controller?

      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

      posted in General Discussion
      Corvl
      Corvl
    • RE: Ethernet gateway shows up on vera , but doens't want to include devices

      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

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

      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

      posted in Troubleshooting
      Corvl
      Corvl
    • Backup internet acces

      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

      posted in My Project
      Corvl
      Corvl
    • RE: What is wrong with this node?

      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

      posted in Troubleshooting
      Corvl
      Corvl
    • RE: Changing from serial to ethernet gateway

      aha , cheap chinese clone.😲

      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.

      posted in Troubleshooting
      Corvl
      Corvl
    • RE: Changing from serial to ethernet gateway

      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

      posted in Troubleshooting
      Corvl
      Corvl
    • RE: Changing from serial to ethernet gateway

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

      Cor

      posted in Troubleshooting
      Corvl
      Corvl
    • RE: Changing from serial to ethernet gateway

      @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

      posted in Troubleshooting
      Corvl
      Corvl
    • RE: Anyone using electronic transformers to power the nodes?

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

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

      For example

      posted in Hardware
      Corvl
      Corvl
    • RE: Changing from serial to ethernet gateway

      Aha , interesting ,

      I saw that ethernetshield as well , must have been a brainfart to buy this one ;-s

      I found this instructable on the internet:
      http://www.instructables.com/id/Arduino-Nano-with-Ethernet-Shield/?ALLSTEPS

      Hopefully that works , or shouldn't I even try and buy another one?😱

      Cor

      posted in Troubleshooting
      Corvl
      Corvl
    • RE: Anyone using electronic transformers to power the nodes?

      You are aware the output is AC not DC ?

      Cor

      posted in Hardware
      Corvl
      Corvl
    • RE: Changing from serial to ethernet gateway

      Ah , cool , good to know that nothing on the vera side needs to change except for the Ip adress and port.

      I will start this project in an hour or , before I do so I do have a question about what you mentioned last about the pin setup.
      $_12.JPG

      When I look at my WizNET (Ws5100) ethernet module ,i don't have pins ( SCK/CK/MISO/SO/MI.MOSI, SI/MO/SS/CS/NSS) on it , the pins are the same when I compare with my UNO.

      It looks I can insert this module straight on an UNO. The plan is actually to use this module for a nano ..... I can still use this module?

      But how to wire this module , The pins (names) are accactly the same as on a UNO .😓

      Damn , I am allready stuck , and even haven't started yet 😞

      Cor

      posted in Troubleshooting
      Corvl
      Corvl
    • RE: How to combine 2 sketches

      Oh sorry Timo , I said it wrong.

      What I was trying to say was , that it is a pity , that there are so many fails sending the status.
      But now trying to send it every 30 seconds, by removing that little piece of coding is very acceptable.

      Again , many thanks for your time helping me,

      Cor

      posted in Development
      Corvl
      Corvl
    • RE: Garage door controller/checker

      Awesome Kortoma,

      That is a very good start. Thanks for this.
      When I read through the sketch ( and what I understand from it), it is not possible to have the reed switches 1 "normal" and another one "inversed"? it is both switches have to act the same?

      Will it be difficult to add another switch to act as a "beam" to sense if the door is clear to close it?

      Can a temperature sensor be added?

      Thanks,
      Cor

      posted in My Project
      Corvl
      Corvl
    • RE: help newbie: MEGA2560 + Ethernet Shield = always fails

      I am a bit of a noob still on this forum , but I had the same yesterday with a nano, checked the wires a dosen times , und when I put another nano on the breadbord it was working fine . Someone pointed out to clear the eprom. That worked for me. Maybe for you as well.

      Good luck ,
      Cor

      posted in Hardware
      Corvl
      Corvl
    • RE: How to combine 2 sketches

      Just uploaded it and when the sensor doesn't report immediately to vera3 , some time later ( 30 seconds?) it is done.

      A pity it isn't done immediately always , but good enough for this project,

      Many thanks for you help,
      Cor

      For my reference, here the final sketch:

      // 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
      #define CHILD_ID_SWITCH 17
      #define BUTTON_PIN  2  // Arduino Digital I/O pin for button/reed switch
      
      
      
      
      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; 
      
      int oldValue=-1;
      
      // Initialize temperature message
      MyMessage msgTemp(0,V_TEMP);
      MyMessage msgButton(CHILD_ID_SWITCH,V_TRIPPED);
      
      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);
        }
        
        
        // INIT SWITCH
        pinMode(BUTTON_PIN,INPUT);
        // Activate internal pull-up
        digitalWrite(BUTTON_PIN,HIGH);
        gw.present(CHILD_ID_SWITCH, S_DOOR);
      }
      
      
      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(msgTemp.setSensor(i).set(temperature,1));
            lastTemperature[i]=temperature;
          }
        }
        
        
          // READ SWITCH STATUS
        // Get the update value
        int value = digitalRead(BUTTON_PIN);
       
        // Send in the new value
           gw.send(msgButton.set(value==HIGH ? 1 : 0));
        
        gw.sleep(BUTTON_PIN-2, CHANGE, SLEEP_TIME);
      }
      
      posted in Development
      Corvl
      Corvl
    • Garage door controller/checker

      Time to think bout a new project.

      The comming months I am building a new garage . I want to controll and check the garage via my vera3. Option is to buy a universal sensor and fibaro relais , but why not with my sensor stuff?

      What does it need to do:
      -open en close the garage >> via a relais what closes the contacts momentarely ( 1 or 2 seconds)
      -checks if the garage is open , closed or in transit: via reed switches ; one on the open opsition and one on the closed position. >> sketch will be door sensor/siwtch.
      -sensor to check if the entrance/garage door is clear to close , or emergency stop when "the beam" is interupted. >> No idea what this is called , but I guess the sketch will be like the "door sensor/ switch" .
      -temperature sensor. >> ( Dallas DS18B20).

      What do you guys think? Is this possible? , on an arduino nano 3x reed switches and a temperature sensor?

      I allready have a sketch here for 1 temperature sensor and 1 reed switch:

      This one has not the IRQ pin on the radio connected , on pin 2 is a reed sensor. Can this sketch easily be adapted for 3 reedswitches and also have a relais attached?

      One of the reed switches needs to be "inversed", when the contact is closed, it actually has to say "garage open".

      Thanks,
      Cor

      // 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
      #define CHILD_ID_SWITCH 17
      #define BUTTON_PIN  2  // Arduino Digital I/O pin for button/reed switch
      
      
      
      
      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; 
      
      int oldValue=-1;
      
      // Initialize temperature message
      MyMessage msgTemp(0,V_TEMP);
      MyMessage msgButton(CHILD_ID_SWITCH,V_TRIPPED);
      
      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);
        }
        
        
        // INIT SWITCH
        pinMode(BUTTON_PIN,INPUT);
        // Activate internal pull-up
        digitalWrite(BUTTON_PIN,HIGH);
        gw.present(CHILD_ID_SWITCH, S_DOOR);
      }
      
      
      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(msgTemp.setSensor(i).set(temperature,1));
            lastTemperature[i]=temperature;
          }
        }
        
        
          // READ SWITCH STATUS
        // Get the update value
        int value = digitalRead(BUTTON_PIN);
       
        // Send in the new value
           gw.send(msgButton.set(value==HIGH ? 1 : 0));
        
        gw.sleep(BUTTON_PIN-2, CHANGE, SLEEP_TIME);
      }
      
      posted in My Project
      Corvl
      Corvl
    • Changing from serial to ethernet gateway

      It was a bit dissapointing that when my vera 3 loses power, it also loses the info on the serial port. The ethernet gateway will avoid this I understand.

      Last week I recieved my WizNet W5100.

      Reading through the "build" part of this website I do have a couple of questions:

      #define IP_PORT 5003        // The port you want to open
      

      -Do I need to change this , or leave it as it is? No clue if port 5003 is in use my any of my devices.

      -Do I need to remove anything on my vera 3 since I "had" the serial gateway?
      -The 4 arduinos which are now included and have a device number, will they still be working ,Or do i have to remove them and include them again?

      Thanks,
      Cor

      posted in Troubleshooting
      Corvl
      Corvl
    • RE: How to combine 2 sketches

      Too many of these brackets 😳

      This is the original:

      
        // READ SWITCH STATUS
        // Get the update value
        int value = digitalRead(BUTTON_PIN);
       
        // Send in the new value
        if (value != oldValue) {
           // Send in the new value
           gw.send(msgButton.set(value==HIGH ? 1 : 0));
           oldValue = value;
        }
        
        gw.sleep(BUTTON_PIN-2, CHANGE, SLEEP_TIME);
      }
      

      It needs to be changed in:

      
        // READ SWITCH STATUS
        // Get the update value
        int value = digitalRead(BUTTON_PIN);
       
        // Send in the new value
           gw.send(msgButton.set(value==HIGH ? 1 : 0));
        
        gw.sleep(BUTTON_PIN-2, CHANGE, SLEEP_TIME);
      }
      

      Or does that gw.sleep(button_pin etc alsobe removed.

      Thanks,
      Cor

      posted in Development
      Corvl
      Corvl
    • RE: How to combine 2 sketches

      Just to be sure, I only delete this:

      // Send in the new value
        if (value != oldValue) {
      

      I wish I had learned for a real job 😓 😄

      Thanks,
      Cor

      posted in Development
      Corvl
      Corvl
    • RE: Wierd issue with a nano

      Thanks for the anwers.

      Clearing the eprom did the Job.

      😃
      Cor

      posted in Troubleshooting
      Corvl
      Corvl
    • RE: How to combine 2 sketches

      no battery ,it has a 5v powersource.

      Just to make sure I don't make a mistake, this is the code I completely have remove?

      // Send in the new value
        if (value != oldValue) {
           // Send in the new value
           gw.send(msgButton.set(value==HIGH ? 1 : 0));
           oldValue = value;
        }
      

      including the

        }
      

      there on the end

      posted in Development
      Corvl
      Corvl
    • Wierd issue with a nano

      Hello all ,

      I have now 4 nano's in use with my sensor stuff on it, all working fine.
      Today I wanted to make an arduino with a temperature sensor on it.

      But it doesn't want to include on my vera 3

      I tried several radio's ( even one which is definately working on another arduino). I also "burnt" a new bootloader on it. But no luck including it.

      The sketch uploads fine .

      When I upload the "blink" sketch from the example library , the led blinks.

      Besides throwing this nano (clone) away , is there anything else I can do? it's wierd that the blinking sketch works fine.

      Any ideas?

      Thanks,
      Cor

      posted in Troubleshooting
      Corvl
      Corvl
    • RE: How to combine 2 sketches

      Will it be difficult to change the sketch , that the value is resend every X seconds?

      Will there be disadvantages on this?
      Will my Vera3 have a much higher load due to this?

      Thanks,
      Cor

      posted in Development
      Corvl
      Corvl
    • RE: How to combine 2 sketches

      @ Hek; Thanks.

      Bugger though.
      Although I have installed the arduino where I am planning to use it , and it is working flawlesly for the last couple of hours ....

      Wait and see.

      PS, I have tried 2 different radio's who look a bit different in appearance , theyboth have/had the same issue.

      Thinking about it , and having that monitor seeing what is being send , it looks like , the info of the reed sensoe ( pin2) is only send when it changes status .

      When it isn't send , nothing happends.
      Is it possible to have the arduino check what the vera has recieved , if the status is not the same , try again a couple of seconds later?

      Thanks,
      Cor

      posted in Development
      Corvl
      Corvl
    • RE: How to combine 2 sketches

      capacitor I tried as well ( didn't have one at first) , now theres is one , but it makes no difference.

      What do you mean by checking the bootloader?

      thanks,
      Cor

      posted in Development
      Corvl
      Corvl
    • RE: How to combine 2 sketches

      Hmm..... got an issue.

      The sensor doesn't alway work .... the switch works about 8 of 10 times,

      When I looked at the serial monitor I also see some fails, and that is when I connect pin2 with ground ( reed switch)..

      Anyone has an idea?

      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:
      

      thanks,
      Cor

      posted in Development
      Corvl
      Corvl
    • RE: How to combine 2 sketches

      Yes , indeed . it is working like this ... Uploaded via arduino programm. included on the vera 3 , and now I have a temp sensor and reed sensor on 1 arduino.

      Many thanks,

      Cor

      For future reference:
      (Where Temp sensor is on pin 3 and reed switch on pin 2. number 2 pin for radio not neccesary)

      // 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
      #define CHILD_ID_SWITCH 17
      #define BUTTON_PIN  2  // Arduino Digital I/O pin for button/reed switch
      
      
      
      
      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; 
      
      int oldValue=-1;
      
      // Initialize temperature message
      MyMessage msgTemp(0,V_TEMP);
      MyMessage msgButton(CHILD_ID_SWITCH,V_TRIPPED);
      
      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);
        }
        
        
        // INIT SWITCH
        pinMode(BUTTON_PIN,INPUT);
        // Activate internal pull-up
        digitalWrite(BUTTON_PIN,HIGH);
        gw.present(CHILD_ID_SWITCH, S_DOOR);
      }
      
      
      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(msgTemp.setSensor(i).set(temperature,1));
            lastTemperature[i]=temperature;
          }
        }
        
        
        // READ SWITCH STATUS
        // Get the update value
        int value = digitalRead(BUTTON_PIN);
       
        // Send in the new value
        if (value != oldValue) {
           // Send in the new value
           gw.send(msgButton.set(value==HIGH ? 1 : 0));
           oldValue = value;
        }
        
        gw.sleep(BUTTON_PIN-2, CHANGE, SLEEP_TIME);
      }```
      posted in Development
      Corvl
      Corvl
    • RE: How to combine 2 sketches

      Done , but codebender still gives an error when I try to upload:
      This error:

      /mnt/tmp/compiler.5IZJzn/files/DallasAndButton copy copy.o: In function loop': DallasAndButton copy copy.cpp:(.text.loop+0x14c): undefined reference to MySensor::sleep(int, int, unsigned long)'

      I removed the pin 2 from the radio and used that now for the reed switch. and changed the code like this:

      #define ONE_WIRE_BUS 3 // Pin where dallase sensor is connected 
      #define MAX_ATTACHED_DS18B20 16
      #define CHILD_ID_SWITCH 17
      #define BUTTON_PIN  2  // Arduino Digital I/O pin for button/reed switch
      

      How to tackle the problem with the error whil uploading?

      Thanks,
      Cor

      posted in Development
      Corvl
      Corvl
    • RE: How to combine 2 sketches

      I tried both , but I get an errorin codebender when i want to upload it:


      Oops! Looks like there was a serious issue with your project.

      /mnt/tmp/compiler.hyQVDL/files/DallasAndButton copy.o: In function loop': DallasAndButton copy.cpp:(.text.loop+0x14c): undefined reference to MySensor::sleep(int, int, unsigned long)'


      Thanks,
      Cor

      posted in Development
      Corvl
      Corvl
    • RE: How to combine 2 sketches

      Hmm, it doesn't work.

      Is this part correct?

      #define ONE_WIRE_BUS 3 // Pin where dallase sensor is connected 
      #define MAX_ATTACHED_DS18B20 16
      #define CHILD_ID_SWITCH 17
      #define BUTTON_PIN  3  // Arduino Digital I/O pin for button/reed switch```
      

      looks they are both on pin3 , can I change reed switch to 4

      #define BUTTON_PIN  4  // Arduino Digital I/O pin for button/reed switch
      

      Thanks for your help,
      Cor

      posted in Development
      Corvl
      Corvl
    • RE: How to combine 2 sketches

      Thanks for the quick reply . Unfortunately this is too complcated for me ...... sorry , I as you sais , chaning everything for the DTH to the DAllas sensor. This is what i came up with , but it doesn't work. about 8 erros according codebender 😞

      #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);
      
      #define CHILD_ID_SWITCH 3
      #define CHILD_ID_HUM 0
      #define CHILD_ID_TEMP 1
      #define CHILD_ID_VOLTAGE 2
      #define BUTTON_PIN  4  // Arduino Digital I/O pin for button/reed switch
      #define HUMIDITY_SENSOR_DIGITAL_PIN 8
      #define BATTERY_SENSE_PIN A0
      #define NODE_ID 103
      
      
      MySensor gw;
      
      float lastHum;
      float lastVolt;
      boolean metric = true;
      
      // Change to V_LIGHT if you use S_LIGHT in presentation below
      MyMessage msg(CHILD_ID_SWITCH,V_TRIPPED);
      MyMessage msgHum(CHILD_ID_HUM, V_HUM);
      MyMessage msgTemp(CHILD_ID_TEMP, V_TEMP);
      MyMessage msgVolt(CHILD_ID_VOLTAGE, V_VOLTAGE);
      
      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);
        
        analogReference(INTERNAL);
        
        gw.sendSketchInfo("HumTempReed", "1.0");
       // Setup the button
        pinMode(BUTTON_PIN,INPUT);
        // Activate internal pull-up
        digitalWrite(BUTTON_PIN,HIGH);
          
        // Register binary input sensor to gw (they will be created as child devices)
        // You can use S_DOOR, S_MOTION or S_LIGHT here depending on your usage. 
        // If S_LIGHT is used, remember to update variable type you send in. See "msg" above.
        gw.present(CHILD_ID_SWITCH, S_DOOR);
        gw.present(CHILD_ID_HUM, S_HUM);
        gw.present(CHILD_ID_TEMP, S_TEMP);
      
        metric = gw.getConfig().isMetric;  
      }
      
      void measureBattery() {
       // R1 = 1MOhm, R2 = 100 kOhm
       int sensorValue = analogRead(BATTERY_SENSE_PIN); 
       float batteryV = sensorValue * 12.1 / 1023;
       if(lastVolt != batteryV) {
         lastVolt = batteryV;
         Serial.print("Voltage: ");
         Serial.println(batteryV);
         gw.send(msgVolt.set(batteryV, 1));
       }
      }
      
      //  Check if digital input has changed and send in new value
      void loop() 
      {
        // Get the update value
        int value = digitalRead(BUTTON_PIN);
       
        // Send in the new value
        gw.send(msg.set(value==HIGH ? 1 : 0));
        
        // 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);
        }
        
        float humidity = dht.getHumidity();
        if (isnan(humidity)) {
            Serial.println("Failed reading humidity from DHT");
        } else if (humidity != lastHum) {
            lastHum = humidity;
            gw.send(msgHum.set(humidity, 1));
            Serial.print("H: ");
            Serial.println(humidity);
        }
        
        measureBattery();
        
        gw.sleep(BUTTON_PIN-2, CHANGE, SLEEP_TIME);
      } ```
      
      thanks, 
      Cor
      posted in Development
      Corvl
      Corvl
    • How to combine 2 sketches

      Hello all ,

      I want to make a device to check if a door is open/closed and also have a temperature senoron the same arduino.

      But how do I combine the 2 sketches..... my programming skills are basically non existant.

      I did try some things which looked logical to me , but when i virify in codebender it gives me an error code.

      This is the original temperature sketch:

      // 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);
      
      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);
        }
      }
      
      
      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;
          }
        }
        gw.sleep(SLEEP_TIME);
      }``````
      

      And thisis original one for the door sensor:

      // Simple binary switch example 
      // Connect button or door/window reed switch between 
      // digitial I/O pin 3 (BUTTON_PIN below) and GND.
      
      #include <MySensor.h>
      #include <SPI.h>
      #include <Bounce2.h>
      
      #define CHILD_ID 3
      #define BUTTON_PIN  3  // Arduino Digital I/O pin for button/reed switch
      
      MySensor gw;
      Bounce debouncer = Bounce(); 
      int oldValue=-1;
      
      // Change to V_LIGHT if you use S_LIGHT in presentation below
      MyMessage msg(CHILD_ID,V_TRIPPED);
      
      void setup()  
      {  
        gw.begin();
      
       // Setup the button
        pinMode(BUTTON_PIN,INPUT);
        // Activate internal pull-up
        digitalWrite(BUTTON_PIN,HIGH);
        
        // After setting up the button, setup debouncer
        debouncer.attach(BUTTON_PIN);
        debouncer.interval(5);
        
        // Register binary input sensor to gw (they will be created as child devices)
        // You can use S_DOOR, S_MOTION or S_LIGHT here depending on your usage. 
        // If S_LIGHT is used, remember to update variable type you send in. See "msg" above.
        gw.present(CHILD_ID, S_DOOR);  
      }
      
      
      //  Check if digital input has changed and send in new value
      void loop() 
      {
        debouncer.update();
        // Get the update value
        int value = debouncer.read();
       
        if (value != oldValue) {
           // Send in the new value
           gw.send(msg.set(value==HIGH ? 1 : 0));
           oldValue = value;
        }
      } 
      

      The easy bit ( I think)

      inserted the libary and made the door switch/sensor on port 4

      // Example sketch showing how to send in OneWire temperature readings
      #include <MySensor.h>  
      #include <SPI.h>
      #include <DallasTemperature.h>
      #include <OneWire.h>
      #include <Bounce2.h>
      
      #define CHILD_ID 3
      #define BUTTON_PIN  4  // Arduino Digital I/O pin for button/reed switch
      #define ONE_WIRE_BUS 3 // Pin where dallase sensor is connected 
      #define MAX_ATTACHED_DS18B20 16```
      

      But I have really no clue what to do next .... can someone help me ?

      Thanks,
      Cor

      posted in Development
      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: Building an IR controller

      No one has a clue on how to troubleshoot this?
      😩

      posted in Troubleshooting
      Corvl
      Corvl
    • Building an IR controller

      Time for a new project.

      Some time ago I build a serial gateway and a servo to control my floorheating thermostate.
      Now I want to build a device to control a media box ( switch it off via my vera 3)

      Today I have hooked up a IR reciever and transmitter on a arduino uno.
      Uploaded the sketch and tried to controll the media box.

      No , it isn't working , i think it is going wrong somewhere reading the IR-code.

      Whatever button I press on a remote , it always shows the same code , for the transmitter of the mediabox it is "000000" , for the transmitter of a Yamaha amplifier , it is "ffffff" Every button on those remotes gives the same code, that can not be right.

      Using the serial monitor this is confirmed. ( see the copy paste at the bottom of this post).

      What is wrong? and what else can I try to read to correct code?

      Thanks for the help ,

      Cor

      Here the output from serial monitor:

      connecting at 115200
      sensor started, id 105
      send: 105-105-0-0 s=255,c=0,t=17,pt=0,l=3,st=ok:1.4
      send: 105-105-0-0 s=255,c=3,t=6,pt=1,l=1,st=ok:0
      read: 0-0-105 s=255,c=3,t=6,pt=0,l=1:M
      send: 105-105-0-0 s=255,c=3,t=11,pt=0,l=9,st=ok:IR Sensor
      send: 105-105-0-0 s=255,c=3,t=12,pt=0,l=3,st=ok:1.0
      send: 105-105-0-0 s=3,c=0,t=3,pt=0,l=3,st=ok:1.4
      Decoded NEC: Value:5EA1E21C (32 bits)
      Raw samples(68): Gap:6094
      Head: m8850 s4450
      0:m500 s700 1:m450 s1700 2:m450 s700 3:m450 s1750
      4:m450 s1800 5:m450 s1750 6:m450 s1800 7:m550 s550
      8:m450 s1800 9:m500 s600 10:m550 s1700 11:m500 s600
      12:m450 s650 13:m450 s700 14:m450 s650 15:m550 s1700

      16:m450 s1750 17:m450 s1800 18:m500 s1700 19:m550 s600
      20:m500 s600 21:m550 s600 22:m500 s1700 23:m450 s700
      24:m500 s600 25:m500 s650 26:m500 s550 27:m550 s1700
      28:m550 s1650 29:m500 s1750 30:m550 s550 31:m550 s600

      32:m500
      Extent=66250
      Mark min:450 max:550
      Space min:550 max:1800

      send: 105-105-0-0 s=3,c=1,t=24,pt=0,l=8,st=ok:5ea1e21c
      Decoded NEC: Value:FFFFFFFF (0 bits)
      Raw samples(4): Gap:40500
      Head: m8850 s2250
      0:m450
      Extent=11550
      Mark min:450 max:450
      Space min:32767 max:0

      send: 105-105-0-0 s=3,c=1,t=24,pt=0,l=8,st=ok:ffffffff
      Decoded NEC: Value:FFFFFFFF (0 bits)
      Raw samples(4): Gap:29764
      Head: m8850 s2300
      0:m500
      Extent=11650
      Mark min:500 max:500
      Space min:32767 max:0

      send: 105-105-0-0 s=3,c=1,t=24,pt=0,l=8,st=ok:ffffffff

      posted in Troubleshooting
      Corvl
      Corvl
    • RE: Device to remotely turn a thermostat

      Answer to myself:

      I use now Imperihome , with that you can use your own icons 🙂

      posted in My Project
      Corvl
      Corvl
    • RE: Wireless transciever with external antenne does not work.

      okidoki, will do ,
      thanks,
      Cor

      posted in Troubleshooting
      Corvl
      Corvl
    • Wireless transciever with external antenne does not work.

      Hello all,

      Can someone help me with the following.

      I have succesfully made a serial gateway and a servo actuator. I want to use the tranciever with external antenne. When I use the one without the external antenna:
      http://www.ebay.de/itm/311156596257?_trksid=p2060778.m2749.l2649&ssPageName=STRK%3AMEBIDX%3AIT
      Everything is working fine.

      When I hook up the shield with external antenne , it doesn't work.
      http://www.ebay.de/itm/310651702557?_trksid=p2060778.m2749.l2649&ssPageName=STRK%3AMEBIDX%3AIT

      I tried to power the shield with an external powersupply and a stepdown thingy to get 3.3 v
      Also the Decoupling-Capacitor is installed , but as soon as I switch the tranciever shield , from the build in antenna to external antenna , no joy.

      I have tried several Arduino nano's
      http://www.ebay.de/itm/291244948748?_trksid=p2060778.m2749.l2649&ssPageName=STRK%3AMEBIDX%3AIT

      and this one:
      http://www.ebay.de/itm/301404799100?_trksid=p2060778.m2749.l2649&ssPageName=STRK%3AMEBIDX%3AIT

      But all the same.

      When I use my Arduino uno, it works , when I connect the external antenna shield directly on 3.3v or with stepdown on 5v or on external powersource with the stepdown regulator.

      Anyone has an idea why I can not get it to work on the nano's?

      thanks,
      Cor

      posted in Troubleshooting
      Corvl
      Corvl
    • USB2 port LED flickering very fast.

      Good evening!

      Recently I build a serial gateway with an arduino nano to controll a servo via another nano.
      This worked well.

      Today I wanted remotely ( I was far away from home) to controll this servo and I noticed that my vera3 was not responding.

      I just came home and noticed that USB2 led was flashing/flickering very fast. I unplugged the vera 3 and plugged it in again , I had to setup the serial port again, and all worked fine.

      But the USB2 port is still flashing very fast , maybe something like 10 times a second. I don't recall vera doing this before.

      Someone has an idea what went/is wrong? and how to troubleshoot?

      thanks,
      Cor

      posted in Troubleshooting
      Corvl
      Corvl
    • Controlling a ( or some) device(s) via IR

      Hello all,

      Having been a happy vera3 and a bridged lite owner I was still missing some options. I am so happy this arduino stuff came available. I recently build an actuator to controll my floorheating.

      The second device I would like to make is a device which at least switch off my mediabox via IR. It would be nice if it is possible to also controll some functions on my television ( Samsung) as well , like switching on.

      For this project I have ordered a Arduino nano and this IR shield http://www.ebay.de/itm/400602576265?_trksid=p2060778.m2749.l2649&ssPageName=STRK%3AMEBIDX%3AIT

      And offcourse a 2,4 Transceiver Module.

      Next week when I am home I will put this together on an Arduino UNO for testing.
      When it is working , it will be nice to also include a temp sensor on it , a humidity sensor, I read somewhere , someone is working on a air-quality sensor.

      But first the IR-bit.

      This is the sketch from the "build" area of this website:


         // Example sketch showing how to control ir devices
        // An IR LED must be connected to Arduino PWM pin 3.
         // An optional ir receiver can be connected to PWM pin 8. 
         // All receied ir signals will be sent to gateway device stored in VAR_1.
         // When binary light on is clicked - sketch will send volume up ir command
         // When binary light off is clicked - sketch will send volume down ir command
         
         #include <MySensor.h>
         #include <SPI.h>
         #include <IRLib.h>
         
         int RECV_PIN = 8;
         
         #define CHILD_1  3  // childId
         
         IRsend irsend;
         IRrecv irrecv(RECV_PIN);
         IRdecode decoder;
         //decode_results results;
         unsigned int Buffer[RAWBUF];
         MySensor gw;
         MyMessage msg(CHILD_1, V_VAR1);
         
         void setup()  
         {  
                 irrecv.enableIRIn(); // Start the ir receiver
           decoder.UseExtnBuf(Buffer);
           gw.begin(incomingMessage);
         
           // Send the sketch version information to the gateway and Controller
           gw.sendSketchInfo("IR Sensor", "1.0");
         
           // Register a sensors to gw. Use binary light for test purposes.
           gw.present(CHILD_1, S_LIGHT);
         }
         
         
         void loop() 
         {
           gw.process();
           if (irrecv.GetResults(&decoder)) {
             irrecv.resume(); 
             decoder.decode();
             decoder.DumpResults();
                 
             char buffer[10];
             sprintf(buffer, "%08lx", decoder.value);
             // Send ir result to gw
             gw.send(msg.set(buffer));
           }
         }
      
      
      
         void incomingMessage(const MyMessage &message) {
           // We only expect one type of message from controller. But we better check anyway.
           if (message.type==V_LIGHT) {
              int incomingRelayStatus = message.getInt();
              if (incomingRelayStatus == 1) {
               irsend.send(NEC, 0x1EE17887, 32); // Vol up yamaha ysp-900
              } else {
               irsend.send(NEC, 0x1EE1F807, 32); // Vol down yamaha ysp-900
              }
              // Start receiving ir again...
             irrecv.enableIRIn(); 
           }
         }
             
         // Dumps out the decode_results structure.
         // Call this after IRrecv::decode()
         // void * to work around compiler issue
         //void dump(void *v) {
         //  decode_results *results = (decode_results *)v
         /*void dump(decode_results *results) {
           int count = results->rawlen;
           if (results->decode_type == UNKNOWN) {
             Serial.print("Unknown encoding: ");
           } 
           else if (results->decode_type == NEC) {
             Serial.print("Decoded NEC: ");
           } 
           else if (results->decode_type == SONY) {
             Serial.print("Decoded SONY: ");
           } 
           else if (results->decode_type == RC5) {
             Serial.print("Decoded RC5: ");
           } 
           else if (results->decode_type == RC6) {
             Serial.print("Decoded RC6: ");
           }
           else if (results->decode_type == PANASONIC) {	
             Serial.print("Decoded PANASONIC - Address: ");
             Serial.print(results->panasonicAddress,HEX);
      Serial.print(" Value: ");
           }
                  else if (results->decode_type == JVC) {
              Serial.print("Decoded JVC: ");
           }
           Serial.print(results->value, HEX);
           Serial.print(" (");
           Serial.print(results->bits, DEC);
           Serial.println(" bits)");
           Serial.print("Raw (");
           Serial.print(count, DEC);
           Serial.print("): ");
         
           for (int i = 0; i < count; i++) {
             if ((i % 2) == 1) {
               Serial.print(results->rawbuf[i]*USECPERTICK, DEC);
             } 
             else {
        Serial.print(-(int)results->rawbuf[i]*USECPERTICK, DEC);
      }
      Serial.print(" ");
           }
           Serial.println("");
         }
         */
      

      But how does it work??

      If I understand correctly , when I point my ( original) IR-transmitter of the mediabox to the IR reciever ( which is connected to pin 8 , the signal will be stored somewhere on VAR_1 , I expect I can see this somewhere on the GUI of my vera3

      This IR-code has to be copy-paste in the sketch.
      Here:


       if (incomingRelayStatus == 1) {
        irsend.send(NEC, *0x1EE17887, 32*); // standby
       } else {
        irsend.send(NEC, *0x1EE1F807, 32*); // switch on
      

      How am I doing so far??

      Cor

      posted in My Project
      Corvl
      Corvl
    • RE: Device to remotely turn a thermostat

      one more question.

      Controlling the thermostat I have a picture on the GUI and authomation app on my android of a window with curtains..... any possibility I can change this with another Icon, Just to make it a bit more perfect 🙂

      thanks,
      Cor

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

      @ Hek ,

      Thanks, I will post a building log in a new thread, for me , since I am very new with arduino and maybe other people can have abenefit as well , since on vera/z-wave there are no (cheap) "IR" - blasters available .

      Cor

      posted in My Project
      Corvl
      Corvl
    • RE: Device to remotely turn a thermostat

      Thanks for the nice words 🙂

      @ tbowmo: ......ohhhhhh , didn't know they existed , that would have been even a neater solution ( and probably quicker) , anyway , my system is working now.

      Cor

      posted in My Project
      Corvl
      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 Blaster

      I was also planning to make an arduino based IR blaster , since I thought it would be working.

      I just want to switch off my mediabox , with that I allready would be happy , when I read this post it is not possible :-S , or do I interpret it wrong?

      Thanks,
      Cor

      posted in My Project
      Corvl
      Corvl
    • RE: servo on arduino uno works , but not with nano

      On MCV forum someone came with the solution. it seems that this nano I have does not have enough output on the 3.3v pin for the shield with external antenna I wanted to use.

      It is working with the shield without external antenna. Checking now if it is possible to have the full output with external antenna on 5v with a 3.3v regulator in between.

      Thanks,
      Cor

      posted in Troubleshooting
      Corvl
      Corvl
    • RE: servo on arduino uno works , but not with nano

      Thanks , I will use a seperate power source for the servo , as soon as I can include the device on my vera.

      What do you mean , clear eprom ? , I used my UNO get a bootloader in the nano : http://www.instructables.com/id/How-To-Burn-a-Bootloader-to-Clone-Arduino-Nano-30/step3/Simple-few-steps/

      That's not good enough?

      Thanks for your help ,
      Cor

      posted in Troubleshooting
      Corvl
      Corvl
    • servo on arduino uno works , but not with nano

      Hello all,

      I have an arduino uno with a servo succesfully installed, but the arduino was just for testing purposes.

      Ijust recieved my 2 nano's ( http://www.ebay.de/itm/291244948748?_trksid=p2060778.m2749.l2649&ssPageName=STRK%3AMEBIDX%3AIT )

      installed everything and uploaded the sketch , just to be sure I deleted the 2 devices I allready had ( the arduino node and the arduino win covering) . I press start to include , nothing happends.

      Tried the second nano, exactly the same , tried to upload the sketch with "#define CHILD_ID 11 // Id of the sensor child " instead of 10 ( maybe an issue since the uno used 10 ).

      But still the same .

      Deleted the whole my sensnor plugin and tried all again...... no luck with the nano's.

      My last resort was to use again the uno , I press start to include , and yes , almost immediately the 2 devices were found.

      What can be wrong??!

      Attached 2 pictures of the connection , but I don't think I did that part wrong.

      Hopefully someone can help,

      Thanks,
      Cor
      20141209_014658.jpg 20141209_014645.jpg

      posted in Troubleshooting
      Corvl
      Corvl
    • RE: Servo only does 90 degrees

      Just recieved a responce via another forum.


      I ran in the same problem. I 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
      

      posted in Troubleshooting
      Corvl
      Corvl
    • Servo only does 90 degrees

      Hello all,

      This night I finally made some time to build a gateway and a device to use a servo.
      The only issues I had was finding drivers to programm the nano and the uno ( I use the uno for the servo).

      Now , there is 1 issue. The servo only turns max 90 degrees. I uploaded the sketch without changing anything.
      http://www.mysensors.org/build/servo

      It should to a full 180 degrees I think ? it is a standard futaba S3001.
      The servo is good ( I checked with my RC transmitter and reciever)

      anyone has an idea how to troubleshoot?

      edit ... oh ... that's wierd... when I use the slider or open-close , it does the 90 degrees. but when I click up-down, it does full 180 degrees ...... why not with the slider??

      thanks,
      Cor

      posted in Troubleshooting
      Corvl
      Corvl