Navigation

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

    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