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

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo
  1. Home
  2. OpenHardware.io
  3. 💬 AC-DC double solid state relay module

💬 AC-DC double solid state relay module

Scheduled Pinned Locked Moved OpenHardware.io
hlk-pm01solid state relaylight switchlightacdc
226 Posts 67 Posters 103.5k Views 65 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • openhardware.ioO openhardware.io

    https://www.openhardware.io/view/77/AC-DC-double-solid-state-relay-module

    M Offline
    M Offline
    Marco Lo Grasso
    wrote on last edited by Marco Lo Grasso
    #166

    I can't understand (scrub here) how to wire the regular light switch to the board.
    Supposing I want to use only one relay, I have to wire the switch to the 7 PIN and GND right?

    tonnerre33T 1 Reply Last reply
    0
    • M Marco Lo Grasso

      I can't understand (scrub here) how to wire the regular light switch to the board.
      Supposing I want to use only one relay, I have to wire the switch to the 7 PIN and GND right?

      tonnerre33T Offline
      tonnerre33T Offline
      tonnerre33
      Hardware Contributor
      wrote on last edited by tonnerre33
      #167

      @Marco-Lo-Grasso said in 💬 AC-DC double solid state relay module:

      Yes you have to do this, but i don't know if the sketch is working fine with the light switch ;) I haven't tested this feature yet.

      Caution, the light switch don't be connected to the 230V !

      1 Reply Last reply
      0
      • J Offline
        J Offline
        Joe Barneson
        wrote on last edited by
        #168

        Any suggestions for front panels on the light switches? I've connected mine to normal switches to control the relays, but I'd really like a 4-8 soft button front panel that I could also wire into GPIO's on an ESP for "scene" control outside of the local relays. Auy suggestions or experience would be great

        1 Reply Last reply
        0
        • Nca78N Offline
          Nca78N Offline
          Nca78
          Hardware Contributor
          wrote on last edited by
          #169

          Hello, I'm not sure exactly of what you want to to, but you could use software i2c on those two pins and connect and i2c keypad. You can search mpr121 keypad on google or aliexpress.
          But be careful you should add an isolating cover on top of it if you connect to this board as the crepage/cleatance between main voltage and 5V/3.3V is not sufficient in some part of the board and it could end up with low voltage circuit at main voltage...

          1 Reply Last reply
          0
          • J Offline
            J Offline
            Joe Barneson
            wrote on last edited by
            #170

            good to know clearence isn't there ... something i could correct though

            An i2c and capacity touch could work great.. but i can't find any cleanly designed front panel that I could use in place of my light switches.

            1 Reply Last reply
            0
            • M Offline
              M Offline
              Misna
              wrote on last edited by
              #171

              So if I understanded right the device needs also neutral to work? That's a problem because here in Finland we only circulate the phase through light switches. Neutral goes straight to the lamps.

              Nca78N 1 Reply Last reply
              0
              • M Misna

                So if I understanded right the device needs also neutral to work? That's a problem because here in Finland we only circulate the phase through light switches. Neutral goes straight to the lamps.

                Nca78N Offline
                Nca78N Offline
                Nca78
                Hardware Contributor
                wrote on last edited by
                #172

                @Misna said in 💬 AC-DC double solid state relay module:

                So if I understanded right the device needs also neutral to work? That's a problem because here in Finland we only circulate the phase through light switches. Neutral goes straight to the lamps.

                Yes it does. Same problem for most people, even here in Vietnam it's the same.
                Solution is to put it in ceiling connected directly to the lights, and use radio switch to control it.

                1 Reply Last reply
                0
                • H Offline
                  H Offline
                  hugch
                  wrote on last edited by
                  #173

                  Hi,
                  first of all you had an great idea to user a small layout with this functions.
                  The protection at the AC site is very good I think.

                  Today I get ten boards with your current gerber files (v3.3.2).
                  But I think it does not work as expected:

                  • Using a 5 V Arduino and the NRF without a level switcher with 3.3 V it will be break in the future.
                  • The big relay routes have no protection (I don't know if solder resist is the correct word).
                  • Maybe as pulldown resistor to the relay input could be useful.
                  • The three GND and Vcc Pins are not connected to each other.
                  • Maybe it could usefull to use fuse sockets for the not resetable fuse.

                  For the voltage problem we could use an 3.3 V Arduino mini pro with 8 MHz crystal.
                  In this case we don't need the LDO and could use LDO from the Arduino board.

                  1 Reply Last reply
                  0
                  • H Offline
                    H Offline
                    hugch
                    wrote on last edited by
                    #174

                    Sorry I forgot something.
                    For a 3.3 V Arduino we need a MOSFET or so to drive the SSR.
                    But there are cheep and small SMD packages available.

                    Nca78N 1 Reply Last reply
                    0
                    • H hugch

                      Sorry I forgot something.
                      For a 3.3 V Arduino we need a MOSFET or so to drive the SSR.
                      But there are cheep and small SMD packages available.

                      Nca78N Offline
                      Nca78N Offline
                      Nca78
                      Hardware Contributor
                      wrote on last edited by
                      #175

                      @hugch no you don't need MOSFET for those SSR, the high level of input is below 3.3V. I've made a board with those and a 3.3V Arduino and didn't have any problem.

                      For this board it's missing fuses on the SSRs, if they fail and shortcut nothing will stop the short circuit at the moment.

                      H 1 Reply Last reply
                      0
                      • Nca78N Nca78

                        @hugch no you don't need MOSFET for those SSR, the high level of input is below 3.3V. I've made a board with those and a 3.3V Arduino and didn't have any problem.

                        For this board it's missing fuses on the SSRs, if they fail and shortcut nothing will stop the short circuit at the moment.

                        H Offline
                        H Offline
                        hugch
                        wrote on last edited by
                        #176

                        @Nca78 My SSRs are with 5 V level but one with 3.3 V level would be better. You are right.
                        And the fuses are important but i think the step down have an over current protection, but a PTC could useful.
                        But a MOSFET or equal is also required:
                        It is not a good idea to drive current intensive peripheral directly with an micro controller.
                        The absolute maximum ratings for an ATmega328p is 40 mA. And a SSR is using 25 mA or so.
                        The better choice is using a driver or a simple transistor circuit.

                        To drive the SSR directly would not damage the controller at this moment, but your are decrease the lifetime.
                        And the lifetime for an in wall module or so is very important.

                        1 Reply Last reply
                        0
                        • A Offline
                          A Offline
                          alex1510
                          wrote on last edited by
                          #177

                          Hello!!, my name is Alejandro, I'm from Spain and I have been working on something quite similar to this project. I would like to contribute to reach a final design. What I have done until now is a prototype board similar than yours and I would like to add a top board with touch buttons to fit into Livolo glass panel switch.
                          https://es.aliexpress.com/store/product/Free-Shipping-Livolo-Luxury-White-Pearl-Crystal-Glass-151mm-80mm-EU-standard-Double-Glass-Panel-VL/500715_1684198410.html?spm=2114.12010608.0.0.6cyWwJ

                          And try to do something like this also including ws2812 rgb led for touchpad and a small speaker just to sound someting when touch the button.

                          https://z-uno.z-wave.me/projects/sensor-wall-switch-based-on-livolo-glass/

                          My development is based on ESP8266 without rf communication but as I have progressed I have checked that Wifi connection is a complex system compared to rf so I am thinking to change to arduino or esp + nrf.

                          1 Reply Last reply
                          0
                          • johnym30J Offline
                            johnym30J Offline
                            johnym30
                            wrote on last edited by
                            #178

                            Hi everyone . I managed to create my first module and it seems to working but why at my domoticz only one switch appears as new device???

                            1 Reply Last reply
                            0
                            • johnym30J Offline
                              johnym30J Offline
                              johnym30
                              wrote on last edited by
                              #179

                              I solved my last problem, but now i see that although both of the switches in Domoticz show off, i have power on the second one. What could be the problem? Faulty ssr?

                              1 Reply Last reply
                              0
                              • Nca78N Offline
                                Nca78N Offline
                                Nca78
                                Hardware Contributor
                                wrote on last edited by
                                #180

                                What's happening if you switch it on then off in domoticz ?

                                1 Reply Last reply
                                0
                                • johnym30J Offline
                                  johnym30J Offline
                                  johnym30
                                  wrote on last edited by
                                  #181

                                  Either pressing on or off in domoticz, i have always power on the second outpout.

                                  S 1 Reply Last reply
                                  0
                                  • johnym30J johnym30

                                    Either pressing on or off in domoticz, i have always power on the second outpout.

                                    S Offline
                                    S Offline
                                    stray
                                    wrote on last edited by
                                    #182

                                    @johnym30 Can you post your sketch?

                                    1 Reply Last reply
                                    0
                                    • johnym30J Offline
                                      johnym30J Offline
                                      johnym30
                                      wrote on last edited by johnym30
                                      #183

                                      This is my sketch

                                      // MySensor Debug
                                      #define MY_DEBUG
                                      
                                      // Enables repeater functionality (relays messages from other nodes)
                                      #define MY_REPEATER_FEATURE
                                      
                                      // Comment line below if you don't want to use the temperature sensor
                                      #define MY_RADIO_NRF24
                                      #define MY_TRANSPORT_WAIT_READY_MS
                                      #define MY_PARENT_NODE_ID 2
                                      #define MY_RADIO_NRF24
                                      #include <MySensors.h>
                                      #include <SPI.h>
                                      #include <Bounce2.h>
                                      
                                      #define RELAY_PIN_1   3  // Arduino Digital I/O pin number for relay 
                                      #define RELAY_PIN_2  5
                                      #define BUTTON_PIN_1  4  // Arduino Digital I/O pin number for button 
                                      #define BUTTON_PIN_2 7
                                      
                                      #define CHILD_ID_1 8 // Id of the sensor child for 1st relay
                                      #define CHILD_ID_2 9 // Id of the sensor child for 2nd relay
                                      
                                      // Relay status
                                      #define RELAY_ON 1
                                      #define RELAY_OFF 0
                                      
                                      // Source of state change (used when printing debug information)
                                      #define CHANGE_STATE_SOURCE_RADIO 0
                                      #define CHANGE_STATE_SOURCE_SWITCH 1
                                      
                                      
                                      
                                      Bounce debouncer1 = Bounce();
                                      int oldValue;
                                      bool state1;
                                      Bounce debouncer2 = Bounce();
                                      int oldValue2;
                                      bool state2;
                                      
                                      MyMessage msg(CHILD_ID_1, V_LIGHT);
                                      MyMessage msg2(CHILD_ID_2, V_LIGHT);
                                      
                                      
                                      
                                      void presentation() {
                                        // Send the sketch version information to the gateway and Controller
                                        sendSketchInfo("Double Relay & Button", "0.2");
                                        // Register all sensors to gw (they will be created as child devices)
                                        present(CHILD_ID_1, S_LIGHT);
                                        present(CHILD_ID_2, S_LIGHT);
                                      
                                      }
                                      
                                      void setup()
                                      {
                                        // Setup the button
                                        pinMode(BUTTON_PIN_1, INPUT);
                                        // Activate internal pull-up
                                        digitalWrite(BUTTON_PIN_1, HIGH);
                                      
                                        // Setup the button
                                        pinMode(BUTTON_PIN_2, INPUT);
                                        // Activate internal pull-up
                                        digitalWrite(BUTTON_PIN_2, HIGH);
                                      
                                        // After setting up the button, setup debouncer
                                        debouncer1.attach(BUTTON_PIN_1);
                                        debouncer1.interval(5);
                                      
                                        debouncer2.attach(BUTTON_PIN_2);
                                        debouncer2.interval(5);
                                      
                                        // Set the initial values of oldValue/oldValue2 variables from status of physical switches
                                        //  if this is not done the loop() will detect status change and switch the relays on or off
                                        debouncer1.update();
                                        debouncer2.update();
                                        oldValue = debouncer1.read();
                                        oldValue2 = debouncer2.read();
                                      
                                      
                                        // Make sure relays are off when starting up
                                        setRelayState(RELAY_PIN_1, RELAY_OFF);
                                        // Then set relay pins in output mode
                                        pinMode(RELAY_PIN_1, OUTPUT);
                                      
                                        digitalWrite(RELAY_PIN_2, RELAY_OFF);
                                        // Then set relay pins in output mode
                                        pinMode(RELAY_PIN_2, OUTPUT);
                                      
                                        // Set relay to last known state (using eeprom storage)
                                        state1 = loadState(CHILD_ID_1);
                                        setRelayState(RELAY_PIN_1, state1);
                                      
                                        state2 = loadState(CHILD_ID_2);
                                        setRelayState(RELAY_PIN_2, state2);
                                      }
                                      
                                      
                                      /*
                                         Example on how to asynchronously check for new messages from gw
                                      */
                                      void loop()
                                      {
                                        debouncer1.update();
                                        debouncer2.update();
                                        // Get the update value
                                        int value1 = debouncer1.read();
                                        int value2 = debouncer2.read();
                                      
                                        if (value1 != oldValue) {
                                          send(msg.set(state1 ? false : true), true); // Send new state and request ack back
                                          // Write some debug info
                                          printStateChangedDebug(CHANGE_STATE_SOURCE_SWITCH, CHILD_ID_1, value1);
                                        }
                                        oldValue = value1;
                                      
                                        if (value2 != oldValue2) {
                                          send(msg2.set(state2 ? false : true), true); // Send new state and request ack back
                                          // Write some debug info
                                          printStateChangedDebug(CHANGE_STATE_SOURCE_SWITCH, CHILD_ID_2, value2);
                                        }
                                        oldValue2 = value2;
                                      
                                      }
                                      
                                      void receive(const MyMessage &message) {
                                        // We only expect one type of message from controller. But we better check anyway.
                                        if (message.isAck()) {
                                      #ifdef MY_DEBUG
                                          Serial.println(F("This is an ack from gateway"));
                                      #endif
                                        }
                                        else if (message.type == V_LIGHT && message.sensor == CHILD_ID_1) {
                                          // Change relay state
                                          state1 = message.getBool();
                                          setRelayState(RELAY_PIN_1, state1);
                                          // Store state in eeprom
                                          saveState(CHILD_ID_1, state1);
                                          // Write some debug info
                                          printStateChangedDebug(CHANGE_STATE_SOURCE_RADIO, CHILD_ID_1, state1);
                                        }
                                        else if (message.type == V_LIGHT && message.sensor == CHILD_ID_2) {
                                          state2 = message.getBool();
                                          setRelayState(RELAY_PIN_2, state2);
                                          // Store state in eeprom
                                          saveState(CHILD_ID_2, state2);
                                          // Write some debug info
                                          printStateChangedDebug(CHANGE_STATE_SOURCE_RADIO, CHILD_ID_2, state2);
                                        }
                                      }
                                      
                                      // Set status of a relay pin
                                      void setRelayState(byte relayPin, bool value) {
                                        digitalWrite(relayPin, value ? RELAY_ON : RELAY_OFF);
                                      }
                                      
                                      // Print debug info, centralized in one place to minimize memory usage and have only one #ifdef MY_DEBUG for all state change messages
                                      void printStateChangedDebug(int source, int sensorID, bool value) {
                                      #ifdef MY_DEBUG
                                        Serial.print(F("Sensor value changed, source="));
                                        Serial.print(source == CHANGE_STATE_SOURCE_RADIO ? F("Radio") : F("Physical switch"));
                                        Serial.print(F(", Sensor="));
                                        Serial.print(sensorID);
                                        Serial.print(F(", New status: "));
                                        Serial.println(value);
                                      #endif
                                      }
                                      
                                      S 1 Reply Last reply
                                      0
                                      • johnym30J johnym30

                                        This is my sketch

                                        // MySensor Debug
                                        #define MY_DEBUG
                                        
                                        // Enables repeater functionality (relays messages from other nodes)
                                        #define MY_REPEATER_FEATURE
                                        
                                        // Comment line below if you don't want to use the temperature sensor
                                        #define MY_RADIO_NRF24
                                        #define MY_TRANSPORT_WAIT_READY_MS
                                        #define MY_PARENT_NODE_ID 2
                                        #define MY_RADIO_NRF24
                                        #include <MySensors.h>
                                        #include <SPI.h>
                                        #include <Bounce2.h>
                                        
                                        #define RELAY_PIN_1   3  // Arduino Digital I/O pin number for relay 
                                        #define RELAY_PIN_2  5
                                        #define BUTTON_PIN_1  4  // Arduino Digital I/O pin number for button 
                                        #define BUTTON_PIN_2 7
                                        
                                        #define CHILD_ID_1 8 // Id of the sensor child for 1st relay
                                        #define CHILD_ID_2 9 // Id of the sensor child for 2nd relay
                                        
                                        // Relay status
                                        #define RELAY_ON 1
                                        #define RELAY_OFF 0
                                        
                                        // Source of state change (used when printing debug information)
                                        #define CHANGE_STATE_SOURCE_RADIO 0
                                        #define CHANGE_STATE_SOURCE_SWITCH 1
                                        
                                        
                                        
                                        Bounce debouncer1 = Bounce();
                                        int oldValue;
                                        bool state1;
                                        Bounce debouncer2 = Bounce();
                                        int oldValue2;
                                        bool state2;
                                        
                                        MyMessage msg(CHILD_ID_1, V_LIGHT);
                                        MyMessage msg2(CHILD_ID_2, V_LIGHT);
                                        
                                        
                                        
                                        void presentation() {
                                          // Send the sketch version information to the gateway and Controller
                                          sendSketchInfo("Double Relay & Button", "0.2");
                                          // Register all sensors to gw (they will be created as child devices)
                                          present(CHILD_ID_1, S_LIGHT);
                                          present(CHILD_ID_2, S_LIGHT);
                                        
                                        }
                                        
                                        void setup()
                                        {
                                          // Setup the button
                                          pinMode(BUTTON_PIN_1, INPUT);
                                          // Activate internal pull-up
                                          digitalWrite(BUTTON_PIN_1, HIGH);
                                        
                                          // Setup the button
                                          pinMode(BUTTON_PIN_2, INPUT);
                                          // Activate internal pull-up
                                          digitalWrite(BUTTON_PIN_2, HIGH);
                                        
                                          // After setting up the button, setup debouncer
                                          debouncer1.attach(BUTTON_PIN_1);
                                          debouncer1.interval(5);
                                        
                                          debouncer2.attach(BUTTON_PIN_2);
                                          debouncer2.interval(5);
                                        
                                          // Set the initial values of oldValue/oldValue2 variables from status of physical switches
                                          //  if this is not done the loop() will detect status change and switch the relays on or off
                                          debouncer1.update();
                                          debouncer2.update();
                                          oldValue = debouncer1.read();
                                          oldValue2 = debouncer2.read();
                                        
                                        
                                          // Make sure relays are off when starting up
                                          setRelayState(RELAY_PIN_1, RELAY_OFF);
                                          // Then set relay pins in output mode
                                          pinMode(RELAY_PIN_1, OUTPUT);
                                        
                                          digitalWrite(RELAY_PIN_2, RELAY_OFF);
                                          // Then set relay pins in output mode
                                          pinMode(RELAY_PIN_2, OUTPUT);
                                        
                                          // Set relay to last known state (using eeprom storage)
                                          state1 = loadState(CHILD_ID_1);
                                          setRelayState(RELAY_PIN_1, state1);
                                        
                                          state2 = loadState(CHILD_ID_2);
                                          setRelayState(RELAY_PIN_2, state2);
                                        }
                                        
                                        
                                        /*
                                           Example on how to asynchronously check for new messages from gw
                                        */
                                        void loop()
                                        {
                                          debouncer1.update();
                                          debouncer2.update();
                                          // Get the update value
                                          int value1 = debouncer1.read();
                                          int value2 = debouncer2.read();
                                        
                                          if (value1 != oldValue) {
                                            send(msg.set(state1 ? false : true), true); // Send new state and request ack back
                                            // Write some debug info
                                            printStateChangedDebug(CHANGE_STATE_SOURCE_SWITCH, CHILD_ID_1, value1);
                                          }
                                          oldValue = value1;
                                        
                                          if (value2 != oldValue2) {
                                            send(msg2.set(state2 ? false : true), true); // Send new state and request ack back
                                            // Write some debug info
                                            printStateChangedDebug(CHANGE_STATE_SOURCE_SWITCH, CHILD_ID_2, value2);
                                          }
                                          oldValue2 = value2;
                                        
                                        }
                                        
                                        void receive(const MyMessage &message) {
                                          // We only expect one type of message from controller. But we better check anyway.
                                          if (message.isAck()) {
                                        #ifdef MY_DEBUG
                                            Serial.println(F("This is an ack from gateway"));
                                        #endif
                                          }
                                          else if (message.type == V_LIGHT && message.sensor == CHILD_ID_1) {
                                            // Change relay state
                                            state1 = message.getBool();
                                            setRelayState(RELAY_PIN_1, state1);
                                            // Store state in eeprom
                                            saveState(CHILD_ID_1, state1);
                                            // Write some debug info
                                            printStateChangedDebug(CHANGE_STATE_SOURCE_RADIO, CHILD_ID_1, state1);
                                          }
                                          else if (message.type == V_LIGHT && message.sensor == CHILD_ID_2) {
                                            state2 = message.getBool();
                                            setRelayState(RELAY_PIN_2, state2);
                                            // Store state in eeprom
                                            saveState(CHILD_ID_2, state2);
                                            // Write some debug info
                                            printStateChangedDebug(CHANGE_STATE_SOURCE_RADIO, CHILD_ID_2, state2);
                                          }
                                        }
                                        
                                        // Set status of a relay pin
                                        void setRelayState(byte relayPin, bool value) {
                                          digitalWrite(relayPin, value ? RELAY_ON : RELAY_OFF);
                                        }
                                        
                                        // Print debug info, centralized in one place to minimize memory usage and have only one #ifdef MY_DEBUG for all state change messages
                                        void printStateChangedDebug(int source, int sensorID, bool value) {
                                        #ifdef MY_DEBUG
                                          Serial.print(F("Sensor value changed, source="));
                                          Serial.print(source == CHANGE_STATE_SOURCE_RADIO ? F("Radio") : F("Physical switch"));
                                          Serial.print(F(", Sensor="));
                                          Serial.print(sensorID);
                                          Serial.print(F(", New status: "));
                                          Serial.println(value);
                                        #endif
                                        }
                                        
                                        S Offline
                                        S Offline
                                        stray
                                        wrote on last edited by
                                        #184

                                        @johnym30 Can't see anything wrong with the sketch that causes the 2 outputs toggle at the same time. However, I have 2 remarks:

                                        1. Don't you need to set the pins to output before you set them low?
                                        2. You are not updating your gateway when you toggle the output with the switch.
                                        johnym30J 1 Reply Last reply
                                        0
                                        • S stray

                                          @johnym30 Can't see anything wrong with the sketch that causes the 2 outputs toggle at the same time. However, I have 2 remarks:

                                          1. Don't you need to set the pins to output before you set them low?
                                          2. You are not updating your gateway when you toggle the output with the switch.
                                          johnym30J Offline
                                          johnym30J Offline
                                          johnym30
                                          wrote on last edited by
                                          #185

                                          @stray the think is that the first relay is working normal and i see the updates in domoticz when i turn it on or off.It is just the second relay that gives me power either it is on or off in domoticz.That is why i am thinking maybe the second relay is broken

                                          1 Reply Last reply
                                          0
                                          Reply
                                          • Reply as topic
                                          Log in to reply
                                          • Oldest to Newest
                                          • Newest to Oldest
                                          • Most Votes


                                          11

                                          Online

                                          11.7k

                                          Users

                                          11.2k

                                          Topics

                                          113.0k

                                          Posts


                                          Copyright 2019 TBD   |   Forum Guidelines   |   Privacy Policy   |   Terms of Service
                                          • Login

                                          • Don't have an account? Register

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