-
Notifications
You must be signed in to change notification settings - Fork 41
Simple ESPSomfy RTS device
This wiki will go through how to create a simple ESPSomfy RTS device for a few dollars.
To get started you must create a radio device. This wiki contains full instructions on how to create one for about 12 bucks. You don't need a soldering iron or some advanced knowledge of software development to make this project work. All you need are some readily available parts and some Dupont connectors. However, I have also included some instructions on how to make a more polished radio enclosure for a few bucks.
Once you have your hardware built it is simply a matter of connecting the ESP32 to your network and a little bit of software configuration. Your shades will be talking in no time. The software guide in the wiki will walk you through pairing your shades, linking remotes, and configuring your shades, but for now let's build the hardware.
For this project you need three items. First you need an ESP32, next you need a CC1101 transceiver module, and finally you need some way to connect the two. Below is your bill of materials.
- 1 - ESP32 Module
- 1 - CC1101 Transceiver Module
- 8 - Dupont female/female connectors
The first thing you will need to do when choosing an ESP32 module is choose whether you want to connect to it via an ethernet cable or over wifi. The only things you need to ensure is that the board has at least 4Mb of flash and at least 5 pins that can be used as input or output and one pin that can be input only.
So long as you get a board with a minimum of 4Mb of flash, you can upload the binaries included in the releases whether it is wifi only or ethernet capable. If you buy one of these you can simply download the firmware and upload it to the ESP32 each time I release a software update. There is a handy uploader that is included with the firmware that will allow you to perform a remote firmware update without ever touching the module.
Most any wireless ESP32 will suffice to install ESPSomfy RTS if they meet the specs mentioned above.
ESPSofmy RTS starting in version 1.3.x has support for wired ethernet ESP32 boards. For my production device I chose wifi and an ESP32 Wroom but I have hooked up a WT32-ETH01 to try it out and it works fine. Bear in mind that most of these boards have quirks to get them initially programmed. Most of them do not have a serial USB port on them and they share pins that you will likely use for your transceiver. So when initially programming you may find yourself disconnecting the transceiver to get the serial port to work. I have built in support for the most common boards but there are custom settings so you may add your own based upon the board specs.
Supported Ethernet Boards:
- WT32-ETH01
- Olimex ESP32-POE
- Olimex ESP32-EVB
- LILYGO T-Internet POE
- wESP32 (all versions)
IMPORTANT: Always verify the settings for the board are correct. While I have pulled the information for the board settings from currently available information, manufacturers can change the spec sheets so incorrect Ethernet settings can actually destroy and ESP32.
Originally, I bought a cc1101 transceiver with a spring type antenna and could not figure out why it would not consistently receive commands from my remotes. I then went about purchasing several other transceiver modules thinking that all my code is always perfect, so the hardware must be defective.
This hard-headedness led me to the conclusion that the timing algorithm I created to read the radio signal was not quite ready. Since I ordered every type of CC1101 transceiver I could get my hands on, I can report that every one of the CC1101 transceivers I bought work. I must have had an extra thumb or two when I built the original timing algorithm. This made it drop part of the hardware sync and subsequently not communicate reliably.
So, when looking for a CC1101 Transceiver get one that doesn't have to be slow-boated from some far off land although I assume they all begin life there anyway. However, now that I have had time using these boards, the D-SUN boards do not seem to receive as well as the E07-M1101D transceivers. Of the three I bought one failed, one was spotty on receive, and the last on had an abysmal range of less than 15 feet.
For the final 3 production prototypes that I built I preferred the E07-M1101D-SMA version over all the others. While you will have a hard time finding it listed that way it is the blue one with the duck antenna or spring antenna. Below is a picture so you might be able to identify this bird in the wild.
The range of the transceiver for both receive and transmit is very good. However, if you need extended range you may want to look at changing the little 2 inch duck antenna that comes with your transceiver. Initially, I expected to install my ESPSomfy RTS device in a server rack located at the far reaches of my home. The obstacles between this location and the first motor are daunting. This includes two six inch exterior stucco walls, 1.75 inches of travertine and a solid hardwood ceiling. While I could get ESPSomfy RTS to transmit through this kryptonite the remote was simply not strong enough to notify ESPSomfy RTS of button presses.
So I bought what was advertised as a 433Mhz full wave antenna. For reference it was a 433Mhz antenna for a Mighty Mule gate opener. Although I do not have a spectrum analyzer I can assure you this antenna was not tuned to 433Mhz. It effectively killed the transmit range of the ESPSomfy device. You also needed to be within a few feet to get any response from the remote. So I sucked it up and installed the ESPSomfy RTS device in my office eliminating one of the stucco walls. Still, I was amazed at how far the range was with the 2 inch duck antenna. Despite its diminutive size the range was incredible. Happily the device never missed a command from my office for months.
I had been going on happily sharing my office with this rather unassuming black box tucked into the corner of the room, then another user purchased a transceiver without an antenna. After a bit of back and forth they bought a 3dbi antenna from Amazon and posted the link. Intrigued by this seemingly simple device I decided that I would buy one to troubleshoot the issue they were having with their transceiver. After all the blue-gray truck would arrive the next morning and this magical device was less than 6 bucks.
The truck showed up and I ripped open the package thinking it couldn't be much better than the mighty 2 inch duck antenna. After I unscrewed the 2 inch antenna from its perch, I promptly screwed the 4 inch antenna in its place. I then hit a button on my remote watching the RSSI in the logs. The first button press was -31dBm from the antenna. The one prior to that was -56dBm with the old antenna and I never got a signal better than -47dBm. I thought, that was a fluke so I pressed the button again. This time it came back with -27dBm.
With the new antenna I was able to move that little black box into the server rack with all of its friends. It averages in the -65dBm range and never misses a beat from this location. This thing is now a stud and I am thinking of getting a blue leotard and cape for it. Here is a link to the antenna but I am sure there are even more examples out there.
https://www.amazon.com/dp/B072Q7319V?psc=1&ref=ppx_yo2ov_dt_b_product_details
Your first step is to connect your transceiver to your ESP32. I did this with the use of some female to female dupont connectors and ran it on the bench for a while. I didn't even use a breadboard to connect it. I simply connected each end of a 10cm dupont cable to make each of the 8 connections. If you can assemble furniture from a box you are more than qualified for this task.
If you bought one of the 10-pin transceivers, search the interweb for the wiring diagram. You will see that it is an 8 pin version but it has 2 VCC and 2 GND pins. You can use either set.
The hardest part of the inital connection is determining which pins are which on the transceiver. Sadly, many of the available modules only label the pins with a number. As it turns out the mapping goes like this if you bought one of these boards.
NOTE: The pinout for the ESP32 will be different if you chose an ethernet model. The GPIO pins below will not be available on your board. The ethernet PHY steals many if these. However, you can simply read through the datasheet and choose from the list of available pins. So you do not have to disconnect your radio to use the serial port though you should not choose GPIO0 or GPIO2 for any of the radio pins. As an aside start with one of the input only GPIOs for the RX. These are typically GPIO32+.
The pin settings below are only suggestions for specific models of the ESP32. ESPSomfy RTS will also allow you to share the same pin for RX and TX. Internally within the software, the transceiver will be switched to read or write to the assigned pin depending on whether it is assigned as RX or TX. To share the RX/TX pin connect only GDO0 then assign both the RX and TX pins in the transceiver settings to this pin. ESP Somfy RTS will manage the input and output state for this pin when receiving or transmitting. This configuration will work for any of the boards below.
If you are going to connect ESPSomfy RTS with wifi. These devices are plentiful, inexpensive, and reliable. They are also more user friendly in that they do not require any external USB interfaces to program them.
Pin | Description | ESP Pin |
---|---|---|
1 | GND | GND |
2 | VCC | 3v3 |
3 | GDO0 - This is the TX Pin | GPIO 13 |
4 | CSN | GPIO 5 |
5 | SCK | GPIO 18 |
6 | MOSI | GPIO 23 |
7 | MISO | GPIO 19 |
8 | GDO2 - This is the RX pin | GPIO 12 |
This pin reference is for the E07-M1101D. If you have another transceiver the pins should match the function in the second column.
This is how I mapped mine using the V-SPI interface of the ESP32 and two innocuous pins for RX/TX. Initially I used the onboard LED pin for RX to see when data was being sent but I think that was causing interference. If you just want this to work use the pin mapping above. The other boards are much better labeled so match up the descriptions to the pin header and you will be golden.
If you must change the pin assignments then feel free to do so. You can assign them to anything you like since the software configuration will allow you to change these when you set up the radio. But beware I spent a whole lot of time reading about ESP32 pins only to realize that I got interference every time I touched the board. For cryin out loud I picked a touch pin for GDO0 initially.
Here is a picture for those of you who need to see it to believe it.
This is a wired ethernet model that allows you to connect via a wired ethernet cable or wifi. However, there are many fewer pins available to connect the transceiver. Below are the suggested pins.
Pin | Description | ESP Pin |
---|---|---|
1 | GND | GND |
2 | VCC | 3v3 |
3 | GDO0 - This is the TX Pin | GPIO 02 |
4 | CSN | GPIO 12 |
5 | SCK | GPIO 14 |
6 | MOSI | GPIO 15 |
7 | MISO | GPIO 04 |
8 | GDO2 - This is the RX pin | GPIO 35 |
This pin reference is for the E07-M1101D. If you have another transceiver the pins should match the function in the second column.
GPIO 02 may need to be disconnected during initial firmware load or the firmware load will fail. After that you can use the OTA upload features for loading firmware onto ESPSomfy RTS from any connected device.
This little board uses power over ethernet so you can run one cable to the device without any additional power requirements. There are more available pins on this device so you have a few more choices than the WT32-ETH01 boards. However, here is a suggestion for the configuration. All of the pins below are on the UEXT connector so if your build a connector then you can simply connect it between the transceiver and the connector header. There will be no need for a breadboard. Kinda dumb that there are no mounting holes though.
Pin | Description | ESP Pin |
---|---|---|
1 | GND | GND |
2 | VCC | 3v3 |
3 | GDO0 - This is the TX Pin | GPIO 04 |
4 | CSN | GPIO 13 |
5 | SCK | GPIO 14 |
6 | MOSI | GPIO 15 |
7 | MISO | GPIO 16 |
8 | GDO2 - This is the RX pin | GPIO 36 |
This pin reference is for the E07-M1101D. If you have another transceiver the pins should match the function in the second column.
So where do these names come from. Anyway, this is another PoE card. You will need the programmer card to load the initial firmware but after that it can sit in a drawer so years from now you pick it up and think... "what is this to?". You know like that key to something you don't know what it belongs to. Again there are not many pins available but there are just enough to get the transceiver hooked up.
Special thanks to Oliver for the graphic
Pin | Description | ESP Pin |
---|---|---|
1 | GND | GND |
2 | VCC | 3v3 |
3 | GDO0 - This is the TX Pin | GPIO 35 |
4 | CSN | GPIO 12 |
5 | SCK | GPIO 14 |
6 | MOSI | GPIO 15 |
7 | MISO | GPIO 16 |
8 | GDO2 - This is the RX pin | GPIO 04 |
This pin reference is for the E07-M1101D. If you have another transceiver the pins should match the function in the second column.
This is an interesting little board in that it it seems to have quite a few more pins available. It also has a cool logo of a paper wasp that has no function whatsoever but it is well done. Like some of the other options, you need to buy the serial converter to load the initial firmware and toss it in the drawer.
Pin | Description | ESP Pin |
---|---|---|
1 | GND | GND |
2 | VCC | 3v3 |
3 | GDO0 - This is the TX Pin | GPIO 33 |
4 | CSN | GPIO 05 |
5 | SCK | GPIO 18 |
6 | MOSI | GPIO 13 |
7 | MISO | GPIO 32 |
8 | GDO2 - This is the RX pin | GPIO 39 |
This pin reference is for the E07-M1101D. If you have another transceiver the pins should match the function in the second column.
Some enterprising folks have created really cool cases for your project. Here are a couple from @011V32.
If you are like me and cannot bear to have something that looks all cobbled up when you want to show it off you can create a more polished version using a breadboard, a couple of headers, and some kynar wire soldered to the back of the board. Below is a picture of the finished project. I built 3 of these out of all the radios that I bought.
I took a 5cm x 7cm double sided PCB breadboard that I had laying around and soldered 3 headers to it. One 2x4 pin header for the transceiver and two single row headers that match the number of pins for the ESP32. I cut these from longer headers using my bandsaw but you could use a Dremel or even a hacksaw to get the job done. TIP: cut the header on the next pin that you are not going to use so that it doesn't destroy the last pin.
Next I used some kynar 30awg solid wrapping wire to connect the pins from the ESP32 header to the pins of the transceiver header. Pay attention to the wiring as this will be backwards on the back of the board.
Finally I fit the PCB into an ABS enclosure I bought off Amazon. These came in a 5 pack and measure 3.5" x 2.8" x 1.1". They fit perfectly and didn't need any mechanical supports to keep the PCB in place. I later swapped out the transceiver in the picture for one with a duck antenna.