Navigation

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

    idefix

    @idefix

    1
    Reputation
    7
    Posts
    564
    Profile views
    0
    Followers
    0
    Following
    Joined Last Online

    idefix Follow

    Best posts made by idefix

    • Waterheater control

      Hi everyone,

      After quite a bit of delay I have restarted my water heater project to connect my Paloma Waterheater to Vera.

      The waterheater has 1x on/off push button, 1x temp up push button and 1x temp down push button.
      In addition the heater has a status LED which shows whether the heater is on or off.

      I have hacked the control panel of the heater and wired a 5v reed relay to each of the buttons.
      High on the relay will bridge the push button and "simulate" a button press.

      Arduino Pins 3, 4 and 5 are used for each of the relays with the other end of the spool connected to ground.
      The LED is wired to Pin 6 which I want to use as an input - high >2V = ON state, low <2V = Off state. The LED voltage I get from the board looks like it is stepped down (If I connect a reed relay the relay flip flops very fast).

      I tried around to get the code working based on the relay example posted on this page but I can't figure out how to adapt it as the relay code only would allow for m

      Issues I have:

      1. The relay code switches does not simulate a push button. As I only need the relay to pull for a short period of time - else the control panel will freaks out - how do I send a high impulse only on the respective pins (3-5)?

      2. I would need the state - high or low - of Pin6 to update the button status in Vera for Pin 3 only. High - state = on, low - state = off without triggering the relay itself. This is to indicate in vera whether the heater is on or off in case someone pushed the button on the panel itself.

      3. Each button will show up as a separate light switch in Vera - I assume that a new "type" and vera plugin would be required to have the on/off, temp up and down buttons all on one single device?

      Could someone help me with the code for this?
      Here is what I have so far (which is not much at all...):

       // Paloma Waterheater Control based on mysensors.org Relay exmaple
      
         #include <MySensor.h>
         #include <SPI.h>
      
         #define RELAY_1  3  // Arduino Digital I/O pin number for Water Heater On/Off push Button
         #define RELAY_2  4  // Arduino Digital I/O pin number for Water Temp Up push Button
        #define RELAY_3  5  // Arduino Digital I/O pin number for Water Temp Down push Button
        #define NUMBER_OF_RELAYS 3 // Total number of attached relays
       #define LED_PIN  6  // Arduino Digital I/O pin number for Heater LED On/Off State
       #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");
      
            // Setup the LED
            pinMode(LED_PIN,INPUT);
            // Activate internal pull-up
            digitalWrite(LED_PIN,HIGH);
      
           // 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());
           } 
       }
      

      Thanks !

      posted in Development
      idefix
      idefix

    Latest posts made by idefix

    • RE: Waterheater control

      Thanks,

      I was thinking of using a photo resistor as well but I think the LED does not shine through the board. Will give this another try on the weekend.

      As for the send info to gw code i used, any comments? Is it correct in the first place?

      Thanks

      posted in Development
      idefix
      idefix
    • RE: Printables

      @shawn_ky said:

      @idefix said:

      @shawn_ky said:

      Would love to see if anyone has made a motion printable...

      you mean a motion sensor casing?

      Yes... The casing...

      I should have a sensor somewhere. If I find it I can quickly draw one up.

      posted in Announcements
      idefix
      idefix
    • RE: Printables

      @shawn_ky said:

      Would love to see if anyone has made a motion printable...

      you mean a motion sensor casing?

      posted in Announcements
      idefix
      idefix
    • RE: Waterheater control

      Some hour later I have a "half baked" code ready.

      What it does:

      • Heater On/Off relay works
      • Temp UP relay works
      • Temp Down relay works

      What does not work:

      • I can't figure out how to read the LED voltage on the control panel and send the status heater on or off back to vera.

      Some more info on this:

      • The control panel is powered by 12V. I will use the same supply to power the Arduino so I should have shared ground and therefore - I think - I should be able to read the voltage of the power LED pin on the control panel directly, correct?
        The idea is to read the voltage (the control uses a pulse to step down the main voltage to power the LED I believe as a reed relay will flip flop if connected directly to the LED) at the LED pin on the panel and, depending on the reading (>2v = on, <2v = off) send vera the on/off status.
        This will allow correct representation of the status on vera's side in case someone uses the push button on the panel to control the heater instead of vera and should avoid unknown toggle states.

      Below is my code. I have commented the voltage reading out of the loop. if it is enabled the board will not respond anymore.

      Quite dirt programming I'm afraid 😞

      Any help with this is highly appreciated !!
      Thanks !

            // Paloma Tankless Water Heater Script
            // Direct interface to control panel push buttons with reed relays as well as status check of panel power LED
            
            #include <MySensor.h>
            #include <SPI.h>
            #include <Bounce2.h>
            
            #define ID 1         // Set Sensor ID
            #define PWR_RLY  3   // Arduino Digital I/O pin number for the Power Button
            #define UP_RLY  4    // Arduino Digital I/O pin number for the Temp Up Button
            #define DWN_RLY  5   // Arduino Digital I/O pin number for the Temp Down Button
            
            #define PWR_LED  A0  // Arduino Analogue pin number for the Power LED
            
            #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;
            MyMessage msg(ID, V_HEATER_SW);
            
            int saveheatLvl = 0;   // save heat level data
            
            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("Water Heater", "1.0");
            
              // Register all sensors to gw (they will be created as child devices)
              gw.present(ID, S_HEATER);
              
              // Then set pins
                digitalWrite(PWR_RLY,RELAY_OFF);
                pinMode(PWR_RLY, OUTPUT);   
            
                digitalWrite(UP_RLY,RELAY_OFF);
                pinMode(UP_RLY, OUTPUT);   
                
                digitalWrite(DWN_RLY,RELAY_OFF);
                pinMode(DWN_RLY, OUTPUT);   
            }
            
            void loop ()
            {
             // Always process incoming messages whenever possible
             gw.process(); 
            
              // voltage ();    // if included will create a loop? and relays are not responding anymore
            }
            
            void voltage(){
              // Read LED voltage 
             int sensorValue = analogRead(PWR_LED);
             float voltage = sensorValue * (5.0 / 1023.0);
             delay (1);
             if (voltage == 5) {
                 gw.send(msg.set("HeatOn"),true);    // check LED voltage and set Heat on if 5V detected
             }else{
                 gw.send(msg.set("Off"),true);    // check LED voltage and set Off if <5V detected   
             }
            }
            
            void incomingMessage(const MyMessage &message) {
              // Check for Heater Switch Message
              if (message.type==V_HEATER_SW) {
                // Switch Heater On
                if (strncmp (message.data,"HeatOn",6) == 0){
                  Serial.println("Switching Heater ON");
                  digitalWrite(PWR_RLY,RELAY_ON);
                  delay(500);
                  digitalWrite(PWR_RLY,RELAY_OFF);
                  gw.send(msg.set("HeatOn"),true);
                }
                
                // Switch Heater Off
                if (strncmp (message.data,"Off",3) == 0){
                  Serial.println("Switching Heater OFF");
                  digitalWrite(PWR_RLY,RELAY_ON);
                  delay(500);
                  digitalWrite(PWR_RLY,RELAY_OFF);
                  gw.send(msg.set("Off"),true);
                }   
               } 
               
               if (message.type==V_HEATER) {
                // Check for Temperature Up/Down Message
                int heatLvl = atoi(message.data);
                
                // Check if new Temperature is higher than previous set point
                if ( heatLvl > saveheatLvl) {
                  Serial.println("Increase Temperature");
                  digitalWrite(UP_RLY,RELAY_ON);
                  delay(500);
                  digitalWrite(UP_RLY,RELAY_OFF);
                  saveheatLvl = heatLvl;
                  gw.send(msg.set(saveheatLvl),true); 
                }
                
                // Check if new Temperature is lower than previous set point
                if ( heatLvl < saveheatLvl) {
                  Serial.println("Reduce Temperature");
                  digitalWrite(DWN_RLY,RELAY_ON);
                  delay(500);
                  digitalWrite(DWN_RLY,RELAY_OFF);
                  saveheatLvl = heatLvl;
                  gw.send(msg.set(saveheatLvl),true); 
                }
               } 
               
            }
      posted in Development
      idefix
      idefix
    • RE: Waterheater control

      Hi Hek & ServiceXP,

      thanks for your replies.
      I will try - as soon as I have figured out how to get the basic script to work as I have very little Arduino expertise nor have I created a sensor from scratch before - the pulse code above.

      I believe the panel goes into some sort of programming mode if the power button is pressed continuously.
      In addition if I would keep it pressed via the relay, local input on the button itself would not work anymore as it is shorted out continuously. I'm basically simulating a button press by bridging the button with a relay in parallel to the original button.

      I will try and write some code up now (I found a heater example in the forum here but it was based on 1.3 so no idea how to get this to work with 1.4). Fingers crossed 🙂

      posted in Development
      idefix
      idefix
    • RE: Printables

      Please feel free to add the Lux Sensor case I posted on the vera forum some time back together with the code.
      The files can also be found on thingiverse: http://www.thingiverse.com/thing:487840

      posted in Announcements
      idefix
      idefix
    • Waterheater control

      Hi everyone,

      After quite a bit of delay I have restarted my water heater project to connect my Paloma Waterheater to Vera.

      The waterheater has 1x on/off push button, 1x temp up push button and 1x temp down push button.
      In addition the heater has a status LED which shows whether the heater is on or off.

      I have hacked the control panel of the heater and wired a 5v reed relay to each of the buttons.
      High on the relay will bridge the push button and "simulate" a button press.

      Arduino Pins 3, 4 and 5 are used for each of the relays with the other end of the spool connected to ground.
      The LED is wired to Pin 6 which I want to use as an input - high >2V = ON state, low <2V = Off state. The LED voltage I get from the board looks like it is stepped down (If I connect a reed relay the relay flip flops very fast).

      I tried around to get the code working based on the relay example posted on this page but I can't figure out how to adapt it as the relay code only would allow for m

      Issues I have:

      1. The relay code switches does not simulate a push button. As I only need the relay to pull for a short period of time - else the control panel will freaks out - how do I send a high impulse only on the respective pins (3-5)?

      2. I would need the state - high or low - of Pin6 to update the button status in Vera for Pin 3 only. High - state = on, low - state = off without triggering the relay itself. This is to indicate in vera whether the heater is on or off in case someone pushed the button on the panel itself.

      3. Each button will show up as a separate light switch in Vera - I assume that a new "type" and vera plugin would be required to have the on/off, temp up and down buttons all on one single device?

      Could someone help me with the code for this?
      Here is what I have so far (which is not much at all...):

       // Paloma Waterheater Control based on mysensors.org Relay exmaple
      
         #include <MySensor.h>
         #include <SPI.h>
      
         #define RELAY_1  3  // Arduino Digital I/O pin number for Water Heater On/Off push Button
         #define RELAY_2  4  // Arduino Digital I/O pin number for Water Temp Up push Button
        #define RELAY_3  5  // Arduino Digital I/O pin number for Water Temp Down push Button
        #define NUMBER_OF_RELAYS 3 // Total number of attached relays
       #define LED_PIN  6  // Arduino Digital I/O pin number for Heater LED On/Off State
       #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");
      
            // Setup the LED
            pinMode(LED_PIN,INPUT);
            // Activate internal pull-up
            digitalWrite(LED_PIN,HIGH);
      
           // 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());
           } 
       }
      

      Thanks !

      posted in Development
      idefix
      idefix