Garage door, getting the position

I am still working on my garage port controller, but I am unsure on how to determine the position of the port.

I would like to be able to set the position (maybe) 0 - 100% where 0% would be closed, and 100% fully opened. Thought about adding a rotary encoder to the motor, and then just count how far it moves, and then calculate that into percent. The problem there is just that if the power has been off, or program reset in the arduino, it wouldn't know where the port then is.

Any idea on what to do with this? Or would the rotary encoder be the best, and then let the arduino open or close the port to measure the port position.

If geared right, you could use a pot. Something similar to a servo. That way you would always know where it was.

Something that may or may not be harder to achieve... Create a gray-scale line across the length of the door. From black to white and then read the reflectivity with a sensor.

One solution to the "if power fails" problem is as follows....

You use both a relative "has gone x units forward" sensor, and an absolute "it has reached the end" sensor.

On every power up, you cause the door to move until the "it has reached the end" sensor is tripped, and then count from "there".... until the whole thing has to be repeated after the next power failure. (You also use the "reache end" indication to take care of "drifting" between power failures.)

hmm, the strip is a good idea, but cant be used, the port is moving longer than its own length, so it would move off the scale. And it folds too, so a big area isn't possible to use. Should then use two sensors, but that might be a mess to work with too.

I should try to see if I could count the rotations of the motor, to see if it would be possible to use a multi turn pot.

On every power up, you cause the door to move until the "it has reached the end" sensor is tripped, and then count from "there".... until the whole thing has to be repeated after the next power failure. (You also use the "reache end" indication to take care of "drifting" between power failures.)

Yes, was thinking about that too, but would like it not to have to move on power up.

If you have access to a rotating component, then gearing down the rotation to where full travel of the port is less than a whole rotation would allow the attachment of a pot. Some hobby shops have adjustable gear boxes, or look for a cheap toy with a geared setup to hack.

Trying to count the rotations it takes to fully open or close the port. But it is a bit difficult as it is turning pretty fast, and hard to see in there.

If it turns less rotations than it takes to move a multi turn pot from minimum to maximum, then that would be the best thing to use, I think. It would then just be to connect it directly to the shaft, and make a little mount for the pot.

hmm, the strip is a good idea, but cant be used, the port is moving longer than its own length, so it would move off the scale. And it folds too, so a big area isn't possible to use. Should then use two sensors, but that might be a mess to work with too.

By "port", I am assuming you are meaning "door" - ie, a "garage door" to let an automobile in/out of the garage.

You don't say what kind of door this is, nor what is moving it. Here in the US, we have two typical kinds of garage doors - one that is basically a slab that moves on special hinges and large springs to tilt it up and over:

http://www.remodelguide.com/improve/garage/garage_intro.gif (right image)

...and one that is composed of segmented pieces that moves on a curved track, typically with a coiled spring and cable counterweights to carry the extra load:

http://garagedoorrepairhelp.com/wp-content/uploads/2009/06/garage_door_parts_diagram.jpg http://www.easyrollgaragedoors.co.uk/garage_doors_yorkshire_images/garage-doors-sectional-doors2.jpg http://earlcarterlumber.com/images/affina_interior_432.jpg

...then there are the roll-up doors composed of multiple small segments - but you only see them usually on commercial buildings. There are other options (side swinging, plus some variations on the hinged vs segmented roller), but the majority here are one of the two types above (with the segmented roller version becoming more widely used despite its much higher initial cost - you see them more on new homes and remodels).

Either type of door can be moved by an opener that has the long rail and slider (chain, belt, or screw drive); sometimes on the segmented doors, though, the opener goes in place of the coiled spring and cables counterweight system:

http://www.1stdooropeners.com/walljackshaft.jpg

Knowing exactly what type of door you are moving, and what kind of system is moving it, may help us to help you come up with a positioning solution.

I should try to see if I could count the rotations of the motor, to see if it would be possible to use a multi turn pot.

A multi-turn pot with a gearing system might be the best (and simplest) way of implementing a positioning system. You could also do something similar with a regular potentiometer (because really, that is all a multi-turn pot is - a regular pot - sometimes linear travel - that is geared down to the knob).

The idea of a gray-scale line could be done, but doing it would be difficult. What might be better (depending on the door style) would be to set up a simple "bar-code" (look into "Gray Code") along the edge of the door (if on a track) that could be read by a few photo-detectors. You could probably position the door within a few centimeters of precision with such a system (not sure what your needs are, but that seems reasonable to me).

If your door is the "tilting slab/hinged" type, you could connect the potentiometer to one of the moving guide bars on the hinging system via a linkage; since the door moves in a fraction of a circle, a standard pot could be easily used.

Another way to measure the position would be to connect a tape measure tape to the end of the door; as it moves up and down, the tape would move in and out (the torsion spring in the measure would retract it). Add a means to sense the movement of the tape (bar code, contact roller/gear mechanism, etc). Something similar could be done also via a retractable clothes line mechanism.

Since that is something that has to be done safely you'd want an optical incremental rotary encoder with a home position.

http://www.arduino.cc/playground/Main/RotaryEncoders This gives a basic understanding of them. Industrial ones are available on ebay for around $25. I picked up one that does 1024 pulses per revolution and works at 5-24 volts which allows it to work with the Arduino or with 24volt industrial controllers. You want the line driver version.

Yes it is a door… Language confusion, door and port isn’t the same in Danish. A door is something that is sized for persons to walk through, and port for bigger “doors” that are for car and such.

Mine is one with hindges that bend when it opens

Video of it here:

This also shows how the motor opening it is working.

The idea with a measure tape is good, but I just finished removing the old wires from it, and made it all nice and tidy (and changed the switches to some magnetic ones instead http://bld-live.dk/?p=68), so I would like to keep it as clean as possible, with as few things hanging around as possible too. :slight_smile: Also thought if it could be possible to do inside or near the rails the wheels are running in, but they are shielded in a way that prevent things to come in between, so can’t attach anything there and still make it invisible.

Since that is something that has to be done safely you’d want an optical incremental rotary encoder with a home position.

http://www.arduino.cc/playground/Main/RotaryEncoders This gives a basic understanding of them. Industrial ones are available on ebay for around $25. I picked up one that does 1024 pulses per revolution and works at 5-24 volts which allows it to work with the Arduino or with 24volt industrial controllers. You want the line driver version.

With a home position? Isn’t that only for telling you where on the 360 degrees rotation it is? I need something that can tell the Arduino where it is somewhere in 50-80 revolutions.

You can also get absolute rotary encoders, same as the pot idea but digital.

Thinks...but that would need X inputs whereas the pot only needs 1.

Yes it is a door... Language confusion

A "door" in English is basically anything that opens and closes to let anything pass through, regardless of size.

What is the total travel length of the port? I looked at the video, and lots of different possibilitys. The joint panels flex as they are moving which could be monitored. I think a martini is in order to get the creative juices flowing. ;)

The joint panels flex as they are moving which could be monitored. I think a martini is in order to get the creative juices flowing.

That sounds like a solusion that will leave nothing than a headacke, just like the martini. ;)

I would put a layer of insulating tape down the side of the aluminum channel (the one with the lead-screw inside). Then I would put a length of carbon conductive tape to form a 3-meter long "slide pot". That would give you an absolute reading on position and you can connect it directly to an Arduino analog input.

That is a very good idea! Only problem is to add a wire to the moving door, or maybe that can be worked around by putting two up, and then just connect one to another, and then read two instead of one.

What about ultrasound?

A distance sensor mounted at the bottom edge of the door pointing downwards would allow you to read the door position relative to ground at all times.

A distance sensor mounted at the bottom edge of the door pointing downwards would allow you to read the door position relative to ground at all times.

Would work too, but I would then still have to attach a wire to the moving door.

I could also let the arduino time the door every time it is doing a full move, but I think that would get very inaccurate efter 2-3 steps without a full move, plus the time changes depending on how cold it is, because there are much bigger resistance from the rubber seals on the outside when it is cold.

Questions: 1) what is the position accuracy you need? 2) How much $$$ are you willing to spend?

1+3 ) 5-8 cm (the port got a dead spot about half way open, where the springs perfectly holds it, without applying any force to the motor) 2 ) As little as possible, and hard to say how much, because before I actually get the parts here, they might easily cost the double, or more, of what they cost outside of the country.

But it seems to be harder than I hoped for, to get it to know where the door was. So maybe I should go back to just making it calibrate on power up, or add a button to start the calibration so it won't just start to move as soon as the Arduino is powered up.

I don't think anyone has mentioned a battery backup. If using the rotary encoder method and power goes out... how long can it go out for? Maybe just rig up some rechargeable D or C cells that power fails over to in the event you have a loss of mains power. Unless you loose power for several days, this should keep everything working and calibrated.

This keeps the simplest method of the rotary encoder while solving your calibration after power loss problem.

So maybe I should go back to just making it calibrate on power up,

You could delay calibration until there is a need (a command is received) to actually move the door - then you would know someone is there to check. Also if you have end-switches (you should) and is positioned at one - there will be no need for additional calibration if you loose/recycle power and the door is at an end-stop.

You could also save the position (rotary encoder) to EEPROM after every move. Write a flag (a "start" position marker) to EEPROM when you start a reposition sequence and change it to the actual position when repositioning is complete. If the position read at startup is the "start" position - you need recalibration, otherwise not.

Hmm, ofcurse! That would be a pretty simple solution to the problem. Could add a rechargeable PP3 battery, I am also putting a 9V voltage regulator on to feed the Arduino, so it should also be able to maintain the battery (I think?).

Think I will go for the battery backup solusion. Sounds like the most simple. And if I then combine it with a manual calibration button too, then it should be pretty safe.

The reason I don’t want it to do anything on its own, is because it doesn’t have anything to tell it that something is in between. I am working such a switch for it using a light sensor and a little laser module, but the build in controller still doesn’t have any good input for that, only thing it does is to stop moving the port when the light is blocked, and it will then just start moving the same way when the light is back again.

So I am also going to connect the arduino to that, so I can send it two fast pulses (off- 50ms on (stop) - 50 ms off - 50 ms on (reverse) - off) and then make it move the opposite direction instead of just continuing down. But it will still be connected directly to the original controller too, because it only senses the light sensor when it is moving down.

And it is not even that big a problem with power loss here. I have lived here for 3 years now, and only had a single one that lasted about a second. I just want it to be save, because when things go wrong for me, it is like watching final destination with a lot of small events happening, and ending by something worse happening (just without all the blood and people dieing)

Personally I'd have half a dozen reed switches along the track (with a magnet on the slider). The reed switches short circuit a voltage divider (like the switches on some LCD shields) fed to an analogue pin and the arduino knows which reed switch was passed last, hence it knows where it is, the code for the motor controller should already know which way it's going. You could use digital input pins if you prefer and can spare them. Much simpler and probably more reliable than the mechanical work to hook up some kind of encoder (and no calibration to worry about). Although it only knows about discrete positions........