Motor on a roller blind - ESPHome version?

I do not see any problems with that :joy:

2 Likes

That’s odd, I have some 90cm ones working fine and a 60cm one that rolls out fully to 180cm long. All work well. One thing I did note was that the speed makes a difference to the torque too. However, I can run the 60cm wide 180cm long with 700 steps/s just fine. Range is around 200 to 1000.
In theory you should be able to switch to a Nema stepper (Nema 8 to Nema 42) using the a4988 driver which should give you what you need. When I looked Nema 14 looked the best sort of size - however check the torque rating before buying.
Rik

How DO you have your motor connected to the blinds then? This thread is about the pgote implementation on thingiverse.

Wasn’t aware that the steps could be increased beyond 250. I thought this would cause it to inacurately step, so I’ve always kept it at that. Although the slower it steps the longer its on and I suppose the hotter it will get.

I have got my stepper motor directly connected into the end of the blind. I’m using the orignal blind bracket, but I’ve drilled through the bracket and the motor spindle fits into the end of the blind roller, I will take a picture at the next opportunuity. If I had a 3D printer I would obviously print off the parts and have a geared system, but for now I’m trying to do a 3D printerless approach. I’ve ordered a more powerful NEMA stepper motor, hopefully I’ll be able to get this to work! Will report back.

1 Like

I was also surprised about the speed - I though I would just see how far it went - it started causing issues at 1100. However, I clocked it back to 700 to give more torque and to avoid any potential skips.
My blinds are motor directly on the blind too (still using 3D parts though, but no external gears) -see picture. Hopefully the Nema motors work for you buddy.

1 Like

The pgote thingiverse device has a 2:1 gearing ratio (as best I can count from the pics) so you’ll need to provide twice the torque of his motor to achieve the same result.

Apparently you can convert the 48BYJ-28 quite easily to a bipolar stepper.
If you use a double H-bridge driver like an A4988 or TB6600 this should give you ~2.5x the torque, however you will not be able to drive it with the ULN2003.

1 Like

Thanks all for the replies.

@RikW That’s a very tidy set up! Nice work.
@nickrout yes good point, I’ve got a couple of Nema motors to try out: STEPPERONLINE Nema 17 Stepper Motor 59Ncm and UsongShine Nema 42Ncm
@Snedig thanks for pointing that out, I’ve also just converted one of my 48BYJ-28 to test alongside the Nemas. As it would be nice to get such a compact motor working. The Nemas are more expensive and bigger!

Having said all this I bought a pack of 5 A4988 driver boards yesterday and hooked them up but no luck! Nothing happens when I try to control them from HA. I’ve updated my config for the A4988 so now looks like this:

esphome:
  name: shaggy
  platform: ESP32
  board: nodemcu-32s

wifi:
  ssid: "ssid"
  password: "password"

# Enable logging
logger:

# Enable Home Assistant API
api:
  services:
    - service: control_stepper
      variables:
        target: int
      then:
        - stepper.set_target:
            id: my_stepper
            target: !lambda 'return target;'

ota:

web_server:
  port: 80 

cover:
  - platform: template
    name: "stepper"
    id: window_1_1

    open_action:
      - stepper.set_target:
          id: my_stepper
          target: 12000

    close_action:
      - stepper.set_target:
          id: my_stepper
          target: -100

    stop_action:
      - stepper.set_target:
          id: my_stepper
          target: !lambda return id(my_stepper).current_position;      

    optimistic: true  

stepper:
  - platform: a4988
    id: my_stepper
    step_pin: GPIO25
    dir_pin: GPIO27
    max_speed: 250 steps/s

    # Optional:
    sleep_pin: GPIO26
    acceleration: inf
    deceleration: inf

I assume there is nothing else to change in the config when switching to a A4988?
This was all working as expected with the ULN2003 previously.

I’ll be checking i’ve got all the connections right today once I got my multimeter back. Have also ordered replacement A4988 boards incase I got a duff batch.

Thanks!

UPDATE: Got this working by connecting the Reset Pin to the Sleep pin on the A4988. Not sure the significance of that but it works!

3 Likes

So after getting all three motors to work with the A4988 here are the results:

None of the motors were powerful enough to drive the blind with the spring left inside the roller. I’m referring to the spring inside the blind roller which when used with a pull cord stops the blind from unravelling (due to gravity) when it is at the top.

STEPPERONLINE Nema 17 Stepper Motor 59Ncm:
Was able to roll up the blind extremely quickly 3-4 seconds to go from fully open to fully closed across a drop of about 180cm. However when not powered the motor did not have enough torque to hold the blinds up, so the blind just free falled back to the bottom - quite funny the first time this happened!

UsongShine Nema 17 42Ncm
Same result as the STEPPERONLINE above

48BYJ-28
After converting this to a bi-polar stepper motor it does have considerably more torque and is able to easily get the blind up - no slipping like before- I’m currently testing it (when driven by A4988) at 900 steps/s. Planning to run this for a week or so and see how it goes. The only issue I’m having with it is that its a little noisy, so may try drop it to 9v and see if it still has enough stepping torque.

I’d definitely recommend converting your 48BYJ-28 to a bi-polor motor, it’s a lot more powerful!

I think for now I’ll live with the noise, but if I do make make any changes will post back here.
Thanks for all the help - Really appreciate it!

4 Likes

Thank you very much!

Just fiddling around with this and tried to use some standard 28BYJ-48 motors to control some of my blinds.

It works but since the blinds have a build-in planetary gearbox I would need something faster & more powerfull, Therefore I just ordered some NEMA 17’s.

When I setup a stepper like this it shows up as a cover in my home assistant setup however I dont have a slider to set it to a certain position (in the states UI).
does anyone has this working? in states or lovelace (a slider based on integer input or something?)

Thanks for all the help!

1 Like

@petermcandrew I didn’t realise you had the spring in place - I should have thought of that!
Definitely the reason it wasn’t strong enough.
You may find the 48BYJ-28 would have worked unmodified without the spring :slight_smile:
Good to hear you have something working.
Rik

@BjornH I have also been looking into this - I think I have the answer, but not had time to test.
I think rather than OPEN, and CLOSE - you would need 0 and 100 as percentages for the slider to be active. If you figure it out, let me know and I will do the same if I get anywhere :slight_smile:
Rik

1 Like

I have also been tinkering and got a physical momentary switch working.
If blind is up, a press will send blind down. If blind is down, a press will send blind up.
If the blind is moving, a press will stop the blind no matter if its going up or down.
Code below - momentary switch connected to 3v3 and D8 - cover id = test_blind

binary_sensor:
  - platform: gpio
    pin: D8
    name: "Button"
    filters:
    on_press:
      then:
        - lambda: |
            if (id(test_blind).position == COVER_OPEN) {
              if (id(my_stepper).current_position >0){
                // shade is opening
                id(test_blind).stop();
              } else {
                // shade is fully open
                id(test_blind).close();
              }
            } else {
              if (id(my_stepper).current_position <5000){
                // shade is closing
                id(test_blind).stop();
              } else {
                // shade is fully closed
                id(test_blind).open();
              }
            }

Rik :wink:

5 Likes

My plan was exactly what I posted earlier, to also convert my 28BYJ-48 to bipolar, however I’ve been waiting for my A4988 driver boards for nearly 10 weeks now… :confused:

What I hadn’t thought of was that spring… :stuck_out_tongue:

Removed my spring, and my rollerblind is now working perfectly - thanks!

3 Likes

@RikW I had removed the spring before I converted the 28BYJ-48 and it still wasn’t powerful enough :frowning: , the only reason I added it back in was for the NEMA 17’s as they didn’t have enough holding torque. I think if I had a way to regulate the friction applied by the spring I could get it to work, but in the blinds I have they are just too stiff.

2 Likes

I run my 28BYJ-48 on 12V, it gets a little hot, but runs the curtain without a spring fine in full step mode with speed 800.

I solved the heat issue by mounting an aluminium heat shield behind the motor and of course sleep_when_done.

1 Like

I’ve also discovered that there are two versions of the 28BYJ-48: 12V and 5V so going to replace my 5V version and see what impact that has.

1 Like

I’m running 12V on the 5V version, it will heat up more, but as I run it rarely and it has a heat shield it doesn’t seem to be a problem.

1 Like

“regulating” the springs can actually be done relatively easily :slight_smile:

I tried various option which all worked for me.

  • initially there where 2 springs inside one of my blinds, I removed one and left the other inside.(easiest solution)

  • “bending” the spring back in the opposite direction (I used a vice-grip and some pliers to put it in the vicegrip) there I let it sit for over a few days.

  • cutting one of the windings off (so instead of 6 windings creating friction youll only have 5), hereby it is adviced to bend the last past of the winding just cut to prevent increased friction of the spring due to scratching…

Hope this helps you!

Thanks for the reply and the Ideas.

I have been checking the docs and found that there is an option to set a duration for the “endstop cover” (in this case the "cover Template"is used).

Beside that I havent found a way to define a position of the cover in the docs.

However what I came across at the stepper component docs seems to be a possible workaround. (https://esphome.io/components/stepper/index.html?highlight=stepper)

  1. adding an input number (slider) in home assistant (see HA yaml below)
  2. call a service to set the stepper to the according number (see HA yaml below)
  3. Adjust stepper
  4. Every time the stepper stops moving it gives a feedback of its positions which is used in HA to adjust the Input number (to update the input slider if the cover is operated by another method) (NEED HELP for this:))

A possible Yaml could look like this
(HomeAssistant)

# Home Assistant configuration
input_number:
  stepper_control:
    name: Stepper Control
    initial: 0
    min: -1000  #####Minimum stepper value
    max: 1000 #####Maximum stepper value
    step: 1
    mode: slider

automation:
  - alias: Write Stepper Value to ESP
    trigger:
      platform: state
      entity_id: input_number.stepper_control
    action:
      # Replace testshutter with the name you gave the ESP
      - service: esphome.testshutter_control_stepper
        data_template:
          target: '{{ trigger.to_state.state | int }}'

And ESPHOME:

esphome:
  name: testshutter
  platform: ESP8266
  board: d1_mini

wifi:
  ssid: "INSERTSSID"
  password: "INSERTPW"

# Enable logging
logger:

#web_server:
#  port: 80  
  
# Enable Home Assistant API
            
            
ota:

api:
  services:
    - service: control_stepper
      variables:
        target: int
      then:
        - stepper.set_target:
            id: my_stepper
            target: !lambda 'return target;'
 
  
binary_sensor:
  - platform: gpio
    pin:
      number: D5
      mode: INPUT_PULLUP
      inverted: True
    name: "Omhoog Knop"
    id: omhoog_knop
    on_press:
      - cover.open: rolgordijn
    
  - platform: gpio
    pin:
      number: D6
      mode: INPUT_PULLUP
      inverted: True
    name: "Stop Knop"   
    id: stop_knop
    on_press:
      - cover.stop: rolgordijn    
    
  - platform: gpio
    pin:
      number: D7
      mode: INPUT_PULLUP
      inverted: True
    name: "Omlaag Knop"  
    id: omlaag_knop
    on_press:
      - cover.close: rolgordijn   
          
                    
cover:
  - platform: template
    name: "Rol Gordijn Rechts"
    id: rolgordijn
    open_action:
      - stepper.set_target:
          id: my_stepper
          target: 0 

    close_action:
      - stepper.set_target:
          id: my_stepper
          target: 5000
    
    stop_action:
      - stepper.set_target:
          id: my_stepper
          target: !lambda return id(my_stepper).current_position;      
    
    optimistic: true   
          

    
stepper:
  - platform: uln2003
    id: my_stepper
    pin_a: D0
    pin_b: D1
    pin_c: D2
    pin_d: D3
    max_speed: 700 steps/s
    sleep_when_done: true    

    # Optional:
    acceleration: inf
    deceleration: inf

This way an extra input number (slider) in home assistant is created to control the steppers positions. however what we still miss this way is a feedback from the stepper (ESPhome) to the input numer (slider).

I noticed there is a way to report the position of the stepper see here (https://esphome.io/components/stepper/index.html?highlight=stepper)

I was thinking there must be a certain method to call this service once the stepper reaches its positions (when it stops stepping) and feed this info back to the input number… however with my skills I dont see a possibility to get this working.

My Idea would be:

  1. in esphome call the stepper report position service
  2. In HA, read this change of position-call and adjust input number accordingly

Maybe someone could help us implement this…

2 Likes