Skip to content

Sonoff Dual R3 v1.6

José Antonio Jiménez Campos edited this page Feb 4, 2025 · 37 revisions

Main Chip: ESP32 Dual Core.

With built-in RC snubber for inductive loads: 1A max.

Power Energy Meter Chip: CSE7761:

Datasheets:

Official Product Link

Connections

  • CSE7761:
    • UART:
      • Speed: 38400
      • Parity: Even
      • Stopbits: 1
      • TX Pin: GPIO 25.
      • RX Pin: GPIO 26.
    • Pulse2 Pin: GPIO 4.
  • Relays:
    • L Out 1: GPIO 27
    • L Out 2: GPIO 14
  • Inputs:
    • Built-in Button: GPIO 0
    • S1: GPIO 32
    • S2: GPIO 33
  • Status LED: GPIO 13

Flash

Only wired flash.

MEPLHAA Scripts

  • Relay switching by Zero-Cross Detection at GPIO 4.
    • Switching at 0V before positive wave.
    • Calibrated with oscilloscope by @TriderG75.
  • Built-in Button: Setup Mode holding it for 8 seconds.
  • Power Metering.

2 Switches

  • HomeKit switches at different rooms in Apple Home.
  • S1 and S2: physical switches.
  • Protections:
    • Overvoltage: 240V.
    • Per channel overcurrent: 10A.
    • Per channel overpower: 2200W.
    • Total overcurrent: 15A.
    • Total overpower: 3300W.
{"c":{"cd":0.5,"zd":3.8,"io":[[[27,14,13],2],[[32,33,0],6],[[4],1]],"r":[{"n":10,"s":38400,"p":2,"g":[25,26]}],"l":13,"b":[[0,5]],
"0":{"u":[{"v":"a5ea96da","d":10},
{"v":"a5eae58b","d":10},
{"v":"a580ff04d7","d":10},
{"v":"a581108346","d":10},
{"v":"a5930fe5d3","d":10},
{"v":"a59d3290fb","d":10},
{"v":"a5eadc94"}]}},"a":[
{"0":{"r":[[27,0,0,4,3]]},"1":{"r":[[27,1,0,4,3]]},"b":[[32],[32,0]],"es":[{"t":75,"h":2,"n":4}]},
{"0":{"r":[[14,0,0,4,3]]},"1":{"r":[[14,1,0,4,3]]},"b":[[33],[33,0]],"es":[{"t":75,"h":2,"n":4}]},
{"t":80,"h":0,"j":0,"n":5,"dt":[0,7002,0,1,7004,0],"y0":[{"v":3300,"r":1,"m":[[1],[3]]}]},
{"t":80,"h":0,"j":0,"n":5,"dt":[0,7002,0,1,7004,0],"y0":[{"v":15,"r":1,"m":[[1],[3]]}]},
{"t":80,"h":0,"ks":2,"n":23,"dt":[4,2],"l":[0,4000],"ff":-0.00002072839583,"tg":[4,2],"y0":[{"v":0,"m":[[-2,-1000000]]},{"v":2200,"r":1,"m":[[3]]}]},
{"t":80,"h":0,"ks":2,"n":23,"dt":[3,0],"l":[0,20],"ff":0.000006227813415,"tg":[4,1],"y0":[{"v":0,"m":[[-2,-1000000]]},{"v":10,"r":1,"m":[[3]]}]},
{"t":80,"h":0,"ks":2,"n":23,"dt":[4,2],"l":[0,4000],"ff":-0.00002072839583,"tg":[2,2],"y0":[{"v":2200,"r":1,"m":[[1]]}]},
{"t":80,"h":0,"ks":2,"n":23,"dt":[3,0],"l":[0,20],"ff":0.000006227813415,"tg":[2,1],"y0":[{"v":10,"r":1,"m":[[1]]}]},
{"t":80,"h":0,"ks":2,"n":23,"dt":[3,0],"l":[0,400],"ff":0.0001014816318,"tg":[2,0],"y0":[{"v":0,"r":1,"0":{"c":[[0,0,4,0]]}},{"v":240,"r":1,"0":{"m":[[1],[3]]}}]},
{"t":65,"h":0,"e":6,"s":1,"y0":[
{"v":1,"0":{"u":[{"v":"a526"}],"m":[[-5,-10000],[-1,-10001]]}},
{"v":2,"0":{"u":[{"v":"a524"}],"m":[[-1,-10000],[-2,-10001]]}},
{"v":3,"0":{"u":[{"v":"a52c"}],"m":[[-2,-10000],[-3,-10001]]}},
{"v":4,"0":{"u":[{"v":"a525"}],"m":[[-3,-10000],[-4,-10001]]}},
{"v":5,"0":{"u":[{"v":"a52d"}],"m":[[-4,-10000],[-5,-10001]]}},
{"v":6,"0":{"m":[[0,1]]}}]},
{"h":0,"s":1,"i":1,"0":{"m":[[-1,-1],[0,1]]}}
]}

Modifications:

  • Use external push buttons on S1 and S2, instead switches:

Remove ,[32,0] and ,[33,0]

Window Covering

  • S1 and S2: physical switch.
    • S1 and L Out 1: Close.
    • S2 and L Out 2: Open.
  • Times:
    • Open: 18.3s
    • Close: 14.8s
  • Protections:
    • Overvoltage: 240V.
    • Per channel overcurrent: 1A.
    • Per channel overpower: 220W.
{"c":{"cd":0.5,"zd":3.8,"io":[[[27,14,13],2],[[32,33,0],6],[[4],1]],
"r":[{"n":10,"s":38400,"p":2,"g":[25,26]}],"l":13,"b":[[0,5]],
"0":{"u":[{"v":"a5ea96da","d":10},
{"v":"a5eae58b","d":10},
{"v":"a580ff04d7","d":10},
{"v":"a5811003c6","d":10},
{"v":"a5930fe5d3","d":10},
{"v":"a59d3290fb","d":10},
{"v":"a5eadc94"}]}},
"a":[
{"t":45
,"o":18.3
,"c":14.8
,"f":40
,"0":{"r":[[14],[27,1,0,4,3]]},
"1":{"r":[[14,1,0,4,3],[27,0,0,4,3]]},
"2":{"r":[[14,0,0,4,3],[27,0,0,4,3]]},
"3":{"r":[[14,0,0,4,3],[27,0,0.2,4,3]]},
"4":{"r":[[14,0,0.2,4,3],[27,0,0,4,3]]},
"8":{"m":[[0,101]]},
"f0":[[32,0]],"f1":[[33,0]],"f2":[[32],[33]]
,"es":[{"t":75,"h":2,"n":4},{"t":75,"h":2,"n":4}]},
{"t":80,"h":0,"ks":2,"n":23,"dt":[4,2],"l":[0,4000],"ff":-0.00002072839583,"tg":[3,2],"y0":[{"v":220,"r":1,"m":[[1,-1]]}]},
{"t":80,"h":0,"ks":2,"n":23,"dt":[3,0],"l":[0,20],"ff":0.000006227813415,"tg":[3,1],"y0":[{"v":1,"r":1,"m":[[1,-1]]}]},
{"t":80,"h":0,"ks":2,"n":23,"dt":[4,2],"l":[0,4000],"ff":-0.00002072839583,"tg":[2,2],"y0":[{"v":220,"r":1,"m":[[1,-1]]}]},
{"t":80,"h":0,"ks":2,"n":23,"dt":[3,0],"l":[0,20],"ff":0.000006227813415,"tg":[2,1],"y0":[{"v":1,"r":1,"m":[[1,-1]]}]},
{"t":80,"h":0,"ks":2,"n":23,"dt":[3,0],"l":[0,400],"ff":0.0001014816318,"tg":[2,0],"y0":[{"v":0,"r":1,"0":{"c":[[0,0,3,0]]}},{"v":240,"r":1,"0":{"m":[[1,-1]]}}]},
{"t":65,"h":0,"e":6,"s":1,"y0":[
{"v":1,"0":{"u":[{"v":"a526"}],"m":[[-5,-10000],[-1,-10001]]}},
{"v":2,"0":{"u":[{"v":"a524"}],"m":[[-1,-10000],[-2,-10001]]}},
{"v":3,"0":{"u":[{"v":"a52c"}],"m":[[-2,-10000],[-3,-10001]]}},
{"v":4,"0":{"u":[{"v":"a525"}],"m":[[-3,-10000],[-4,-10001]]}},
{"v":5,"0":{"u":[{"v":"a52d"}],"m":[[-4,-10000],[-5,-10001]]}},
{"v":6,"0":{"m":[[0,1]]}}]},
{"h":0,"s":1,"i":1,"0":{"m":[[-1,-1],[0,1]]}}
]}

Modifications:

  • Use external push buttons on S1 and S2, instead switches:

Replace line:

"f0":[[32,0]],"f1":[[33,0]],"f2":[[32],[33]]

with

"f3":[[32]],"f4":[[33]]

  • Use single push buttons on S1, instead 2 switches:
    • Single press: Open, stop, and close is cover is totally opened.
    • Double press: Close.

Replace line:

"f0":[[32,0]],"f1":[[33,0]],"f2":[[32],[33]]

with

"f1":[[32,2]],"f7":[[32]]

  • Enable Virtual Stop feature:

Add ,"vs":1 after {"t":45

Clone this wiki locally