Remote controlled window blinds

I want to share with you my solution for remote controlled window blinds.

What it does:

  • control up to 4 blinds
  • open/close blinds separately
  • open/close all blinds at once
  • open blinds separately for one second (I use it to have strips on my day and night blinds)
  • one button to stop all blinds

What do you need:

  • arduino board (I used arduino nano)
  • end switches (2 switches for every blind)
  • 10k resistors (1 resistor for every switch)
  • IR receiver
  • LM 7806 voltage regulator

Of course you need servos with ability for continuous rotate.

See it in action: remote controlled window blinds

Arduino code:

#include <IRremote.h>
#define irPin 11          //IR receiver
IRrecv irrecv(irPin);
decode_results results;

const int led_pin = 13;

long tryb_nocny12 = 0;
long tryb_nocny1 = 0;
long tryb_nocny2 = 0;
long tryb_nocny3 = 0;
long tryb_nocny4 = 0;

int roleta1 = 0;
int roleta2 = 0;
int roleta3 = 0;
int roleta4 = 0;

const byte servo1_pin = 8;  //blind 1 servo
const byte servo2_pin = 9;  //blind 2 servo
const byte servo3_pin = 2;  //blind 3 servo
const byte servo4_pin = 3;  //blind 4 servo

int pin_end_1d = 4;    //blind 1 bottom switch (B1B)
int pin_end_1g = 5;    //blind 1 upper switch (B1U)
int pin_end_2d = 6;    //blind 2 bottom switch (B2B)
int pin_end_2g = 7;    //blind 2 upper switch (B2U)
int pin_end_3d = 10;   //blind 3 bottom switch (B3B)
int pin_end_3g = 12;   //blind 3 upper switch (B3U)
int pin_end_4d = 14;   //blind 4 bottom switch (B4B)
int pin_end_4g = 15;   //blind 4 upper switch (B4U)

int end_1d = 0;
int end_1g = 0;
int end_2d = 0;
int end_2g = 0;
int end_3d = 0;
int end_3g = 0;
int end_4d = 0;
int end_4g = 0;


void setup() {
  pinMode(pin_end_1d, INPUT);
  pinMode(pin_end_1g, INPUT);
  pinMode(pin_end_2d, INPUT);
  pinMode(pin_end_2g, INPUT);
  pinMode(pin_end_3d, INPUT);
  pinMode(pin_end_3g, INPUT);
  pinMode(pin_end_4d, INPUT);
  pinMode(pin_end_4g, INPUT);
  pinMode(servo1_pin,OUTPUT);
  pinMode(servo2_pin,OUTPUT);
  pinMode(servo3_pin,OUTPUT);
  pinMode(servo4_pin,OUTPUT);
  
  irrecv.enableIRIn();
  Serial.begin(9600);
}

void loop() {
  end_1d = digitalRead(pin_end_1d);
  end_1g = digitalRead(pin_end_1g);
  end_2d = digitalRead(pin_end_2d);
  end_2g = digitalRead(pin_end_2g);
  end_3d = digitalRead(pin_end_3d);
  end_3g = digitalRead(pin_end_3g);
  end_4d = digitalRead(pin_end_4d);
  end_4g = digitalRead(pin_end_4g);
  
  if (irrecv.decode(&results)) {
    Serial.println(results.value, HEX);
    Serial.println(' ');
    digitalWrite(led_pin, HIGH);
    switch (results.value) {
      case 0xFF38C7:  // raise blind 1 & 2
        roleta1 = 2500;   //2500 means turn servo right
        roleta2 = 500;    //500 means turn servo left
        break;
      case 0xFFD22D:  // close blind 1 & 2
        roleta1 = 500;
        roleta2 = 2500;
        break;
      case 0xFF0AF5:  //stop all blinds
        roleta1 = 0;
        roleta2 = 0;
        roleta3 = 0;
        roleta4 = 0;
        break;
      case 0xFF00FF:  //raise blind 1
        roleta1 = 2500;
        break;
      case 0xFF48B7:  //close blind 1
        roleta1 = 500;
        break;
      case 0xFF08F7:  //raise blind 2
        roleta2 = 500;
        break;
      case 0xFFB847:  //close blind 2
        roleta2 = 2500;
        break;
      case 0xFF50AF:  //raise blind 3
        roleta3 = 2500;
        break;
      case 0xFFE817:  //close blind 3
        roleta3 = 500;
        break;
      case 0xFF5AA5:  //raise blind 4
        roleta4 = 2500;
        break;
      case 0xFFA25D:  //close blind 4
        roleta4 = 500;
        break;
      case 0xFFB24D:  //close all blinds
        roleta1 = 500;
        roleta2 = 2500;
        roleta3 = 500;
        roleta4 = 500;
        break;
      case 0xFF728D:  //raise all blinds
        roleta1 = 2500;
        roleta2 = 500;
        roleta3 = 2500;
        roleta4 = 2500;
        break;
      case 0xFF10EF:  // raise blind 1 & 2 for 1 second
        roleta1 = 2500;
        roleta2 = 500;
        tryb_nocny12 = millis();
        break;
      case 0xFFB04F:  // raise blind 1 for 1 second
        roleta1 = 2500;
        tryb_nocny1 = millis();
        break;
      case 0xFF1AE5:  // raise blind 2 for 1 second
        roleta2 = 500;
        tryb_nocny2 = millis();
        break;
      case 0xFFE01F:  // raise blind 3 for 1 second
        roleta3 = 2500;
        tryb_nocny3 = millis();
        break;
      case 0xFF28D7:  // raise blind 4 for 1 second
        roleta4 = 2500;
        tryb_nocny4 = millis();
        break;
    }
    irrecv.resume();
  }


  if (end_1d == HIGH && roleta1 == 500) {
    roleta1 = 0;  
  }
  if (end_1g == HIGH && roleta1 == 2500) {
    roleta1 = 0;  
  }
  if (end_2d == HIGH && roleta2 == 2500) {
    roleta2 = 0;  
  }
  if (end_2g == HIGH && roleta2 == 500) {
    roleta2 = 0;  
  }
  if (end_3d == HIGH && roleta3 == 500) {
    roleta3 = 0;  
  }
  if (end_3g == HIGH && roleta3 == 2500) {
    roleta3 = 0;  
  }
  if (end_4d == HIGH && roleta4 == 500) {
    roleta4 = 0;  
  }
  if (end_4g == HIGH && roleta4 == 2500) {
    roleta4 = 0;  
  }
  
  if (tryb_nocny12 > 0) {
    if (millis() - tryb_nocny12 > 1000) {
      roleta1 = 0;
      roleta2 = 0;
      tryb_nocny12 = 0;
    }
  }
  if (tryb_nocny1 > 0) {
    if (millis() - tryb_nocny1 > 1000) {
      roleta1 = 0;
      tryb_nocny1 = 0;
    }
  }
  if (tryb_nocny2 > 0) {
    if (millis() - tryb_nocny2 > 1000) {
      roleta2 = 0;
      tryb_nocny2 = 0;
    }
  }
  if (tryb_nocny3 > 0) {
    if (millis() - tryb_nocny3 > 1000) {
      roleta3 = 0;
      tryb_nocny3 = 0;
    }
  }
  if (tryb_nocny4 > 0) {
    if (millis() - tryb_nocny4 > 1000) {
      roleta4 = 0;
      tryb_nocny4 = 0;
    }
  }
  
  
  
  if (roleta1 > 0) {
    digitalWrite(servo1_pin,HIGH);
    delayMicroseconds(roleta1);
  }
  digitalWrite(servo1_pin,LOW);
    
  if (roleta2 > 0) {
    digitalWrite(servo2_pin,HIGH);
    delayMicroseconds(roleta2);
  }
  digitalWrite(servo2_pin,LOW);

  if (roleta3 > 0) {
    digitalWrite(servo3_pin,HIGH);
    delayMicroseconds(roleta3);
  }
  digitalWrite(servo3_pin,LOW);
  
  if (roleta4 > 0) {
    digitalWrite(servo4_pin,HIGH);
    delayMicroseconds(roleta4);
  }
  digitalWrite(servo4_pin,LOW);
  
  
  delay(1);
  digitalWrite(led_pin, LOW);
}

Connections:

really nice project. Thank you for sharing

Thank you for your post. I was wondering if I can use this code with stepper motor. If I can't would you be able to help me figure out how to.
Lou

That code is for servo only. For now I don't have any stepper motor to make changes and check that it would be working.

Really good work here.
I am interested in doing something similar but with two Arduino Nanos talking ove nrf24l01s. One Nano will be in the window blind header controlling four blinds individually. The other Nano will be mounted in a wall box with a potentiometer so you can manually adjust how far open or closed the blinds go. The problem I have is I cannot write a bit of code. Completely new to it. If someone could point me to an example of something similar that I could try to learn from it will be much appreciated.
I've also had the thought to do away with the arduinos and run esp8266 solely. I think they could handle this simple task and this would afford me the ability to open/close the blinds with the potentiometer but also with sensors like temperature, lumens, time. Any thoughts and or help is appreciated.