Need some direction on relays and limit switches for greenhouse roof window control

Ok briefly:

1. You need an SPDT limit switch that will survive in a greenhouse environment and you don't want it to fail.

2. How fast the motor stops depends on a lot of things. RPM for one. Type of gearing.

3. When a DC motor is turned off, it acts as a generator until it coasts to a stop.

4. If you make that generator operate into a short circuit, it stops really quickly. So, in reality you can assume the voltage of the motor and the winding resistance to be max current. I=12/Rm. 30 -40 Amps is a typical automotive relay. The coils are about 150 mA @ 12 V (ball park). The limit switch has to handle about 150 mA inductive.

5, The motor will stop even quicker if the distance between the motor and the relay is small. So, don't make it 50 feet,

6. The relay has a finite operating time in mS.

7. To a lesser extent friction might change with temperature.

8. Yes, the limit switches are momentary.

9. The automotive relays are designed to mount terminals down.

10, you need two limit switches and two automotive relays..

11. Open/close state is optional.
00 in between
01 open
10 closed
11 fault

12. Motor running is optional output

And then "What happens if the limit switch fails"? Fuse, breaker, electronic controls etc.


I don't have crystal ball and I can't see all of the options. A WIFI web browser was a "suggestion"
e.g. nearest structure with power and WIFI. Ethernet underground may open up other options.
Say POE or some 12 v power limited under ground source

A directional antenna e.g. or even a home made one. See:

it all adds costs, I know. But with two access points you can set up an ethernet to microwave to microwave to Ethernet link between two structures.


Again, I don;t know the full extent of the area or what one has to work with, I'm limited. The more I know, the better I can suggest. That said....

Puttng the controller in the workshop might work.

How far is the workshop from the greenhouse with a real wire? Line of sight? WIFI Ethernet in the shop?

Systems exist, look up Modbus TCP, where just the I/O exists close to the location. That system can communicate over Ethernet. Nothing is speed sensitive like computing the RPM of a shaft from interrupts.

Having the controller in your shop might even be a better option. But we may have bigger problems to get that to work.

I, sort of understand that if the design could be as simple as:

1. Open at 6 am, close at dusk (astronomical timer)
2. It's raining or windy close the windows.
3. if the outside temperature is < x close the windows.
4. if the inside temp is >x open the windows.

Hysteresis might be hard to implement. The one sensor (rain, I believe) you linked to apparently resets in a day.

Just a warning; I tend to look at all options no matter how absurd initially just to get stuff on the table.
After it's on the table you can sort it out.

Sometimes if you do the following:
1) What would i want if I had all the time and money in the world.
2) What do I absolutely need.
3) What do I want now.

You can design a system that could be upgraded. Simple things (not for this project) At home, why run CAT5 cables if I only have a 10/100 hub/switch. it might be a tougher decision to run 10G Ethernet at home. Although, I'm in the process of running CAT6 and it could be good to 1000BaseT at lower distances which it would meet.

Telephone will ultimately go over CAT 6 eventually. Adapters force an RJ11 to fit into an RJ45. So, I made the decision to use two colors of cable for CAT6

When I painted a room, I added a dual wall plate and drilled the required holes. No wires yet for telco or TV.

I spent some time today drawing the relay and limit circuit. The way it's drawn is not he only way it can be done.

This particular design is unique in a few ways:

it provides the start of a mechanism to detect if the motor is moving. An opto-isolated contact closure would be better. A resistor across the capacitor would be helpful too. maybe a few other parts as well.

DPDT limit switches could be used, but SPDT's were chosen. +12 or open is the design start for a way to determine if the window is fully open or fully closed. +12 on both @ Limit A and +12 on @ Limit B means something is wrong. The limit switches S1 and S2 are shown as if the window is neither fully open or fully closed (i.e. not activated)

because dynamic braking is employed, the motors should stop really fast. Limit switches may have some acceptable over travel. The motor should be protected against jamming. Some possibilities are the polyswitch, a fuse a circuit breaker and even an H-bridge motor controller. A polyswitch would be used say in a car window motor. It's sized to open when the motor overheats and it's mounted on the motor.

The limit switches only have to handle the relay coil current and voltage.

+12 has to be supplied to make the window do something as opposed to connecting something to ground.

It still is compatible with your (on)-off-(on) switch that your using for your window and it could be changed to on-off-on. The latter is not compatable with a controller without a manual/auto switch.

"Sometimes" it desirable to bypass a limit switch during install/setup. e.g. An open connector that a jumper would be installed to disable a limit.

The free web-based schematic designer is missing a lot of stuff. A hand-drawn schematic would be easier to understand. It would be harder to add line breaks (a separate text box for each) so you get the "no paragraph" style. Sorry about that!


Thread Starter


Joined Mar 27, 2017
Wow, your working overtime, and it's appreciated, kind of overloading me with too much info lol.

Here's the motor specs:
motor rpm is only 6, plus i got it hooked to the gearbox i made with 4" gears linking the other side, and both sides turning 2" chain drives.
- currently when i hit the off switch, the travel is 1/8"-3/16" on closing.

Ok so some parts are on the way, and I need the following:
1. two SPDT limit switches (momentary) that will survive in a greenhouse environment, The coils are about 150 mA @ 12 V (ball park). The limit switch has to handle about 150 mA inductive.

What would be a good fail safe mechanism if the limit switches fail?

2. The automotive relays are designed to mount terminals down. two automotive relays..with the dual socket connector.

The intended design operation::
1. Open at dawn (night watchman sensor)
2. It's raining or windy;close the windows (optical rain, and wind sensors).
3. If the rain stops, open them, unless it's still windy (the RG-11 sensor has some sensitivity control plus a 15min delay if needed)
4. If the wind goes to normal, open them unless its raining (wind sensor has threshold dials for both activation and deactivation).
5. Dusk, close them after dusk, delayed till @10pm (or however late is possible before that)
6. I can still open or close them manually.
7. Future- for winter only, if it's 40 degrees F or so, don't open. I have time to get to that point, the RG-11 has freeze "don't water" thing, i need to read more.

We have a week before the parts arrive, and there's no hurry. It also gives me some time to absorb all this and to decide on the networking aspect. I really am good at computer networking, but I'm fighting that "safe space" since I wanted the greenhouse to be totally independent.

This guy knows networking. He created a 10 mb/s 50 m home made microwave link.


Motor protection:
The polyswitch is probably not a good idea because of the environment. You have the notion of a circuit breaker or a shear pin of sorts or a clutch.

Thread Starter


Joined Mar 27, 2017
This guy knows networking. He created a 10 mb/s 50 m home made microwave link.
Motor protection:
The polyswitch is probably not a good idea because of the environment. You have the notion of a circuit breaker or a shear pin of sorts or a clutch.
The polyswitch?

I was thinking, just add the alarm system type magnetic reed as a fail-safe would work for both closed window stop and open window stop emergency limits...but how would I know they tripped and that the main limit switches needed attention, maybe LED's? lol
These are Polyswitches. They need to be sized properly,

My driver's side window refused to work one day it was hot. It was likely due to a polyswitch being influences by the ambient temperature. It was 95F+ out ghat day. These are connected in series with the load, so things like stuck relays, limit switches trip it. A properly sized circuit breaker should work too.

Motors have inductance and for a short time on start they draw a spike of current. In a really simple design I did decades ago, I was able to use a LM317 (3A?) regulator. With a few parts, I was able to use an SCR (A diode like device that once triggered stays triggered until power is removed). It set the regulator to 1.2V.
It was a motor in a model gantry crane.

You just want something reliable enough that if the switch failed, nothing gets really bent to unuseable or there is a controlled break somewhere. e.g. Shear pins in boat propellers and snow throwers and even lawn mowers. If you hit a rock, the pins shears and the motor stops, not a bent crankshaft.

If you want a reference to a car window controller, see:

the magnetic alarm switches This is NO/NC.


a miniature Automotive relay. It gives a coil resistance of 119 ohms at 12 V, so I= 12/119 or about 0.1A which is really close to the limit of these switches. Been there, done that.

Thread Starter


Joined Mar 27, 2017
Been reading up and going to try the demo on this smart relay you posted:

This is good advice- and i usually take some time thinking things through fully;

Sometimes if you do the following:
1) What would i want if I had all the time and money in the world.
2) What do I absolutely need.
3) What do I want now.

With that, the future holds more windows (8 windows on the sides), which a few could be automated, plus fans, poe camera, that figure in, so that smart relay is looking pretty nice. I do have the parts no for wifi in the shop to poe switch, which i'm going to run three of the ports over there in the near future.

Still waiting on the other parts to get here.
I did some designing and repairing of stuff where I worked. The stuff I designed helped us doing our research.
So, stuff became DIN rail based and re-useable. When I built stuff, I never wanted to see it again. When I fixed stuff, I never wanted to see the same problem again. I wanted stuff to be easy to troubleshoot. I went after the root cause and fixed that. I do that at home too.

So, when a thermocouple scanner kept breaking when used near high power IR lamps, found the regulated power supply was not fitted inside. I used a few other parts to limit the surges and no issues after that.

When a converted X-ray machine kept blowing the serial interface and the manufacture said replace these socketed chips, I isolated the serial interface.

I made a table-top case for temperature controllers with options. That design was still around 25 years later.

The controller concept changed in our mainstay system and we later adopted a design where I stuck my neck out and said, "This will work". It's easier, better and less labor intensive.

Earlier changes reduced the replacing of $30 fuses to $1.00 fuses significantly. The latter radical design above used no fuses.

When a 15 kV 1.5 A power supply kept failing and my predecessors kept replacing the same part, found the root cause and replaced a few more. It all stemmed from loose connections on the High voltage divider. Locktite 222 to the rescue.

Here is a randow web pic of DIN rail construction.

A typical enclosure would have an IP (Ingress Protection) rating, might be flange mounted on the wall and have a 1/4" thick removeable aluminum plate in the "back". Tapped holes hold the few things that need to be secured like the DIN rail.

From experience, it's a good idea to provide terminals near the wire entry points where external wires connect and then connect them to e.g. the terminals of the smart relay. In the stuff I designed, I used 18 AWG stranded wire with reduced stranding (less flexible) in 10 colors. At the time, I had a good source (manufacturer) of wire if I was willing to wait for a decent price.

"Wire duct" is a way of routing wires along the rails. DIN rail components can be many things from AC distribution, circuit breakers, fuses, relays, power supplies, the smart relay and "terminals". The terminals are "put together" with end blocks, terminals, separators, end caps etc. There are buss bar accessories and even ground blocks.


Joined Feb 24, 2017
KeepItSimpleStupid /QUOTE said:
Just thought you might like to know - when I click on the links you gave to, my anti-virus (Avast) immediately warns of a potential risk - so I didn't go there.


Joined Jul 23, 2019
I have a similar circuit that acts as a liner actuator using a gear motor, lead screw, diodes, and limits switches. One limit switch detects when the actuator is fully down and the other fully raised. The control the movement, I switch polarity to the input of the limit switches. The setup works well but the motor tends to over spin after the limit swtches are activated. Is there a simple way to employ dynamic breaking in this setup? See diagram attached. Thank you. -Gil


Yep. Look at motor-limits.pdf in this thread.

The general idea use two relays that short the motor to ground on both sides of the motor. Thus when the relay is not activated, but coasting, the motor is acting as generator into a short. It stops very quickly.

That means C of each relay goes to each end off the motor. Ground goes to the NC relay pin.
Now connect +12 (motor power) to the NO relay pin.

When no power or power is applied to both relays, the motor is braked.

SPDT automotive relays and a pre-wired harness are available from parts express.

Your limit swithes have to be rated for the coil current of the relays used. They would be wired so it enablles the given direction. The switches open at the end of travel in that particular direction.

There is lots of info if you search for chicken coop door.

No power is consumed by the relay when at a stop.

Motor-limits.pdf is a comprehensive solution where you can electronically detect if your at a limit and detect if the motor is moving.


Joined Jan 23, 2018
Wow, thanks for the replies. One thing that may make a difference is that there is only 12v dc power out there, I have a solar panel and charge controller hooked to 3 batteries providing @100ah of juice. I'm currently running three 2watt lights, a water pump, and the window motor, at various times. I was able to make a video and uploaded it if time permits and you're curious, though you may hear some tiny birds calling for food in the background (I didn't have the heart to take out the nest before I screened off those prime nesting spots).

So finding the sensors is the current task. It may take awhile, and I'll post more.

Thanks again!

OK, now we have some additional information that is quite important. We now know that the motors are DC powered and run on 12 volts. And there is concurrence that limit switches are vital for both the open and the closed limits. What remains unknown is if the motor tends to coast, or is there enough friction that the motor stops quickly as soon as the power is switched off. We also have no description about how much current the motors draw.

What sort of limit switches can be used is unknown, since we have no pictures of the mechanism. My choice would be normally closed switches that open when the position is reached.
I'm sure the 40A Automotive relays cover it. I assumed 12V and was right.
Normally open - depends on what you mean? Normally closed - means both directions are valid.
Exceeding a stop would mean that limit switch opens when actuated.

No power when fully open - got that too.

There is a greenhouse window thread on this forum with no utility power.