Ugh. I don’t know how to break this to you, but those encoders are made with moving mechanical contacts. They’re plenty good for changing a value, like setting the frequency of a radio. Driving them with a motor might not be good because of contact bounce (read the reviews) and the rate at which the shaft spins.
Apologies for using US units. A good-quality Bourns part is rated for 30,000 rotations. Assuming a rotation equates to a foot of linear movement, and you used your opener twice a day, that would be less than 3 years of service. Moreover, there’s a 60 RPM maximum rating. There are other operating limitations on the spec sheet, like signal filtering. And if you have detents between positions, the feature could be problematic at higher rates.
In contrast, optical sensors have no moving parts and don’t bounce unless there’s mechanically-induced relative motion between the interrupter and sensors.
I simple rotary encoder like this (you can get them everywhere) would be easy to mount above the motor such that it sits upside down and the shaft connects to the centre of the motor pulley. You could just use blue-tac or something to connect it so that if something goes wrong it can break free rather than get destroyed.
After punching a hole through the spindle dust cap and putting the encoder through, I discovered that
The walls of the spindle were protected by part of the dust cap
I needed a spacer to mount to the top of the dust cap for the encoder to sit on.
A few moments later…and issue #1 was resolved.
As for issue #2, after some measuring and a visit to the local hardware store, I had myself a 1/2" nylon spacer that I then threaded so that I could just screw the encoder into.
Next up is some sort of mounting solution to keep the PCB section of the encoder from spinning right along with the…stalk(?) of the encoder. I just happened to have a couple screws that fit the bill…sort of…
I had to create a slight counter-sink on the inside of the dust cap to keep the screw heads flush with the cap so it doesnt interfere with the spindle.
Ok…so I should probably cut those screws down just a bit…and I’m probably gonna order another dust cap and properly measure and drill out the holes so that everything is straight.
Regardless, I’ve come up with a workable integration of a rotary encoder with my garage door. In addition, I’ve completed the prototype configuration and validated that everything works properly on it.
Cool…so the next issue I will have is converting however many rotations on the encoder from door being fully closed to fully open into a percentage. The current thought is that the front end will express the Garage Status as a percentage of open. Then I can setup a couple entities that will open the door 1/4 or halfway. Do HASS templates support some sort of math function?
As a side note, while screwing around doing all this, I noticed the steel belts inside the garage door belt were exposed in multiple places. Long story short, the belt is over 20 years old and was only warrantied for five…so I got a new one coming.
Appears to be simple enough, just to double check I am understanding what’s going on…you’re grabbing the sensor state, converting it to a float, multiplying it by a tiny number and then rounding it to the 2nd decimal point?
First print of the case. I’m gonna have to move the cutout to be more in line with the ESP32, I was expecting a bit more flexibility from the power cable.
I went off on a tangent of doing many other things and have finally returned to getting this guy completed. I’ve taken some of the previously mentioned advice and prototyped a gear to connect the encoder to the belt.
At some point in the past, I reprinted the ESP32/Relay housing in a more durable material (PETG). The fit on the lid is a bit too snug, so that will need to be adjusted before finalizing.
I need to build a housing for the encoder and figure out how to mount it to the motor housing. I have some magnets laying around from a previous project that might work for this…
Look for more frequent updates on this in the coming days.
Great work!
However, i’m really curious how long this encoder will work… i guess that they are not designed for so heavy work, so hoping for the best…
Better option would be optical encoder, but they are way more expensive, and bigger, too.
Thanks, I think minimum order through amazon was 5 for like $10 bucks…so if they’re short lived, they’re cheap enough. If they’re too short lived, I’ll just have to go back to “dumb” smart garage door, lol.
Came up with a simple two piece design to keep the gear on the encoder that works great. I think this part is design complete and I can print it off in its final material. The surface finish on the base wheel is a little jacked up because I tried a setting that caused the top surface to detach.
I may need to redesign the ESP32/relay housing due to space restrictions. I’ll probably be borrowing from this design I worked up on a separate project. It will require a little refactoring for the longer relay board, but shouldn’t be too bad.
Redesigned ESP32/Relay housing prototyped out. The ESP32 section and lid mate up perfectly, had to refactor a couple things on the relay housing though. I was a little too tight on some cutouts and the board didn’t fit quite right. Should be dressed in black tomorrow.
The hole on the “front” of the housing is where the wires will come out and go to the garage door opener. The hole on the “side” is both access to the screws and where the wires from the encoder will come in…or at least that’s the idea that I have in my head at the moment.