My ESP32 Somfy RTS Controller

by rvdalen in Circuits > Electronics

290 Views, 1 Favorites, 0 Comments

My ESP32 Somfy RTS Controller

ESPSomfyRTS - system architecture.png

Control a Somfy shade with an ESP32, CC1101 and Home Assistant


I wanted to control my SunRain shade from my own home-automation system, without replacing the original Somfy remote.

I built a small controller based on an ESP32 and CC1101 433 MHz transceiver, using the open-source ESPSomfyRTS Software.

The result is a compact controller that can:

  1. control the Somfy shade
  2. track its position
  3. be controlled locally through the ESPSomfyRTS web interface
  4. integrate with Home Assistant and Node-RED
  5. detect when the Somfy motor is running
  6. warn me when rain is expected


The idea

The basic setup looks like this:

Home Assistant
↕
MQTT
↕
Node-RED
↕
MQTT
↕
ESP32 + CC1101
│
433 MHz
│
▼
Somfy RTS Shade

I also use a HomeWizard Energy Socket to detect when the Somfy motor is running. Since the motor draws approximately 200 W while operating, its power consumption provides a useful indication of motor activity.

For rain protection, Node-RED retrieves a rain forecast and can warn me when rain is expected within 30 minutes.

Supplies

XIAO ESP32 S3.jpg
CC1103 Module.png

What you need


Electronics

  1. ESP32
  2. CC1101 433 MHz transceiver
  3. 433 MHz antenna
  4. 5Vdc USB power supply
  5. PCB or suitable wiring

For my controller I used a Seeed Studio XIAO ESP32-S3 together with an E07-M1101D-SMA CC1101 module.

Optional

  1. HomeWizard energy plug
  2. Home Assistant
  3. Node-RED
  4. 3D printer

The HomeWizard plug is only required if you want to detect whether the motor is actually running.

The CC1101 Module

E07-M1101D-SMA.jpg
Wiring breadboard.jpg

There was an interesting little challenge with the CC1101 module I used.

My E07-M1101D-SMA module exposes only a single GDO signal, while ESPSomfyRTS normally uses separate RX and TX connections.

I found that I could configure both RX and TX to use the same ESP32 GPIO:

RX = GPIO 3
TX = GPIO 3

This allows the single GDO connection to be used for both receiving and transmitting.


Wiring

| CC1101 Pin | Description | ESP Signal | ESP Pin |
| ---------- | ----------- | ---------- | ------- |
| 1 | GND | GND | 13 |
| 2 | VCC | 3V3 | 12 |
| 3 | GDO0-RX/TX | GPIO 03 | 3 |
| 4 | CSN | GPIO 06 | 6 |
| 5 | SCK | GPIO 07 | 9 |
| 6 | MOSI | GPIO 09 | 11 |
| 7 | MISO | GPIO 08 | 10 |
| 8 | Not connected |

Install ESPSomfyRTS

ESP32SomfyRTS Radio configuration.jpg

The actual Somfy RTS functionality comes from the excellent open-source ESPSomfyRTS project.

I won't duplicate the complete installation instructions here. Follow the instructions in the original project: ESPSomfyRTS. There is also an instruction video available on YouTube.


After installing the firmware, configure the radio pins according to the wiring above.

For my hardware:

RX Pin: GPIO3
TX Pin: GPIO3

Pairing With the Somfy Shade

ESPSomfyRTS web interface.jpg

Once ESPSomfyRTS is running, the ESP32 provides a web interface that can be used to control the shade.

The ESP32 communicates with the Somfy motor using the 433 MHz Somfy RTS protocol.

The original physical Somfy remote can still be used. The ESP32 becomes an additional controller rather than replacing the existing remote.

This is particularly useful because the controller can keep track of the expected shade position independently of the physical remote.

My Custom PCB

Schematic&PCB.jpg
PCB Panels.jpg

After getting the ESP32 and CC1101 working on a prototype, I designed a small custom PCB.

The PCB contains the ESP32 and CC1101 connections and makes the final controller much more compact.

I also panelized the PCB before ordering, so I had several boards available for experimenting with and sharing.

The Enclosure

Enclosure.jpg

For the enclosure I used my own Onshape Boxify BoxConfigurator see also this Instructable

The PCB was used as the basis for the enclosure, and I 3D printed the resulting box.

This was a nice little test of Boxify as well: the electronics and enclosure remain parametrically connected, so changes to the PCB can be reflected in the enclosure design

Onshape - Boxify

Onshape - ESPSomfyRTS Enclosure


Detecting the Motor

HW Energy Socket.jpg

The Somfy motor itself doesn't provide a motor-running feedback signal.

So I used a HomeWizard energy socket.

When the motor runs, it consumes approximately 200 W. Node-RED can therefore use the measured power consumption to determine whether the motor is running.

This gives me useful feedback such as:

Motor: RUNNING
Motor: STOPPED

It also gives the automation system a way to detect whether the shade actually responded to a command.

The Finished Controller

The result.jpg
Node-Red Dashboard.jpg

And this is the final result:

ESP32 + CC1101 → custom PCB → 3D printed enclosure → Home Assistant / Node-RED

The ESP32 communicates with my home automation system using MQTT.

I use Node-RED for the control logic and dashboard.

The dashboard allows me to:

  1. open the shade
  2. close the shade
  3. stop the motor
  4. see the expected position
  5. see whether the motor is running
  6. receive a rain warning


One of the reasons I wanted the shade integrated into my home automation system was to make it react to weather conditions.

Node-RED retrieves the rain forecast and checks whether rain is expected.

If rain is expected within approximately 30 minutes, I can receive a warning and take the appropriate action with the shade.

This turns the Somfy controller from simply a remote-control replacement into part of my home automation system.


The complete project, including the KiCad files and Node-RED flow, is available on my github repository