How to Connect Your Somfy Remote to Alexa With an ESP8266 to Control Your Motorized Blinds

21,985

17

44

Introduction: How to Connect Your Somfy Remote to Alexa With an ESP8266 to Control Your Motorized Blinds

As a home automation enthusiast, I wanted to find a way to use Alexa to open and close my motorized blinds. I looked on line to purchase a solution, but found that the offerings were expensive and had somewhat bad reviews. Not wanting to put out the money for a marginal solution, I started exploring options for connecting my existing remote to Alexa. I found several good resources, including some instructables, but no single step by step guide. Hopefully, you will find this instructable clear and easy to follow with most of the resources you need.

In this instructable, I show you how to control one channel of your remote and you can make one or multiple blinds go up and down in a group. Later I will provide an update for individually controlling multiple blinds.

Step 1: Pull All the Pieces Together

Here is the list of hardware and software you will need and where to find it:

  • Somfy remote, if you don't want to use your current one - Found here on Amazon
  • ESP8266. I used this one Found here on Amazon .
  • I assume you have some experience with Arduino and the Arduino IDE. If not you can download the Arduino IDE - Found here. If you are not familiar with the Arduino IDE, instructions and tutorials can be found on the same web site.
  • Install the Fauxmo and ESP WIFI librarys - Adafruit has a nice tutorial on loading the libraries and some great ESP8266 devices found here.

Step 2: Set Up the ESP8266 With the Arduino IDE

Connect the ESP8266 to your computer with the appropriate USB cable. Bring up the Arduino IDE.

Under file/preferences add "http://arduino.esp8266.com/stable/package_esp8266com_index.json" in the Additional Boards Manager URLs: box. As shown in the 1st screen capture.

In the Arduino IDE, under "tools" select the board you are using. If you have a NodeMCU based board like mine, select NodeMCU as shown in the 2nd screen capture. Afterward your tools sub menu should look like the last screen capture.

Load this code to the ESP8266, and remember to change "your SSID" and "your Password" for your router.

/*****************************************************************************************
** ** ESP8266WiFi functions to connect Window Shades to Alexa ** code modified from Adafruit website code based on fauxmo library ** Setup registers the device and in ISR routine call back returns state change for the device. ** ***********************************************************************************************/

#include <Arduino.h> #include <ESP8266WiFi.h> #include "fauxmoESP.h"

#define WIFI_SSID "Your SSID" #define WIFI_PASS "Your Password" #define SERIAL_BAUDRATE 115200 /*************************************************************************** ** NOTE: D1 through D10 are ESP defines that map the ESP GPIO pins to the ** correct pin noted on the ESP8266. Use these defines to map to the correct number ** you see on the package. *************************************************************************************/ #define DOWN D1 #define UP D2

fauxmoESP fauxmo;

// ----------------------------------------------------------------------------- // Wifi // -----------------------------------------------------------------------------

void wifiSetup() {

// Set WIFI module to STA mode WiFi.mode(WIFI_STA);

// Connect Serial.printf("[WIFI] Connecting to %s ", WIFI_SSID); WiFi.begin(WIFI_SSID, WIFI_PASS); // Wait while (WiFi.status() != WL_CONNECTED) { Serial.print("."); delay(100); } Serial.println();

// Connected! Serial.printf("[WIFI] STATION Mode, SSID: %s, IP address: %s\n", WiFi.SSID().c_str(), WiFi.localIP().toString().c_str()); } struct State // Struct to keep current state of device { bool state = 0; const char *device_name; uint8_t device_id; } Curstate;

void callback(uint8_t device_id, const char * device_name, bool state) { if (state == Curstate.state) return; Curstate.device_name = device_name; Curstate.state= state; Curstate.device_id = device_id; }

void setup() { // Init serial port and clean garbage Serial.begin(SERIAL_BAUDRATE); Serial.println("Alexa/ESP demo sketch"); Serial.println("After connection, ask Alexa/Echo to 'turn on' or 'off'");

// Wifi wifiSetup();

// Add device fauxmo.addDevice("Shades"); // One or all blinds - work on multiple individual shades later Serial.println();

fauxmo.onMessage(callback);

pinMode(DOWN,OUTPUT); pinMode(UP,OUTPUT); digitalWrite(DOWN,HIGH); // Set UP and DOWN HIGH so the remote doesn't activate on start up digitalWrite(UP,HIGH);

}

void loop() { static bool state; fauxmo.handle(); if (state != Curstate.state) { state = Curstate.state; if (Curstate.state) { Serial.println("ON/DOWN"); digitalWrite(DOWN,LOW); delay(5000); digitalWrite(DOWN, HIGH); } else { Serial.println("OFF/UP"); digitalWrite(UP,LOW); delay(5000); digitalWrite(UP, HIGH); } } }

Step 3: Register Shades With the Alexa App

After your ESP8266 connects to your WIFI, go to the Alexa app and select "Smart Home".

Under "Your Devices" click on "Discover Devices". This should find your new device called "Shades". I used "Shades" instead of "Blinds" because Alexa seemed to occasionally confuse "blinds" with "lights".

Tell Alexa to "turn the shades off" and you should get "OFF/UP" on the Arduino serial monitor. "turn the shades on" should give you "ON/DOWN" on the serial monitor.

The ESP8266 is a little finicky and may take some time to connect. It's mostly reliable, but occasionally misses a command. Not sure if this is the ESP itself, or some of the libraries used.

Step 4: Program Your Somfy Remote

Check out these informational video's from Somfy on programming your duplicate remote:

This will allow you to copy and paste the programming from your current remote to a new duplicate remote.

Step 5: Connect ESP8266 to Somfy Remote

After programming the remote, open the case and pull the circuit board out. Remove the coin battery.

I've seen others connect the remote to the ESP8266 using relays, but if you power the remote from the 3.3v pin on the ESP8266 you can use the digital pins to simulate a button press by pulling the correct side of the button to ground.

Solder each connection as shown in the picture. 3.3v and ground from the ESP8266 to replace power from the coin battery and D1 and D2 to Down and Up respectively.

Be sure to set the correct channel for the blinds you want to control.

Step 6: Package in Project Box

Pick up a small project box like this one from Amazon. You may need to drill a small hole in one side and install USB power connector. Place the box within range of your blinds (mine seems to work at least 50 feet away).

If you try this instructable and have any issues, let me know and I'll update it. In the future I plan to update it with control for multiple individual blinds.

I changed my Alexa to respond the wake word "computer". I wanted to change the name of the shades to "Shields" so I could yell "Computer - Shields on!", but my wife didn't like it. Oh well.

Hope this helps.

Be the First to Share

    Recommendations

    • Pi Day Speed Challenge

      Pi Day Speed Challenge
    • Trash to Treasure Contest

      Trash to Treasure Contest
    • Microcontroller Contest

      Microcontroller Contest

    44 Comments

    0
    wakyta
    wakyta

    Reply 4 months ago

    hi, i'm trying to do this project but doesn't work for me too.
    now i'm trying to use the project you suggest but that doesn't work either.
    can you help me?

    0
    Bernd_G
    Bernd_G

    8 months ago

    Hello, really nice guide for this topic.
    I have the followin issue.
    When I connect the ESP output directly to the remote it only works sometimes.
    It looks like the remote is going into shutdown mode --> then it does not work.
    If I press a button(remote wakes up) then the control of alll buttons works fine via ESP as long as the remote is not in shutdown mode.
    Looks like the ESP pin cannot wake up the remote.
    Any idea about this topic ?
    Thanks

    0
    Jerryolsen
    Jerryolsen

    Reply 8 months ago

    I have not had that problem. Which remote are you using? Neither of mine have a sleep mode. Do you have a loose connection?

    1
    Bernd_G
    Bernd_G

    Reply 8 months ago

    I use a Somfy Telis1 as remote.
    Problem is solved by using a 2N3906 PNP transistor for each switch. Then everything is working fine (simulates the switch)
    On my remote there is really a power down mode. also the supply of all the peripherals is switched off via a transistor in the remote. I also could measure the supply on the switches which is droppjng down from 3.3V to ~2.8V if the remote is active. This does not happen if the out put of the ESP is directly connected to the switched side of the switch.
    Anyhow, thanks for this great tutorial, everything is now working perfectly in my openHab environment.
    One hint: I use Tasmota on ESP via MQTT from openHab
    --> almost the same configuration as jfvigand mentioned.
    Its is easy to use and you can configure even the inverted output which is needed if using a PNP transistor.
    Picture of the used remote (is about 12 years old)
    mybe the newer remotes do not have this issue.

    0
    renis.ganz
    renis.ganz

    Question 9 months ago

    Hi, congratulations for this guide. I followed everything and seems to works fine sw side. Howewer when I plus the somfy remote the esp8266 shutdown. Could be the power supply too ‘small’?
    Many thanks

    0
    Jerryolsen
    Jerryolsen

    Answer 9 months ago

    Thanks.
    I haven't had that problem. Have you tried a fresh battery? Maybe look for a short somewhare.

    0
    jfvigand
    jfvigand

    10 months ago

    Thank you so much for this tutorial and great idea. I made it by taking the same remote. I used a Wemos D1 with Tasmota as well as 2N3904 in order to control each of the 4 buttons (up, stop, down, channel) with +3v for activation so I dont have to initialize anything to +3. From HomeAssistant you can then create script to even change channels. Thank you for the guidelines !

    0
    benjamin.casas
    benjamin.casas

    Question 10 months ago

    Hi, very interesting post,
    I'm trying to do it, but I found some problems :-( May be you can help me!
    I think I'm having problems with the versions of libraries and the board. Please, could you tell us what version of FauxmoESP are you using? and ¿what version of ESP8266 board are you using?
    Thank you!

    0
    benjamin.casas
    benjamin.casas

    Reply 10 months ago

    Thank you Jerryolsen! I will have a look! ;-)

    0
    ltoledo320
    ltoledo320

    1 year ago

    Hi, Very nice post and instructable.
    I was wondering if you posted "an update for individually controlling multiple blinds". Would be nice!. Would you?

    0
    Jerryolsen
    Jerryolsen

    Reply 1 year ago

    I've updated the software to use the latest Fauxmo libs, but I found it easier to use a separate controller for more than one set of blinds.

    0
    Capi666
    Capi666

    Question 1 year ago

    Hi,

    Can I map the stop button of the controller to the pin D3 too for example? that is to say, can I use 3 pins instead 2?

    Thanks in advance,
    Regards,

    0
    hollanbl
    hollanbl

    Question 1 year ago on Introduction

    Hello again,

    In you writeup you indicate that you would post instructions for selecting other channels on the multichannel remote. Were you ever able to include that?

    0
    hollanbl
    hollanbl

    Question 1 year ago on Step 6

    Hello,
    It looks like you are not using the "MY"button of the somfy remote to move the blinds to a preset position. I guess you could use another output on the ESP8266 to control the MY button. Have you done this already?

    0
    MelanieB112
    MelanieB112

    Question 2 years ago

    Hi I have got a J4 IO Frequency 868 MHz Blinds and also an Sunea io ..could you build me a box to control them . I will pay you ofcourse to do all the work and materials. contact me via email josef.p at hotmail.co.uk Thank you Location Europe

    0
    Tich1
    Tich1

    Reply 3 years ago

    njreid - I'm having issues connecting the ESP8266 with Alexia (Echo Gen 2), would appreciate if you can share a copy of your configuration please.

    Thanks!