Fyi @Mattias, I have everything working perfectly on my end, and am controlling my blinds via Homebridge! I am using https://github.com/zwerch/homebridge-blinds, a plugin I heavily contributed to.
In case you or others find it useful, I’ll share my set up, which was all purchased on Amazon. This isn’t exactly a super straightforward project, but I’m going to share some details and sample Arduino code based on how my set up is working.
Equipment:
- Rollease MTRF-DCIM-1C ~$25
- ELEGOO 4 Channel DC 5V relay (using normally open) ~$9
- Signcomplex 12V 1A Power Supply Transformer, 12VDC ~$9
- NodeMCU ESP-12E ~$9
MTRF-DCIM-1C wiring:
- Connect the 12V power supply to the +/- pins of the MTRF-DCIM-1C
- Using the existing remote, set to the desired channel, take off the battery cover, press P2 (wait for a jog/beep), press P2 (wait for jog/beep), and press the SET button. Note, the set button is on the side of the MTRF-DCIM-1C. If successful, you’ll hear some more beeps/jogs and the remote will be paired.
Arduino / Relay wiring:
-
Connect NodeMCU IN1, IN2, etc. pins (pins 6-8 in my case), along with VCC(to 3.3V) and GND to GND.
-
On the relay output, wire the N/O side of the relay to up, down, stop (etc.) on the MTRF-DCIM-1C. Note the numbering (X1, X2, etc.), which maps to IN1, 2, etc. I found that the N/O side is on the right side when you have the output terminals facing you.
-
Wire the middle relay output (the middle terminal) to Common
on the MTRF-DCIM-1C. Since I’m using 3 relays, I just connected 3 separate wires between Common
on the MTRF-DCIM-1C and the individual terminals.
Theoretically, you’re supposed to use a 5V power supply for this relay and my NodeMCU board is just 3.3V, but it seems very functional as is, I presume because it’s triggered by LOW and not HIGH.
I’m using 600ms for the transmission time, which seems more than sufficient and not sure it’s worth reducing. The documentation says >250 ms is required.
The latency is insanely low. I think 50-100 ms at most between the time I press the button on HomeKit and the time my blinds start moving.
#include <ESP8266WiFi.h>
#include <ESP8266WebServer.h>
// #include <ESP8266HTTPClient.h>
ESP8266WebServer server(80);
// WiFi
const char* WIFI_SSID = "YourWifiSSID";
const char* WIFI_PWD = "YourPW";
const int blindsUpPin = 12; // = pin 6 on NodeMCU
const int blindsDownPin = 13; // = pin 7 on NodeMCU
const int blindsStopPin = 15; // = pin 8 on NodeMCU
void blindsUp();
void blindsDown();
void blindsStop();
void handleNotFound();
void setup() {
Serial.begin(115200);
Serial.println();
Serial.println(F("Setting up GPIO pins for blinds"));
pinMode(blindsUpPin, OUTPUT); // up
digitalWrite(blindsUpPin, HIGH);
pinMode(blindsDownPin, OUTPUT); // down
digitalWrite(blindsDownPin, HIGH);
pinMode(blindsStopPin, OUTPUT); // stop
digitalWrite(blindsStopPin, HIGH);
WiFi.mode(WIFI_OFF); // Prevents reconnection issue (taking too long to connect)
delay(1000);
WiFi.mode(WIFI_STA); // This line hides the viewing of ESP as wifi hotspot
WiFi.begin(WIFI_SSID, WIFI_PWD);
while (WiFi.status() != WL_CONNECTED) {
delay(500);
}
Serial.println("");
Serial.print("Connected to ");
Serial.println(WIFI_SSID);
Serial.print("IP address: ");
Serial.println(WiFi.localIP());
server.on("/blinds/1/up", HTTP_POST, blindsUp); // note: you can change this to HTTP_GET (or another method) if you want
server.on("/blinds/1/down", HTTP_POST, blindsDown);
server.on("/blinds/1/stop", HTTP_POST, blindsStop);
server.begin();
Serial.println(F("HTTP server started"));
}
void loop() {
server.handleClient();
}
void blindsUp() {
server.send(200, "text/plain", "OK");
Serial.println(F("Sending command blinds up"));
digitalWrite(blindsUpPin, LOW);
delay(600);
digitalWrite(blindsUpPin, HIGH);
}
void blindsDown() {
server.send(200, "text/plain", "OK");
Serial.println(F("Sending command blinds down"));
digitalWrite(blindsDownPin, LOW);
delay(600);
digitalWrite(blindsDownPin, HIGH);
}
void blindsStop() {
server.send(200, "text/plain", "OK");
Serial.println(F("Sending command blinds stop"));
digitalWrite(blindsStopPin, LOW);
delay(600);
digitalWrite(blindsStopPin, HIGH);
}
void handleNotFound() {
server.send(404, "text/plain", "404: Not found");
}