Motor on a roller blind - ESPHome version?

Were you able to solve this problkem? Can you share your yaml configuration.

This is my set up. Not roller blinds, but some ideas may help. I built this in the first few weeks when the pandemic hit. Its been working since on the upstairs and downstairs blinds. Im about to upgrade it again as there’s things im not happy about. For example I want to use ESPHome/ node red, at the minute im using blynk and node red. Also feel I can maybe cut down on some parts and wires by using a Esp32 rather than a Esp8266 and servo controller, though not sure if thats advisable?

The way its set up, I have a small power transformer that runs at 5v and 5a which powers the 5 seperate servos. All micro servos (sg90). This takes up one plug. A usb plug runs the esp8266 which is connected to a PCA9685 (servo controller.) The transformer is pluged into this.

From here I run a 8 core wire, a seperate wire goes into each servo and a shared live and nutural. The Servos are fixed into the blind and are connected directly to the metal rod via servo coupler, then tied in place with cable ties and belive it or not, LEGO. (this isnt very elegant and I know i can improve this now i have a 3d printer. Im sure it will be hard work on the servos an have some better ideas for this, but at the time, these servos were so cheap i didnt care.

I signed up to a free account with Blynk to operate them, this was a decision earlier on as i found good docuemntation to get it working and to sync it up with google home. the servos are continuios rotation servos as i found it tricky with degree rotation ones. In the code of the Esp if i remember right i use a signal of 100 to turn the servos one way, then 250 for the other. To stop them running was the trickiest part especially when i had no clue with code or electronics at the time. but it was a simple signal of 4095 to detach the servos. Which I know Esphome can do.

Most of these are all put into Home assistant with Node Red with http resuest nodes. All the blinds do work together, but the downstairs ones struggled even though the set up was mostly the same. Must have been the transformer. So I programmed them to quickly open and detach one after the other. Also because they were continuious servos and cheap, all opened slightly different degrees. To get around that in node red i manually changed the length detach would be sent. All work fine.

As a safety messure, as i didnt want to leave the transformer on all the time (it gave a very quite high pitched hum, barely noticable but it annoyed me) I attached a wifi switch to auto turn on and off when i press open or close on the blinds in home assistant. There’s definitly things that need fixing and improving and probably more that im doing wrong. If so please feel free to point it out.

Trying parts of your code. Are you able to manually select the slider and set the position? Does that actuate?

Hey, here is the snippet for setting the position:

    position_action:
      - globals.set:
          id: temp_position
          value: !lambda 'return float(float(id(open_position)) * pos);'
      - stepper.set_speed:
          id: blind_stepper
          speed: !lambda |-
            if (id(temp_position) >= id(blind_stepper).current_position) {
              return 400;
            } else {
              return 800;
            }
      - stepper.set_target:
          id: blind_stepper
          target: !lambda |-
            if (id(temp_position) >= id(blind_stepper).current_position) {
              return id(temp_position) + id(open_position_offset);
            } else {
              return id(temp_position);
            }
      - while:
          condition:
            lambda: |-
              return id(blind_stepper).current_position != id(temp_position) && id(blind_stepper).current_position != (id(temp_position) + id(open_position_offset));
          then:
            - cover.template.publish:
                id: kitchen_blind
                current_operation: !lambda |-
                    if(id(temp_position) >= id(blind_stepper).current_position) {
                      return COVER_OPERATION_OPENING;
                    } else {
                      return COVER_OPERATION_CLOSING;
                    }
                position: !lambda 'return (float(float(id(blind_stepper).current_position) / float(id(open_position))));'
            - delay: 1000 ms
      - cover.template.publish:
          id: kitchen_blind
          current_operation: IDLE
          position: !lambda 'return (float(float(id(blind_stepper).current_position) / float(id(open_position))));'
      - stepper.report_position:
          id: blind_stepper
          position: !lambda "return id(temp_position);"
      - stepper.set_target:
          id: blind_stepper
          target: !lambda "return id(temp_position);"
      - globals.set:
          id: current_position
          value: !lambda "return id(temp_position);"
      - output.turn_on: builtin_led
    has_position: true

It also includes the part to lower the blind with a faster speed, and open it with a slower speed.

Where should this snippet be located? I have asked my question more specific here:

I can’t get it to work “that” way (to control the slider form within homeassistant)

Not sure if I’m understanding what you ask for, but this works with a slider as long as you have continous mode enabled it also updates in realtime.

1 Like

It is the code for the position_action. The initial code contains the open_action, close_action and stop_action. Just put it there after those actions.

Thanks, missing some info for below esphome:

Hi, l like your dual motor setup and would like to try it out. Could you post a link to these stl files.
Thanks Brad

Were you able to get the DRV8825 to work? I’m trying to get this driver working using the a4988 platform thinking they are similar. But I can’t get the stepper motor working. If you got the DRV working, can you tell me how did you wire yours and what script did you use to get it working?

Thanks.

Where to get such a beautiful stl?

I’ve been working on this for a while and today finally installed it. The challenge is that the blind is very heavy, blackout type, 2.8 m wide and 1.2 m vertically.
No choice but to use a NEMA 17 for torque. The issue is that, as we know, these motor spin freely when the coils aren’t powered. I didn’t want to use the original brake so came up with own, over engineered solution. It’s a 3 part assembly, consisting of a base plate, a motor mount and in between, a height adjustable plate. I used the code from @RoadkillUK and adapted it for the A4988 platform (trivial to do). I’m using a TCM2208 driver for silent operation.
The system was designed around aluminium pulleys and a belt used in 3D printers and therefore readily available. I’m using a bunch of m3 bolts and one M5 to help with rigidity of the middle plate so that I can tension the belt and it provides the adjustable friction to overcome gravity when the motor is idle. I spent way too much time on this as I learned fusion 360 on this project.


That almost worked. I had to remove the weight bar at the bottom of the blind, and even then I can’t pull it all the way to the bottom due to either the motor skipping steps or the belt skipping. Back tot he drawing board for now…

I am new to esp and HA.

my plan is to use a NEMA 17, D1 mini and A4988.

So i wonder if any can be kind and share ther code, as easy as
possible to esp? i am still trying to get it all wired up.

i need 2 things to start withe.

  1. sett a stop rmp
  2. sett speed

BONUS if some one have a code for sett timer on it.

Best Regard Daniel

can I use Nema 17 motors connected directly to the roller shade’s tube? without power, would the nema17 slip, auto releasing the shade? how come all the STL files on thingiverse have gears in them? i am really curious why i cant use the motor to drive directly. please help

hello, I have made a prototype using another board, and now I got different a4988 shield boards. Don’t know how to use it.
Iam using esp8266, 28byj-48 12v step motors, esphome code which needs only 3 pins - ST,DIR and EN.

which pin-row (S,V,G) should I use for STEP, EN, DIR pins?

I would to use a4988 driver which is putted into that stepper driver shield but I have connected it to yellow-row ( marked as “S” ) and that doesn’t worked.

regards

Hope that Ive found the meaning of S,V,G rows

S is for signal and pins are not connected together
V is for VCC and all 3 pins are connected
G is for GND and all 3 pins are connected

this guy is using a big DC motor and counted the time, not steps, to keep track of positions. anyone else doing the same thing? his mount is 3d printed for the side of the window as seen in the purple part. has anyone use the same setup but mount onto the red side as seen here?

You could stop/lock the gear with a solenoid the motor stops.

Like these: Dc12v24v Solenoid Magnetic Solenoid Push-pull Solenoid Ly-1264 Long Stroke 30mm Open Frame Electromagnet - Electromagnet - AliExpress
The youtube video: DIY Motorized roller blind - YouTube

1 Like

Hey all!

My shade is 60 inches long. What is the current recommendation?

Thanks!

I have a problem with this ESPhome cover.
Installed the code from:

My cover is working when i visit the ESPhome webpage, and i can control my stepper motor.

In home assistant the ESPhome is autodiscovered, but all the entities are switched off.
It says: Switched off by configuration item. I can’t enable the entities.

I tried removing the API key in the .common_blind config, since all my other ESPhome devices are working without API key. Without succes.

Someone know how i can fix this or what i did wrong ?