Coop door opener with 2 way 12VDC motor

Reloadron

Joined Jan 15, 2015
7,517
One of my biggest shames. I thought I could do music while staying illiterate.
Illiterate means the same thing in music and electronics. If you don't learn the language, you are doomed to play cover songs for the rest of your life, and still not understand the details.
As my father impressed upon me. Thank God I took to electronics as for 45 years and a few kids it put beanies and weenies on the table and paid the bills. As to music? I would have starved to death frozen over or spent my life urinating in gutters begging for loose change. :)

Ron
 

Thread Starter

rfeyer

Joined Aug 24, 2014
126
the diode at the + of the power supply was placed by my ignorance: first, I was under the impression that electricity starts at the positive (further reading tought me that Electrons start at neg and move to pos which makes sence) and I thought the diodewould prevent backward flow - again, I am very green and older, perhaps I am learning slower.
The SPDT does seem a strange placement - as it is meant to cut off power supply, it most likely should be placed directly at the beginning of the negative power supply?
 

Reloadron

Joined Jan 15, 2015
7,517
OK, from the beginning. As drawn the circuit won't work and is not practical for a number of reasons. Using a transistor as it is used to cut off the power supply isn't a good idea or practice and as mentioned the transistor in question is installed backwards. You mention using a micro-controller which is fine. This can all easily be done using a simple Arduino, PICAXE or host of other micro-controllers. Controllers aside the polarity switching to the motor needs to be done in a clean efficient manner. Let's try this. I will propose the below circuit. I believe this circuit will do what you need to do. It is one of several ways to go about it. The circuit can easily read from a micro-controller and also send data to the micro-controller. The relays used are common automotive relays and more important they can easily handle the high DC currents for the motor. They can be had in any automotive supply store. Not drawn in is fusing and the circuit should be fused.

Relay 12V Polarity Reversal.png

Using K1 and K2 the motor polarity switching is fail safe. The limit switches send a logic signal to the micro-controller when the motor is at full travel, they also have a red LED indication and as limit switches should do preclude further travel of the motor. This is how I would likely go about doing this. If any forum members see where I may have screwed up please do say something. The numbers on the K1 & K2 contacts are standard industry numbers for that type relay. Sorry I forgot the coil numbers which are 85 & 86 and matters not which is which. There really isn't much to this circuit and it should work fine.

Ron
 
Last edited:

Thread Starter

rfeyer

Joined Aug 24, 2014
126
TY for the diagram.
I looked at it about 12 times and about think I know what it is doing, but, of course I do not since I can not tell what interupts the power supply to the motor and how the MC inputs change anything.
The motor seems to have it's own PS with 2 SPST relays - but what makes them change polarity, what makes them switch on or off?
Again, I do not know how to read diagrams and so I am sure I am just missing it
 

Reloadron

Joined Jan 15, 2015
7,517
TY for the diagram.
I looked at it about 12 times and about think I know what it is doing, but, of course I do not since I can not tell what interupts the power supply to the motor and how the MC inputs change anything.
The motor seems to have it's own PS with 2 SPST relays - but what makes them change polarity, what makes them switch on or off?
Again, I do not know how to read diagrams and so I am sure I am just missing it
OK, let me try an explanation or theory of operation. Based on Alec's post he caught an error in my wires so I fixed it. Thus the revised drawing is posted above, with the revision.

The circuit is based on using two relays SPDT (Single Pole Double Throw) The relays are turned On and Off using signals from a micro-controller. The controller sends either a logic 1 which is 5 volts or a logic 0 which is 0 volts.

If Raise and Lower are both logic 0 neither relay is turned on and both motor terminals are at ground potential Transistors Q1 and Q2 are both off.

If Raise is logic 1 (5 volts applied) and Lower is logic 0 then Relay K1 is turned on through Transistor Q1 and the normally closed upper limit switch. Relay K2 is Off. When relay K1 is On one side of the motor, the top terminal as drawn, has 12 volts applied through the normally open contacts of K1 87 & 30. The coop door will raise till the door hits the upper limit switch (SW1) and the SW1 normally closed contacts open. The motor will stop the upper limit red LED will light and a logic high of about 4 volts is sent to the uC telling it the motor is at the end of its travel. Even if the uC were to continue with a logic 1 at Raise the motor would stop.

If somehow Raise and Lower were both at Logic 1 by accident or whatever both K1 and K2 would pull in applying 12 volts to both motor terminals so the motor would not run or do anything. This is a fail safe.

If Lower is logic 1 (5 volts applied) and Raise is logic 0 then Relay K2 is turned on and Relay K1 is off. The reverse of the above Raise logic happens, the motor polarity is reversed from the raise logic. When the door hits the lower limit switch relay K2 drops out and a lower limit signal is sent to the uC as well as the lower limit LED illuminating. Even if the uC tried to push the motor beyond the stop the lower limit switch would stop the motor as it went from normally closed to open. Relay K2 would drop out.

Raise and Lower Logic = 0 nothing happens No Motor Travel.
Raise = 1 and Lower = 0 the door will raise.
Raise = 0 and Lower = 1 the door will lower.
Raise and Lower = 1 nothing happens. No Motor Travel.

From the micro controller the Raise and Lower signals would look like this switch:

MOM Switch SPDT.png

That is how it would be done manually using a SPDT (Single Pole Double Throw) switch Momentary On / OFF / Momentary On. The switch is spring loaded with a center off position.

Questions?

Ron
 

Thread Starter

rfeyer

Joined Aug 24, 2014
126
Thank you soo much for explaining!
Here is where my brain has a problem: I believe, as stated above, I do understand the portion of the diagram above the motor and two relays. I also believe that the relays act sort of as the H-Bridge I have in my diagram? But, that is not my problem, and again, since I am VERY new at reading diagrams, I could easily be wrong in everything.
What I do not understand:
it looks like the power source provides positive lead uninterupted to both K1 and K2.
It also looks like both K1 and K2 have uninterrupted path to ground.
upload_2015-1-28_6-26-3.png
I see above this motor relay portion the excellent schematic of the microcontroller's two inputs (raise and Lower), both having the SPDT switch mechanism either conducting or being interupted, but what I do not understand is where this Transistor circuit is interrupting any power going to the motor?
i.e.: as I stated above: the motor seems to have uninterrupted power supply driving through two relays when the above transistor circuit ties intot he same power supply without interrupting the motor.

Is there any way that portion could be explained - it is truly the only portion I do not seem to understand.

I know I am now being a pain, but as often as I look at it, I do not see the possible change in power supply OR any changes of stimulation of the relays

Rainer
 

Reloadron

Joined Jan 15, 2015
7,517
OK, before we look at your questions let's look at a very basic and very crude H-Bridge.

H Bridge Basic.png

H-Bridge is merely a circuit configuration and likely called a "H"-Bridge because it resembles the letter H. All of the switches in the above circuit are just plain SPST toggle switches. Note the truth table below the circuit. I didn't get too carried away and kept it basic. If for example SW1 and SW3 are closed power positive will be applied to motor terminal 1 and power negative will be applied to motor terminal 2. We can call that forward. If SW2 and SW4 are closed the reverse happens. The big problems are those I called Not Allowed. Obviously closing SW1 and SW4 or closing SW2 and SW3 will place a dead short across our power. This is where a good H-Bridge design will preclude or eliminate this possibility.

As to the circuit I posted. The ports labeled Raise and Lower are inputs from a controller, note the direction of the ports. The ports labeled Upper Limit Out and Lower Limit Out are signals to the controller. The controller makes the decisions when a controller is used.

Yes, the power source connects directly to K1 and K2. This is true of both positive and negative power. This would be like having SW4 and SW3 closed in the above simple drawing. Motor terminals 1 and 2 are both at ground or negative so nothing is happening. Negative goes to both K1 and K2 normally closed contacts. Power positive is also connected directly to K1 and K2 through the Normally Open contacts so when neither K1 or K2 is energized the positive power goes nowhere beyond the contacts which are open.

What I do not understand:
it looks like the power source provides positive lead uninterupted to both K1 and K2.
It also looks like both K1 and K2 have uninterrupted path to ground.
That would be true, but as I explained, it matters not because nothing is happening for the logic reasons I mentioned. It is important to understand what K1 and K2 are doing in both energized and de energized states.

but what I do not understand is where this Transistor circuit is interrupting any power going to the motor?
OK, let's take a look at the transistors Q1 and Q2. The controller places a logic 1 (5 Volts) on the Raise Port. That signal will turn on Q1 and Q1 will turn on K1. Assuming the door is not at its upper limit. If the door is at the upper limit and SW1 is closed to K1. So Q1 allows current to flow to and through the K1 coil energizing K1. The K1 N/O contacts 87 to 30 close and the K1 N/C contacts 87A to 30 open. When this happens Motor Terminal 1 receives positive power since Motor terminal 2 is at ground since K2 isn't active. The motor will run raising the door till the door hits the upper limit. When the door reaches the upper limit SW1 opens and K1 drops out since SW1 interrupted relay K1's coil path to ground. Also the Upper Limit LED will illuminate and a signal is sent out to the controller telling it that the door has reached its upper limit. OK, so the door is up and the controller knows it is up and the LED tells you it is up.

The controller does whatever it is programmed to do like maybe wait till it wants to close the door and remove the raise signal from the raise port. OK, it's evening and the controller decides to close the door or lower the door. K1 and K2 are both Off.

The controller sends a Logic High (5 volts) to the Lower port. This time Q2 receives the lower signal and turns on K2. So Q2 allows current to flow to and through the K2 coil energizing K2. The K2 N/O contacts 87 to 30 close and the K2 N/C contacts 87A to 30 open. When this happens Motor Terminal 2 receives positive power since Motor terminal 1 is at ground since K1 isn't active. The motor will run rlowering the door till the door hits the lower limit. When the door reaches the lower limit SW2opens and K2 drops out since SW2 interrupted relay K2's coil path to ground. Also the Lower Limit LED will illuminate and a signal is sent out to the controller telling it that the door has reached its lower limit. OK, so the door is down and the controller knows it is down and the LED tells you it is down.

Logic can be the stuff headaches are made of so don't worry if you have a hard time understanding all of this. It takes time and much thought to follow what is going on and how the circuit actually works. You are not being a pain, your goal is to understand this circuit and my goal is to try and present it in a way you can understand it. Believe me I know what a pain is as i have an ex-wife. :) You are not a pain. You don't understand? Then ask and continue to ask.

Ron
 
Last edited:

Thread Starter

rfeyer

Joined Aug 24, 2014
126
TY for that as well! I have read about the H-Bridges and have seen a similar diagram, which is great for review.

I may havefound my confusion: I am looking at the whole diagram listed in #23 as ONE circuit. I do see K1 and K2 in the upper half, and there I can follow your diagram very well - and understand your explanation to include the MC function as well as the switching with limiters and transmitters.

Is it possible thet the Motor circuit I extracted in #28 and which has K1 and K2, is actually just an exploded view of the upper half? I don';t believe so? Because I can not see how the circuit with D1 and K1 and upper limit switch is influencing the lower part where the motor has K1 and K2 circuit?

Yup, still confused - not about the function of the relays and limiters, but ONLY on the part how the above circuit interrupts the bottom motor circuit

Rainer
 

Reloadron

Joined Jan 15, 2015
7,517
The circuit I posted in #23 is all one complete circuit. The lower portion of the drawing reflects the relay contacts and the upper portion reflects the relay coils. Just a matter of the layout. Sometimes a circuit will consist of several pages of "E" size drawings leaving pages to interpret. So yeah, I put the K1 & K2 in this case contacts and the K1 & K2 coils up above. Before I forget, if you look at the two diodes, they work out to be across the relay coils. They serve as what we call flyback diodes to suppress the inductive kick of the relay coils when power is removed from a coil.

So it's all one circuit, nothing expanded. K1 and K2 contacts are shown in the lower portion while the K1 and K2 respective coils are shown in the upper portion. That practice in drawing a circuit is not unusual. Like I said, it's not unusual with a very large Letter E drawing that has several pages to show relay contacts over a few pages and the relay coil on an entirely different page. In time people learn how to read and interpret large drawings, including drawings done in "ladder logic".

On a side note when interviewing prospective technicians for job positions we required the ability to read ladder logic drawings. It wasn't unusual for me to toss a several page ladder logic drawing on the table and ask the applicant to define a few portions of the drawing.

Ron
 
Last edited:

Thread Starter

rfeyer

Joined Aug 24, 2014
126
Hey Ron,

Wuff! I thought I was really loosing it for a few days! So now it makes more sense. I will try to simplify the drawings into something I think I can visually see and get, and go from there.
Again, thanks tons! Not knowing schematics obviosuly does not help and am currently re-reading Electronics for dummies and am reading explanations on "learningaboutelectronics.com" in order to get more understanding of schematics and 'stuff'.
I guarantee I do not think I am an electronics specialist (am in the medical field).
This hen door is supposed to be a hands on starter for my learning about electronics.
Well, much more to learn.
TY again,

Rainer
 

Thread Starter

rfeyer

Joined Aug 24, 2014
126
Now of curiosity, why is it not advised to use an H-Bridge cross over DPDT relay versus 2 distinct SPDT relays? Is it an increased 'kickback'?
 

Reloadron

Joined Jan 15, 2015
7,517
Now of curiosity, why is it not advised to use an H-Bridge cross over DPDT relay versus 2 distinct SPDT relays? Is it an increased 'kickback'?
No, the idea is that using a DPDT relay never leaves an open condition for the motor. The motor is always energized be it forward or reverse. So this leaves you adding another relay or trying to remove power with one real big transistor as your original drawing was doing. Neither method is practical or good design practice. The DPDT relay doesn't offer a sort of center OFF position. Also earlier I mentioned a few "Not Allowed" conditions. When designing circuits we always want it so a Not Allowed condition can't happen. Well as close as possible anyway. :)

The thinking behind chicken coop doors and circuits like people counters (another popular one) is to get you to think and gain an understanding of how things work.

Yeah, my grandfather was a doctor. He delivered me and my siblings. He graduated the Columbia School of Medicine in 1907. He was a great doctor and really a man of wisdom. He would never screw with electricity though. I had an agreement with him, he wouldn't screw with electricity and I wouldn't do surgery. :)

Ron
 

Thread Starter

rfeyer

Joined Aug 24, 2014
126
:) - Well, he certainly was before my time - I am a PA and graduated from Albany Med college in 1983 and didn't screw with electronics until now :) Should I stop? (just kidding, I won't).
I do understand your thinking and, when I get a chance tonight, will try to redraw to see if I can do it.
TY for your help so far!!!

Rainer (p.s.: born and raised in Germany to an automotive engineer - Dad still alive but can't help with electronics anymore at 89).
 

Reloadron

Joined Jan 15, 2015
7,517
Helping people like you is a pleasure. Electronics put beanies and weenies on the table for 45 years of my adult life. Besides electronics my passion is the shooting sports and right now in Cleveland I am butt deep in snow precluding time on the rifle range. Once retired we have a surplus of time on our hands. Since I am not out shooting (and freezing my butt off) I have plenty of time here. :)

Ron
 

Thread Starter

rfeyer

Joined Aug 24, 2014
126
That is totally appreciated!
BTW - in my parts of the woods we shoot for food :) (not by necessity, but it's good and healthy). We also have our own chickens.

I do have a question: reading many sites and books about how electricity travels (contemporarily + to - but in reality Neg [electron] to Pos [proton]), but the question is:
Does it really matter which side of the equation I place a transistor as an on/off switch? Of course a circuit is disrupted either before or after the load, but everything I see places transistors on the negative side of load. Would it really make a difference?
 

tracecom

Joined Apr 16, 2010
3,944
Generally, NPN transistors are used as low side switches, and PNP as high side switches. There are many more NPN than PNP transistors for that reason.

But, yes either side can be switched.
 

Reloadron

Joined Jan 15, 2015
7,517
That is totally appreciated!
BTW - in my parts of the woods we shoot for food :) (not by necessity, but it's good and healthy). We also have our own chickens.

I do have a question: reading many sites and books about how electricity travels (contemporarily + to - but in reality Neg [electron] to Pos [proton]), but the question is:
Does it really matter which side of the equation I place a transistor as an on/off switch? Of course a circuit is disrupted either before or after the load, but everything I see places transistors on the negative side of load. Would it really make a difference?
Regarding current flow. I can only suggest you give this thread a read. Every time I see this subject come up for discussion in a forum it starts slow with some theory and eventually grows into some heated discussion and argument. I avoid this stuff like the plague. My opinion, and just my humble opinion is I learned this stuff a long time ago. My introduction to electronics was vacuum tubes or for those across the pond valves. I learned it as current flow was negative to positive as to direction. Then we get into electron flow and hole flow, do holes flow?
Conventional Current
assumes that current flows out of the positive terminal, through the circuit and into the negative terminal of the source. This was the convention chosen during the discovery of electricity. They were wrong! Electron Flow is what actually happens and electrons flow out of the negative terminal, through the circuit and into the positive terminal of the source. Both Conventional Current and Electron Flow are used by industry. Many textbooks are available in both Electron Flow and Conventional Current formats.
During my entire career it never really mattered to me. I never really worried about changing the sign or anything else for that matter. Thus I have always avoided threads like the one I linked to which was quite recent. :)

Ron
 

Thread Starter

rfeyer

Joined Aug 24, 2014
126
But, does it matter on which side of the equation 'parts' are placed - i.e.: does it matter if a transistor stops flow on the positive or on the negative side? Eventually, stopping flow is stopping flow, no? That really was my question on this one
 
Top