Garage gate - sequence (1 btn) to directional (3 btn) control for somfy dexxo 1000

I have the garage gate opener somfy dexxo 1000 and I would like to add there following features:

  • divide open/close/stop on 3 buttons (instead of oryginal sequence actions when 1-button trigger occures)
  • add engine encoder to track current opening state
  • exchange data using MQTT with openhab

I started with additional device based on ESP8266 (Wemos mini) + relay + cheap encoder with 3d printed parts and now I am able to track gate position, exchange data using MQTT with openhab but opening and closing the gate is still made as sequence as I havent found the solution yet)

I will apreciate any tips/solutions how to make it directional (so that I would control the gate direction using 3 buttons, open-close-stop, instead of 1). I can share the Wemos d1 code and STL files for encoder mount if anyone needs it as it can be rather universal for any gate opener (anyway encoder mount can be different for different gate openers)

You could use one of the D1 pin to simulate the original button and another 3 pins for the 3 buttons you need.

  • Press button 1 - one trigger on simulated button pin
  • Press button 2 - two triggers on simulated button pin
  • Press button 3 - three triggers on simulated button pin

The problem is that this somfy dexxo 1000 has not pins for directional control (at least without disassembling the cover). I will put here the photo how it looks like in 2h

First tip, always solder. I know ur probably just in ‘dev’ stage, but solder your connections later…

For the logic:

CHeck if rotary encoder position is changing. If it is, the door is either opening or closing. Check the delta if it is a increasing or decreasing to know if it’s opening or closing:

int lastPos = 0;
bool isMoving = false;
bool isOpening = false;

bool commandOpen = false;
bool commandStop = false;
bool commandClose = false;

setup() {
    attachInterrupt(digitalPinToInterrupt(yourOpenPin), onOpen, FALLING);
    attachInterrupt(digitalPinToInterrupt(yourStopPin), onStop, FALLING);
    attachInterrupt(digitalPinToInterrupt(yourClosePin), onClose, FALLING);
void loop() {
   //pseudo code, IDK which encoder you are using
   int currentPos = getYourEncoderPos();
   if (currentPos == lastPos) {
      isMoving = false;
   } else {
      isMoving = true;
      isOpening = lastPos < currentPos;
   lastPos = currentPos;
   if (commandOpen && !isOpening) {
	commandOpen = false;
	if (isMoving) {
		// It's moving, so stop it first
		digitalWrite(yourActualPinForTheMainButton, HIGH;
		delay(1000); // wait a bit
		digitalWrite(yourActualPin, LOW);
	digitalWrite(yourActualPinForTheMainButton, HIGH;
	delay(1000); // wait a bit
	digitalWrite(yourActualPin, LOW);

void onOpen() {
   commandOpen = true;

void onStop() {
	commandStop = true;

void onClose() {
	commandCLose = true;

It’s basically a pseudo code to get you started.

Not sure why you used a relay… a transistor would have been enough to close the somfy button circuit

Ok so the photo how the output looks like:

Basicly I use relay as I didnt want to solder too much to create PCB but maybe I will create one.
I tried to implement something similar but I tried to immediatly (50ms delay) trigger “Start” twice (based on last actions, not to wait when the gate start to move to determine whether it is closing or opening). Hmm… longer delay would work but before this I want to be sure that there is no other way without too many gate “turns” (which I guess, it will have an impact on gate rails)

*without long delays between two triggers when the gate significantly start to move, it either doesnt change direction or there is no reaction on trigger “start”

so basicly I would like to make it work without the needs to stop the gate when it is already moving to change direction

I don’t think you will be able to reverse the direction of the gate without making it stop first without opening the “black box” and even then you may have to reprogram the eprom in there.
Stopping before changing direction actually protects the motor and the gear box.
You will need to achieve this programmaticaly with your D1. The functionality will remain the same as it is now except you will have 3 buttons instead of one AND you will be able to do it remotely.

Yep. I considered that scenario in the example code above.

Yes, you need to give the encoder enough time to take readings, so you know if it’s moving, and in what direction.

Ok, I decided to leave 1 button trigger for now as to implement direction change based on encoder I need to be sure that this 0.70 EUR encoder works reliably (for now it works perfectly with some filtering it triggers very accurate gate position)

Some photos how the final mount looks like (except dust which is not final :P)

nice work. WHy did you buy an enclosure when you already have a 3d printer :slight_smile:

For my garage, I use an LIS3DH to know direction. I detect angle changes on the door itself. Here’s some photos. I hooked directly on the button circuit. Sorry for crappy cell pics

Here’s the LIS3dh, you just need to have some good soldering skills :wink: I surface mounted this on custom pcb (I designed/created the PCB with a CNC router)

Based on the angle changes, i know the direction and position of the door.

This enclosure fits perfectly and my production power with 1x printer is poor so… MK3 is coming in the next 2 weeks ^^

Nice idea to use accelerometer, Hmm… maybe I will use it for the entrance gate! The size of the board is crazy :smiley: what CNC do you use to create as detailed pcb?