dxdc / homebridge-blinds

:sunrise: Homebridge Plugin to control my blinds over HTTP
https://www.npmjs.com/package/homebridge-blinds
ISC License
54 stars 25 forks source link

Algorithm for blind movement as a function of distance and time #43

Closed dxdc closed 2 years ago

dxdc commented 4 years ago

Inspired by this discussion https://github.com/dxdc/homebridge-blinds/pull/41 I'm taking a stab at a physics-based equation for determining blind movement.

This YouTube seems like a good first start: https://www.youtube.com/watch?v=UJF_34TSAwQ

Initial results seem promising, if the physics interpretation are correct, although it doesn't account for gravity and I'm not quite sure how to do that yet.

Download file

Background

It's based on the following parameters:

I'm attaching a draft Excel sheet here, which is set up for both Imperial and Si units.

How to Use

To use it, first input the following parameters. I estimated them in this case.

Screen Shot 2020-07-01 at 6 18 39 PM

Then, review the data table/graph below.

Screen Shot 2020-07-01 at 6 15 18 PM

Finally, to perform a specific calculation, just input the starting and ending %.

image

dxdc commented 4 years ago

@slavikme After some reflection, I realized I'm really overthinking this :)

I studied my blinds a bit more... here's what I can tell (and would be curious to your analysis also). I'm wondering if the uptime/downtime is actually too simplistic and an imprecise way to deal with the cause.

For me, the speed of the blinds (once moving) appears to be constant regardless of the direction of the blinds.

If this is true for you as well, this leaves us with the two edge cases -- blinds at the top, and blinds at the bottom.

A lot of this depends on how the vertical limit is set for the blinds, both at the top and bottom. At the top, additional motor turn will not result in very much vertical rise in the blinds - just compression of the material. At the bottom, additional motor turn will just lower more material to the floor.

So, the problem is that what we're calibrating as "0%" or "100%" is really more like "-5%" or "103%" for example. So, I'm thinking about something like this:

Mark the the following positions for your blinds: 0%, 10%, 90%, 100%, then measure the time:

  1. motionTime = B / 0.8
  2. extraTimeFrom0to1 = A - (B / 4)
  3. extraTimeFrom100to99 = C - (B / 4)

Then, we can apply these extra delays at the edges. Let me know how this compares with your observations!

dxdc commented 4 years ago

Btw, another way to confirm if this is correct for you:

dxdc commented 4 years ago

The other parameter that could be important, btw, is a different motor delay blinds going up vs. down due to the difference in acceleration. I'm not sure how significant this would be though, depends on the overall weight of the blinds. This would be more in line with what I presented in the top of this issue since the mass will vary depending on the height of the blinds.