Updated Simple ESPSomfy RTS device (markdown)

rstrouse 2023-01-22 11:49:56 -08:00
parent cec08ee94e
commit 1a236eddc8

@ -1 +1,71 @@
This wiki will go through how to create a simple ESPSomfy RTS device for a few dollars.
This wiki will go through how to create a simple ESPSomfy RTS device for a few dollars.
# Getting Started
To get started you must create a radio device. There wiki contains full instructions on how to get this up and running. You don't need a soldering iron to make this project work. Dupont connections between the radio and the ESP32 will suffice. However, I have also included some instructions on how to make an inconspicuous 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 begin pariing your shades. The software guide in the wiki will walk you through pairing your shades, linking remotes, and configuring your shades.
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. 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 any of the CC1101 transceivers work very well. I must have had an extra thumb or two when I built the orginal timing since it was dropping part of the hardware sync. In the end, all of the cheap cc1101 transceivers I bought had a range over 300 feet and through a couple of walls. I finally just stopped walking.
Your first step is to connect your transceiver to your ESP32. I did this with the use of some female to female dupont connectors for now but will be coming up with a cleaner setup and project enclosure. Next you will want to install the firmware on your ESP32 and configure the radio to match your hardware connections.
### Required Hardware
* 1 - ESP32 Module
* 1 - CC1101 Transceiver Module
* 8 - Dupont female/female connectors
### Assembling the Hardware
You will need an ESP32 module. I used an ESP32S-WROOM-32 development board for my project. The included binary is compiled using this board. You will also need a CC1101 transceiver module. Like I explained earlier I bought several of these and they all work great. I have the blue ones with 10 pins, green ones with 8 pins, and even blue ones with 8 pins. The 10 pin versions simply have the VCC and ground pins duplicated.
The reason I have so many isn't so I could give you advice on every model on the market, it was because I wrote a crappy algorithm originally that I thought was perfect. They all apear to perform about the same so get a transceiver module with good availabilty from a supplier that can get it to you before your patience wears out.
The hardest part of the inital connection is determining which pins are which on the transceiver. Sadly the first module (green 8-pin) I bought only had the pins labeled with a number. As it turns out the mapping goes like this if you bought one of these boards.
| Pin | Description | ESP Pin |
| --- | ----------- | ------- |
| 1 | GND | GND |
| 2 | VCC | 3v3 |
| 3 | GDO0 - This is the RX Pin | GPIO 13 |
| 4 | CSN | GPIO 5 |
| 5 | SCK | GPIO 18 |
| 6 | MOSI | GPIO 23 |
| 7 | MISO | GPIO 19 |
| 8 | GDO2 - This is the TX pin | GPIO 12 |
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.
Here is a picture for those of you who need to see it to believe it.
![image](https://user-images.githubusercontent.com/47839015/213935879-08ba55e9-ebe9-4b53-be12-baccf310eeb4.png)
# More Polished Version
If you are like me and cannot bear to have something that looks all cobble 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.
![image](https://user-images.githubusercontent.com/47839015/213936340-6877b4d9-280c-4da8-9538-e12287943368.png)
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.
![image](https://user-images.githubusercontent.com/47839015/213936595-969562c8-11b4-487a-966a-39bbb9eecbc1.png)
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.
![image](https://user-images.githubusercontent.com/47839015/213936685-043364d8-da7e-4602-b09f-b7544d340768.png)
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.
![image](https://user-images.githubusercontent.com/47839015/213937016-eac56e48-f9b8-499c-a6af-a8b7ecda9cbc.png)