Author Options:

How do I wire a 12V DC motor to micro switches, relay digital timer and battery? Answered

I am wanting to wire up a door to my hen house that will open in the AM and close in the PM. I have a 12V DC powered cordless drill motor and a digital timer. Can you help me on what I need to make this all work as far as switches, relay, etc. and possibly give me some guidance on how to wire it up? Just so you know, I have very limited electrical experience. Thank you. Rod


Hi Rod,
Here's my suggestion for using your switches. If you look, you'll see that in the YES picture, the switch WON'T get crunched on a slight overtravel.

Now, why doesn't it go the other way ? Have you got a voltmeter ?


Limit Switch.jpg

Good Morning Steve, I see what you are saying about the switch. My problem is that in order to keep the door from binding, my door track is about 4 mm wider that the door. So there is alot of slop and getting the switch to trip in the same place everytime is a problem. But I think I can redesign the trigger so it won't smash the switch. The bottom one will be alright because the door can only go down just so far. Yes I do have a multimeter, but I have to warn you that I bought it just for this project so my knowledge of its use is limited to what I've learned on the internet.

Morning Rod,

OK, stick the meter black lead on the negative connection to the battery - this is our reference point.
This gets tricky to explain

The way this should work is that to go UP, relay A should go ON, B should go OFF, so if you measure the voltage on the microswitch side of each coil, when it goes ON, the other side of the coil should read ZERO volts.

When it wants to go DOWN, Relay B should go ON and A OFF, so again the coil should be ZERO on the microswitch side.



Ok, I'm back and refreshed and ready to get my project another step closer to completion. I've checked across my switches to coil wires on both relay A (top switch) and B (bottom switch) and they are both hot. Also the only way that my door will run up is if the neg wire on relay C coil is disconnected. The attched schematic show which terminals are hot with the neg wire on C relay connected.

scan schematic 50001.jpg

Hi Rod,
Hope it was fun.

OK, that looks as I would expect.

What's happening on the OTHER coil pin ? The one that goes to the microswitches ?

At the moment, the thing looks like one of the relays isn't closing as it should.

Disconnect the motor for now, for safety sake.

One relay or the other will click as you switch C's coil on and off. B should click as you turn ON C, A should click when you release C. Does it ? If you hear A and B click , make sure you can clearly see the contacts move open and closed, and we haven't welded them together.

If you measure the voltage where the motor WAS it should read zero when the motor should be off, +12 when it goes one way, and -12 when it goes the other.

Pretend to be the door by pressing on the microswitches.

The door SHOULD go the other way,. when C is on. Measure all your hots again, and mark up the picture. I am wondering if the way we wired the relays orginally has made on of them stick.

This pretty much shows you what I have at this time. The contacts are closed on both B and C and open on A. I have voltage on the motor when the wire from C 1 to B 5 is disconnected then when I activate the top switch the voltage drops off. But with that wire hooked up per your schematic, there is no voltage even with switch activated. I checked both switches with that wire hooked up and couldn't get power to drop off on any pin.

scan schematic 70001.jpg

Can you take a couple of photos ?

What happens in the other state (Coil C off ) ?


Hi Steve,

I haven't been ignoring you today but I had to go borrow a camera and get this together. I can load a couple of pictures here but its hard to see what wiring goes where. To be able to see the whole "picture" I'd like to email a few more if that's alright. I set my relays up just as your schematic is. Let me know if this helps or if you need more.


When checking with a multimeter shouldn't I be getting a -minus reading on some or at least one of the terminals on my relays?

Steve, I'm sorry but I won't be able to work on this for the next couple of days as I'll be out of town. With the recent 8" of snow we just had my wife and I feel we just have to get in one more weekend of snowmobiling before spring. When I get back Sunday I'll redo my top switch and I'll get back to you then. Thanks for all you've helped me with so far. My wife thinks I'm nuts for even starting this project (hen house) but it's been a great stress reliever this winter, that is up til now. I really do appreciate you helping me see this door thing through to the end!

Here's the circuit. It uses two microswitches and two relays.

Hen door.jpg

I guess maybe I should have given a bit more info. The timer I have is a digital 12V DC timer that is capable of settings of 1 to 30 seconds and can be set for many times daily. What I was hoping to do is set the timer to energize it in the AM for approx 2 seconds and when my top micro switch reverses it, denergize it. Then in the PM energize it again for approx. 2 seconds until the door is closed, switch kicks in and then denergize it. Again, I apoligize for my very limited electrical knowledge but any wiring schematic needs to be very simple please. I don't know what a W04G bridge is. Thanks

How about instead of a timer, use a photocell, and open and close at dusk and dawn ?


The DC digital timer I want to use is used for a remote deer feeder. It totally runs off of 12V DC and has motor speed control capabilities and a battery charge gauge. Would I be able to incorporate the switch on the reversible drill that I'm powering it with? I checked with Radio Shack and was told that there wasn't a photocell that I could use with DC. This chicken house is on wheels so it can be moved around to free range the chickens so I would like to keep AC out of the picture.

Radio Shack aren't engineers. You can easily use a CdS cel, like this from Radio Shack, and a little bit more stuff around the circuit I showed. The thing is, you mustn't EVER lose "up" and "down". You could solar power this fairly easily too.

If I new what I was doing I'm sure I could power it with solar, but I've spent $35 for this timer, I've got the motor, battery, charger and I'd like to be able to use them if possible.

What kind of battery have you got ? How many Ampere-Hours is it ? A little solar panel can be placed across the battery and keep things going nicely for you, there's nothing complicated about it.

Like Rick says, the complication is that the designs we have shown will draw a little bit of current constantly, I'd like to reckon on the battery life you'll get from the thing before making a final recommendation.


I have a sealed lead acid battery made by Zeus that is a 12V 7AH. Its one that I've used in my fishing electronics. I've looked at solar panels and found them from 1.25 watts to 2.5 watts in my price range. Will I need some sort of a controller to keep from over charging my battery?

I don't think so, if you keep it to one of the very small panels, the over charge comes off as a little bit of warming in the battery that's all. Go for the 2.5 W panel if you can.

I tried putting this thing together and all I've been able to do is make my relay click. Here is a drawing of what I've got. I sure would like some help if any body has any ideas.

schematic 20001.jpg

How do the three relays get wired in? Now I am baffled.

Did you use the ones I suggested ?
I'll sketch it up for you if you like.

I couldn't read your schematic as it didn't come across large enough so the relay I got probably isn't the same. If you could sketch it alittle larger for me I would appreciate it. Please keep it in a "language" that a electric Dummy like myself can understand. Thanks, I do appreciate your help. Rod

Here you go Rod. I hope its clearer. I've tried to draw the parts as you'll see them.

If you click on the picture, you can usually get to see the original size. See what you think. Build this basic block, and I'm sure we can get what you want running.

SOME relays have a + sign on one side of the coil - make sure you wire that to the + side of the battery.

You need to be careful to make sure the right switches hit the stops at the right time.


Steve, I've got a bit of a problem hooking up my timer using the schematic you've given me. My timer has 4 wires with it, 2 for incoming power and 2 for out going (to motor). The timer needs current all the time or else it will loose the hour of the day. The on/off/motor speed program keeps it's memory but if I don't have 12V going to it all the time it forgets what time of the day it is. Can you help me?

What I'm seeing here is the pos wire out of the timer motor side can go to the relay coil and the neg splices in with the neg to the battery. I'll give it a try. Thanks

Steve, I've hooked everthing as per your schematic and checked it 3 times, but when I go to hook up the last wire (ground on battery) all I get is sparks at battery post. The only thing I'm not sure of is the way the timer leads are hooked up. The top two on your schematic I assume are on the Positve side and the bottom two are on the negative side. What am I doing wrong?

scan schematic 20001.bmp

Hi Rod,

I have spotted an error on my drawing that I've corrected - here it is. There shouldn't be a cross over on the relay power connections.

. Can you point me to a page on the exact relay you bought, so I can cross check my pictures ?

Forget the timer, until this works. Put a switch from where you've written "out" to the battery negative.


Hen door relays.jpg

Here are the directions to my relay. http://www.radioshack.com/product/index.jsp?productId=2049722

I'll change my wiring and if it still doesn't work I'll pull out the timer.

The pictures should work. Failing that, send me some pictures of the wiring and I'll see if I can spot anything.


Steve, I took the liberty of numbering your schematic so we would know what we are talking about. As I hooked up the wires without the timer, I tested them with the battery. I didn't have any problems until I hooked up 3 on relay A to 4 on relay B. It shorted out at that point. I switched the motor leads with 3A and 4B and I could hear the relay click but the motor did not run. Again I went over all my connections and I am sure I have it wired per your schematic.

scan schematic 30001.jpg

Unfortunately Radio Shack haven't shown the wiring connections to the relay you've used. The MIDDLE pin of the group I've shown is supposed to be the common connection to the NO and NC contacts. It usually is, but, is it ? Or have they got it at one end ???


Here is a copy of the package it came in if it helps.

scan schematic 40004.jpg

OK, Try this Rod.
Sorry about the messing you around with the wiring - this is a weird layout !!

Hen door relays.jpg

We must be getting closer. It didn't arc when I hooked it up, but all that happened was relay C just click when I hit the switch.

OK, check the microswitches now, make sure they are wired common and normally closed.

I think you're right. We're nearly there ;-)


OK, eliminate the switches and lets try to turn on the relays and make the motor move.


I changed the switch wires to the other side of relay C and all that would happen is relay A and C would click. Then I took the neg wire off of the coil on relay C and the motor started and ran the door up to the top switch and shut off. It bent my switch alittle but its OK. It's getting exciting now!


Its always a good idea to NOT let the door crunch on the switch, but to slide past it and push the switch in as it passes.


My problem is the cheap $1.09 switches I bought don't have enough travel or clearance. When the switch makes up the momentum carries it into the switch farther than it should. Maybe I'll bent the arm on the switch down alittle so it can make up sooner and put a stop on the door so it won't go so far. The timer I have has an overload switch thats suppose to shut it off if it gets bound up. I'll have to find that "happy medium". OK, we got the motor to run one way, now what do we have to do to make it go the other way? I'm assuming that if we kept power to this it would just keep opening and closing until the timer shuts it off. This is that the way that I originally thought it would work.

No, I'm the one who should be apologizing. I really appreciate the help you've already given me. I'll give this a try in about an hour or so. I've taken over my wifes dinning table to work on this project and the lighting isn't the best. It's about 7:00 AM here in northwest Wisconsin, USA and the sun isn't quite up yet. Once we get this thing working I'll send you some complete pictures of this door project and what it's going in.

ARGGHH ! Its nothiing like my sketch !!!!

Give me a few minutes !


opps, I'm sorry, Imean I had problems after hooking A4 and B5