Arduino Forum

Using Arduino => Motors, Mechanics, and Power => Topic started by: shady23k on Feb 06, 2013, 11:22 pm

Title: Arduino output pins controlling Electric Strike
Post by: shady23k on Feb 06, 2013, 11:22 pm
Hi guys,

I have been working on a little project that I'm planning on implementing in my house. I am using the ID-20 RFID reader to trigger a high output from the arduino. I have an electric strike that will be mounted in the frame of a door in my garage. The electric strike that i purchased from ebay is rated at 12V DC @ 450mA. I am using a 12V DC power supply (which is giving out 17V DC unloaded) that will be powering the circuit for the strike. I am using the LM7812 voltage regulator to output 12VDC and a TIP31C transistor which will act as a switch when the arduino outputs a High, which will allow 12V DC from the output of the regulator. I have designed the circuit and tested and it works when I'm using a workbench power supply. I have 15V DC as an input to the circuit, and 5V DC to act as a High from the arduino. With that setup, everything is functioning as it should. My problem here is when I connect the pin (BASE) from the TIP31C to pin 9 on the arduino, and I tap the RFID Card on the reader which triggers a high output for 5 seconds from pin 9 on the arduino, I only get a spike of 7V  for one second and it begins to drop down and hover at 1V-900mV.

Im not sure if this is because the output current of the arduino isn't enough to drive the transistor or I'm using a wrong source resistor value :S

If anyone here has had similar issues and have resolved, can you please give me some suggestions, I've tried almost everything I can possibly think of.

Thanks in advance!
Title: Re: Arduino output pins controlling Electric Strike
Post by: shady23k on Feb 06, 2013, 11:28 pm
This is the circuit that is controlling the electric strike
Title: Re: Arduino output pins controlling Electric Strike
Post by: michinyon on Feb 07, 2013, 01:33 am
It's a bit alarming that you are getting 7 volts at the arduino output.  That's not good for it.

The solenoid coil of the electric strike has a fairly high inductance which is going to cause
problems when you turn it off,   it shouldn't be a problem when you turn it on so much.

I'd use a relay module to turn it on and off,   and use the arduino to activate the relay.
Depending on whether the relay module already has some kind of transistor to amplify
the control signal to the relay,  you may or may not need to use another transistor.

Not sure that I would bother with the voltage regulator at all.
Title: Re: Arduino output pins controlling Electric Strike
Post by: michinyon on Feb 07, 2013, 01:52 am
Some more bad advice:     When the transistor is "on",   the voltage across the base-emitter junction is going to be about 1 volt.   Where are you measuring this voltage ?  Between the transistor base and the resistor Rs,  or between the resistor Rs  and the arduino pin ?     If the former,   that's what you would expect to see.   Doesn't really explain the 7V though.

The second thing is,   you want to limit the current from the arduino to some small value like,  say,  20 mA. ( go look it up ).  Preferably less.  When the signal is on,  you will expect to see around 4 volts drop across the resistor.    So your resistor needs to be something in the ballpark of 200 ohms.

Third thing is,  transistors have some kind of "gain" which is the ratio between the controlled current and the controlling current.   You want to control a current of half an amp  with a 20 mA base current (say).    That's a current gain of 25x.   Is that a reasonable expectation with your transistor ?    If it isn't,  the answer is to use two transistors where the first one controls the base current of the second one.   This is often called a "Darlington" circuit or device.

Fourth thing is,  when you turn the transistor "off",  the current flowing in the solenoid coil of your doorstrike needs somewhere to go.   You need to connect a diode across the terminals in the reverse direction so this current has somewhere to go.

Title: Re: Arduino output pins controlling Electric Strike
Post by: shady23k on Feb 07, 2013, 02:02 am
Im not getting 7v from the arduino, the 7v that im reading is at the output of the regulator (the image I uploaded shows 12v out which is where the lock will be connected). Maybe I explained it wrong. The circuit works fine when im using power supplies, but the second I use the arduino to turn the transistor on I only get 7v instead of the 12v.

I am using a 220ohm resistor at the base of the transistor which gives me Ib of 22.7mA. The data sheet for the tip31c requires 1A at the base.

I was considering using a relay but I had these parts laying around so I thought I would use it...
Title: Re: Arduino output pins controlling Electric Strike
Post by: michinyon on Feb 07, 2013, 07:47 am
OK well 450 mA is a fairly big current,  thats why the voltage of your regulator drops.

Thats the same sort of reason why your "12V" power supply has 17 V with no load on it.

It won't harm the solenoid to have 17 V on it.  I'd just have the power supply without having
a second regulator.    Having two regulators isn't doing much for you except wasting power.

Saying the transistor need 1 A base current is strange.    Is that an upper limit or a minimum requirement ?
If you need 1 Amp base current to get 450 mA through the solenoid,   the transistor is not doing much good.
Title: Re: Arduino output pins controlling Electric Strike
Post by: michinyon on Feb 07, 2013, 08:00 am
That 1 Amp on the base current is the maximum limit.   Not a requirement to make it work.  That transistor
is also good for 100 V but that doesn't mean you have to use 100 V.

The Base-emitter voltage is in the region of 1.2 volts.    So your base current limiting resistor seems to
be about right 200 ohms, 220 ohms.

It's not shown on your diagram but I would think you would need the ground also connected to your arduino ground.

The gain of the transistor is rather low.   You may not be getting enough current through your solenoid.
It might be a good idea to measure the resistance of the solenoid  to see what the steady state current is
going to be.   One would think,  the resistance would be something like  12V/0.450 = 26 ohms maybe,  but it might not be.

If the gain of the transitor is not enough,  use two transistors or a darlington device.   Or a relay.

Bear in mind also,  there is a voltage drop across the transistor,  maybe 3 volts,  so if you are using a 12 V power
supply,  the solenoid is only going to see about 9 volts.   

If the voltage at the power supply outlet is dropping too much,   that suggests an undersized power supply.

Also,  feeding a 12 V regulator chip with 12V  is not going to work.   Because of the transistors or diodes or
whatever that make the regulator chip work,  it needs an input voltage maybe 2 volts higher than the supposed
regulated output voltage.      Thats the same reason,   you need to supply at least 6 volts and preferably 7 volts to
the input power jack of your arduino.

I am not really a transistor expert.  Someone in a different time zone may have better ideas.
Title: Re: Arduino output pins controlling Electric Strike
Post by: afremont on Feb 07, 2013, 03:14 pm
You need at least 2V of "head room" for the 7812 meaning that it wants at least 14V coming in.  If you don't have a heat sink on the 7812, then it's probably getting pretty hot and possibly shutting down.  You should add a .1uF cap on the regulator output in parallel with the cap you already have.

If it were me, I'd be tempted to see if a 1K (or so) resistor across the 12V supply output would load the 17V down to ~12V and skip using the 7812 altogether; either that or get a better regulated 12V supply.
Title: Re: Arduino output pins controlling Electric Strike
Post by: kf2qd on Feb 08, 2013, 05:07 pm
Don't worry about the 17V - the power supply is not well regulated, but in this application it will have no effect on the performance of the solenoid in the door strike. Hook the positive output of the power supply to your solenoid, the other side of the solenoid to your transistor and the ground side of your power supply to the emitter of your transistor and to Arduino Ground. Put a reverse biased diode across the solenoid to protect your transistor.

Don't add complexity where no complexity is needed. Under load the voltage from your power supply will drop - if it drops too low then you need a larger power supply.
Title: Re: Arduino output pins controlling Electric Strike
Post by: shady23k on Feb 10, 2013, 02:27 am
So you're saying to setup up like this?

My original setup works with a bench power supply... 15V in to the regulator for 12V out and another power supply as 5V to simulate an arduino digital out. But what i noticed is when i use the arduino to trigger the transistor, im getting 4v across the collector emitter and 8V at the output of the lock... Idealy, when the transistor is saturated, there should only be approx. 0.2V across the collector emitter, giving me 11.8V at the lock which is enough to trigger the solenoid.

Im assuming the arduino cannot supply enough current to saturate the transistor. Ive used a POT and measured the voltage across the collector and emitter until i got 0.2V but even that limiting resistor value was not enough to turn the transistor on.

If i use the setup that kf2qd suggested, is the diode in the right position? Im pretty new to the electric strike business and im not sure if terminals of the strike have any polarity. When i tested the strike and applied the positive lead of the power supply to either ends it still worked.

Another question, if i decide to use relays, im going to need two relays for this setup right? One thats connected to the arduino output pin which is turned on when the pin is set high and another 12v relay that will turn on when the relay connected to the arduino is on? Im sure the output current of the arduino wont be enough to trigger a 12V relay. If thats the case, what type of relay should i use? ive searched all around and there are so many different types of relays. DPDT, SPDT, SPST i dont even know where to begin :S .... if anyone here can give me some advice as to what i should use or can recommend one that would be greatly appreciated.

Ive also considered using opto-isolators... would that be any better?

Thanks everyone!!!
Title: Re: Arduino output pins controlling Electric Strike
Post by: michinyon on Feb 10, 2013, 01:22 pm
You are over-complicating things.   You only need one relay. 

You will use the arduino to activate the relay.   Either use your transistor to provide the
current to actuate the relay.  Or if you relay had a built-in transistor circuit to enable it
to be driven by 5V logical input,  you may not need it.

The relay will connect the power supply to the solenoid.
Title: Re: Arduino output pins controlling Electric Strike
Post by: dc42 on Feb 10, 2013, 07:11 pm
Don't bother with a relay, the solenoid only needs 450mA so a relay is unnecessary unless there is a requirement for isolation (which there isn't if you are providing the power supply for the solenoid). Your schematic in reply #9 is OK. However, the strike may well need more than 450mA while it is moving, so you need to choose the transistor and base resistor carefully. Here are some options:

- The TIP31C might just be OK if you reduce the base resistor to 100 ohms (don't go any lower).
- A logic-level mosfet would be best. Use a 100 ohm series resistor between the output pin and the mosfet gate, and a 10K resistor between the output pin and ground.
- A high gain medium-current low-saturation-voltage transistor such as ZTX851 would also work well (use a base resistor of 100 to 220 ohms).
- A darlington such as TIP102 would be OK if you can tolerate its voltage drop (about 2V), also it may get a little warm. Use a 1k base resistor.

The diode in your schematic can be 1N4001 or similar.
Title: Re: Arduino output pins controlling Electric Strike
Post by: shady23k on Feb 13, 2013, 02:16 am
Thank you guys very much! I have managed to come up with a design that functions the way I want it to.
I appreciate all you inputs.