Introduction: Self-regulating Motorized Blinds

Does sunlight ever bother you when working with your computer next to the window of your room? Are you tired of having to raise and lower the blinds everytime this happens? Here is a smart solution to the problem: motorized auto-regulated blinds!

The aim of this project is to develop a system capable of adjusting both the height and tilt of the blinds allowing control over the amount of light in the environment.

Supplies

  • Stepper motor: 28byj-48
  • ULN2003 motor driver
  • Stepper motor: StepSyn103H5210-0440
  • A4988 motor driver
  • LDR (x4)
  • 1K resistor (x4)
  • Esp32 board
  • Protoboard
  • Blind, here is the amazon link
  • Wooden planks
  • Jumping wires
  • 3D printed parts
  • 5V, 12V power supply

Step 1: Light Reading

In order to define the incidence of the light, we will use 4 LDRs (Light Dependent Resistors), following the idea of a solar clock where based on the sun position, the small walls partially shade or stop shading the following resistor. We have printed a 3D part to do so (check the image above and the attached file). Connect the LDRs to the Esp32 in series with 1K resistor each. We have used the following pins:

  • LDR0: pin A1
  • LDR1: pin A2
  • LDR2: pin A3
  • LDR3: pin A5

The implemented functionalities of tilting, raising and lowering the blinds consist on providing the motor control part with a position value based on the sensor readings (check the attached codes). We will have five position states for rising and lowering the blinds (LOW, MEDIUM_LOW, MEDIUM, MEDIUM_HIGH, HIGH) and three for the tilting function (LOW_TILT, MEDIUM_TILT, HIGH_TILT).

Step 2: Motors Configuration

As a first step, we will program the motors' rotation using the Esp32.

For the tilting of the blinds we will use the 28byj-48. A stepper motor consists in a series of coils that we energize in order to rotate the motor shaft as shown in the first picture. These are what we call steps. The 28byj-48 motor has a stride angle of 5.625º. Due to the gear ratio of 64, 4096 steps are required to complete one revolution (half step configuration). Check the full code at the end of this section.

 for (int i = 0; i < vueltas * 512; i++)
  {
    if (dir == UP)
    {
      for (int k = 0; k < 8; k++)
      {
        digitalWrite(this->IN1, medio_paso[k][0]);
        digitalWrite(this->IN2, medio_paso[k][1]);
        digitalWrite(this->IN3, medio_paso[k][2]);
        digitalWrite(this->IN4, medio_paso[k][3]);
        delay(this->demora);
      }
    }
    if (dir == DOWN)
    {
      for (int k = 7; k >= 0; k--)
      {
        digitalWrite(this->IN1, medio_paso[k][0]);
        digitalWrite(this->IN2, medio_paso[k][1]);
        digitalWrite(this->IN3, medio_paso[k][2]);
        digitalWrite(this->IN4, medio_paso[k][3]);
        delay(this->demora);
      }
    }
  }

To raise and lower the blinds we will use the StepSyn motor and code it with the arduino library "StepperDriver".

Download the arduino library and open the example "BasicStepperDriver" as shown in the images above.

Wire the A4988 to the Esp32 and StepSyn as following:

  • MS3, MS2, MS1, VDD => 5V pin of the Esp32
  • DIR => pin 12 of the Esp32
  • STP => pin 13 of the Esp32
  • VMOT => extern 12V power supply
  • A1, A2, B1, B2 => StepSyn pins in this order
  • RST and SLP short-circuited.

Run the code and verify that the motor moves.

Step 3: RemoteXY Bluetooth App

In this section, we will create a small application that enables the user to control the blinds without needing to raise or lower them manually.

We have the following functionalities: OFF/ON to desactive or activate the bluetooth mode, Subir/Bajar to raise/lower the blinds and +/- to open or close the tilt.

Here is a helpful tutorial about how to make a bluetooth app with remoteXY

You can also go at remoteXY and do as shown in the pictures above:

  • Drag a switch and 4 buttons and configure them as you prefer.
  • Make sure to set the section "Configuration" as shown. You can change a item by cliking on it.
  • You can change the app name in the section "Bluetooth name"
  • Keep in mind that you can only have a maximun of 5 elements in the app for the free version.
  • To run your app clik on "Get source code" and follow the instructions.
  • Connect the Esp32 and run the code.
  • Download the app and connect with your app.


Step 4: Mounting

Make a window frame using the wooden planks. Use more wood to create a platform by the base of the window on which to fix the motors and the LDRs. Take care to place the StepSyn motor aligned with the blind rope to prevent it from getting stuck. The circuitry will be placed on the back of the frame.

To attach the blind rope to the StepSyn motor and the tilting stick to the 28byj-48 we will make two 3D parts as shown in the pictures above, the 3D files are also attached below. All that is left is to incorporate the blinds we bought and integrate our codes to have our blinds operating automatically (with both StepSyn and 28byj-48 working simultaneously based on the LDRs readings) as well as in Bluetooth mode.

With all the components in place, we can now test the prototype supplying the circuit with the corresponding voltage.

Step 5: Acknowledgment

This project has been carried out by students from the Escuela Técnica Superior de los Ingenieros de Telecomunicaciones (ETSIT) of the Universidad Politécnica de Madrid (UPM) as an assignment for the Electrónica de Consumo (ELCO) subject.