Unfortunately not, but it doesn’t bother me anymore. I also added position support since Esphome was updated. And also added an open offset, since for me at least, I had some problems that my motor would skip when opening, so the blind was not exactly in the correct physical position, and when closing again, it would sometimes go too much. This offset makes sure that when opening the blind, it is open with slightly more steps than needed, but these extra steps are not taken into account for the current position.
Here is the updated code, it also contains a switch for a relay controlling my heating, since the esp is close to that. You can ignore that part. (left more details below the code if interested)
I left the heating part here since it might be helpful for you guys to know about the new script feature with mode restart. The way I have this is that another Esp8266 calls this script to turn on heating, and it keeps calling it every 2 minutes or so. And in case the calls stop, after 5 minutes the script will turn off the heating, to avoid it running forever
I’ve got a 12v worm motor with encoder. Does anyone also use these and got a proper config? It isn’t as straight forward as a stepping-motor. I’ve tried setting it up using the on_value of the encoder, but that’s hard since it isn’t able to stop at exactly 0. Every rotation of the encoder gives 11 pulses, and I believe it’s a 1 to 64 gear ratio, so that’s a lot. I’m still experimenting myself, but it would save a lot of time if somebody has an example.
So I’ve got a working config now. Just one thing I can’t get fixed is the position-report. From my understanding 0 means opened (rollerblinds up), and 1 means closed (rollerblinds down). However, when I set the position to 0 using esphome, Home Assistant puts the slider all the way to the right. This also happens when I set the state as OPEN. If i set the closed position to 0.01 and the opened to 0.99 it works almost perfectly, but I think there is something wrong in my configuration.
Here is my code so far. Since the encoder goes too fast i’m not able to make it stop exactly on 0, so that’s something to keep in mind:
Your post as well as FF-Fox’s post along with this whole thread has been insanely helpful in me putting together the EspHome brains of my DIY smart blinds.
I’ve now got a 5V 28BYJ-48 stepper motor (bi-polar modified) directly driving a small Ikea Tupplur test blind exactly the way I want it to. This involves two buttons (Open & Close) as well as a magnetic reed sensor endstop.
on boot, the blind will automatically home (full open) and then return to whatever position it was at before the homing operation.
Up (open) button sends the blind all the way open (home)
Down (close) button sends the blind all the way to stepper_steps
Pushing either the Up or Down buttons during a move will immediately stop the blind
Calibration Mode: With the blind at full open, press and hold the Down (close) button for 10s. The blind will start going Down (close) until a button is pressed. The stepper_steps is now set to wherever you pressed the button just now.
Every time the blind goes to full open, the endstop resets the stepper’s 0 position.
@ashwin I have implemented your code and it works well, however I want to invert the controls as currently when booted the blind thinks it is at the top of the movement. Essentially I want 0 to be at the bottom. I have tried to modify your code but to no avail.
I modified the opening and closing loops to do the opposite but kept the logic the same. It seems to work. So now defaults to the bottom. I guess inverting the outputs to the motor may have done the same thing.
Now I need to work out how to 0 the blind with a switch.
Once your endstop switch is triggered, that’s the queue to tell the stepper that this point is 0 (stepper.report_position) and to also set this point as the current target for the stepper … so it doesn’t move past it (stepper.set_target).
Thanks, but I am not using a stepper motor . I tried to get it working but it just didnt have enough torque to lift my heavy blind. Instead I have DC motor with a wormgear.
I have managed to get it working with something similar by a switch and setting the rotary encoder position to zero.
Now 3D printing cases for it all so I can hopefully mount it all up next weekend.
Ah, I understand now. Looking forward to pictures?
I’m sacrificing speed for torque by still using 28BYJ-48 5V steppers with a print in place 2.5:1 planetary gearing on the output to handle my larger blinds. Fingers crossed that it works and I’m able to live with the (lack of) speed.
Nice. My roller blind requires nearly 2.5kg of force to lift it, the magnets in the stepper just kept skipping. The wormier takes about 15 to 20 seconds to fully open which for a bedroom blind is fine. I plan to have home assistant automate it anyways so it isn’t like I will be waiting for it to happen.
I have dropped in some pictures of what I have so far. Unsure about heat so I may have to drill some holes into the case. Essentially it will pull round the chain as it rotates. Clearance issues made mounting it at the top impossible without modifying the blind which I didnt want to do.
I only recently got a 3D printer so I am basically finding things I can make with it.
How is that going to be attached to the wall/floor?
Since your motor won’t run for more than 15-20 seconds at a time, you probably won’t have to worry about adding ventilation to your enclosure.
P.S. - If you’re looking to impress the significant other with your 3D printer, my wife recent approved of my laundry detergent cup holder print (similar to this).
I am currently printing a bracket that will fix to the wall with a slider for a set of screws so I can set the right tension. The box will then slot into the holder and be held in with some 3D printed dowels. Well that’s the plan anyways.
I do now have a stepper and motor driver that I dont know what to do with…
Hi. I am currently still building and testing it so it isnt quite ready to share yet. However I have a DC Motor with a 40 RPM gear box on it, it is reasonably high torque and is able to lift my roller blind. It has a built in rotary encoder so i know how far it has travelled. Originally i didn’t have this and ran it for a set time. Issue is the blind is a lot faster on the way down than up and when testing it, it was an absolute nightmare.
I am controlling it with an ESP8266 (Wemos D1) with a end stop switch on the windowsill with zeros the encoder when it makes contact.
Once i have it installed and running reliably i will share the code, but currently i want to make sure it works before it causes issues for other people.
I have hit a bit of a stumbling block and hopefully someone may be able to help. I have the blind cover opening perfectly to 0 and 100% but i cant seem to get it to move to any percentage in between.
I thought it would go off a percentage but i dont think this is the case. Below is the section of my code governing the percentage but something is wrong. Can anyone help?
So I have managed to get the slider working with the position_action function. Took a while to get it working but the following code works for my set-up using a DC Motor with encoder.