2 channel relay

This board can switch 2 relay outputs using a ESP-01 board.

2 channel relay board

2-channel relay is required for some use cases where devices like fans offer multiple speed modes or curtain / shade control. It requires an ESP01 compatible board like the ESP8266 ESP-01 or ESP32-C3 ESP-01.

This board itself offers some options that may be found at other boards too:

As there are many boards like these even with 4 relay output this may vary from board to board.

Flashing

Enable the ESP-01 compatible board to be used with the HomeDing environment by flashing the minimal sketch.

Using a ESP8266 some details on this can be found in the ESP-01 board description. As the minimal sketch includes many elements for implementing switches this can be used for relay very well.

Using a ESP32-C3 ESP-01 is a option without low flash memory limitations.

System Configuration

In the env.json file the device specific settings must be configured.

{
  "device": {
    "0": {
      "name": "relay02",
      "title": "Fan control",
      "description": "board with 2 relay that can be switched independently.",
      "loglevel": 0,
      "safemode": "false",
      "homepage": "/ding.htm"
    }
  },
  "ota": {
    "0": {
      "port": 8266,
      "passwd": "123",
      "description": "Listen for 'over the air' OTA Updates"
    }
  },
  "ntptime": {
    "0": {
      "zone": "CET-1CEST,M3.5.0,M10.5.0/3"    }
  }
}

Relay Configuration

This is a very simple configuration for config.json that enables switching each relay on its own with HIGH as the default level.

{
  "switch": {
    "gpio0": {
      "description": "Switch to control GPIO0",
      "value": 1,
      "onValue": "digitalout/gpio0?value=$v"
    },
    "gpio2": {
      "description": "Switch to control GPIO2",
      "value": 1,
      "onValue": "digitalout/gpio2?value=$v"
    }
  },
  "digitalout": {
    "gpio0": {
      "pin": "0",
      "invert": "false"
    },
    "gpio2": {
      "pin": "2",
      "invert": "false"
    }
  }
}

Shade or Blinds Control

Many shades or blinds can be controlled with a motor. To control the direction there is usually a motor that has 2 power connections, one for each direction of rotation. It must be ensured, that only one of them is actually connected.

This board with 2 relays can be used with the following wiring where the first relay controls the first power line and the second relay only can forward power to the second power line when the first relay is in off state.

Picture ???

The shade control element allows controlling 2 outputs for motors to open or close a shade, curtain, window or shutter. For this purpose the element knows roughly how many seconds are required to fully open or close and can automatically find the direction and time needed to open to a specific percentage. This is not exact control but allows e.g. to close a shutter for half the way.

For manual control the Shade Control Element implements some actions that support different number or kind of buttons.

“duration” : “8”

One Button

down->stop->up->stop->

A click on the button can create a “next” action to advance. When the max-duration or 0 is reached in up or down direction the shade control element automatically advances to the next stop state.

Fan Control

A cooling fan that has 4 levels of speed (0,1,2,3) air fans

See also

Tags

Board