Relay does not work !

Can someone suggest what I am doing wrong. I am trying to control a small DC motor using the code here (http://www.glacialwanderer.com/_blog/blog2008/04_April/relay.pde) . I used the circuit shown here ( http://www.arduino.cc/playground/uploads/Main/relays.pdf) and my set-up is as shown below. When I run it nothing happens. I tried taking out individual components ( relay, transistor, pump) and they seem to work just fine. I have attached some documentation that is relevant.

en-g5sb.pdf (78.2 KB)

Here are the links for my initial post.

What happens if you try to actuate the relay directly (that is, disconnected from the transistor/diode, etc - and proper voltage on the coil)? Does it work?

If it doesn't, are you sure the leads of the relay are making contact with the breadboard's spring connectors (I've seen some relays they either didn't quite reach, or barely reached, making intermittent contact)?

Rather than switching the relay, have you tried maybe a 12 volt lamp instead of the coil?

Is your diode correctly oriented?

Do you measure voltage at the leg of the transistor with your meter when it is supposed to be "on"?

Are you seeing a high signal from the output pin from the Arduino? Have you tried hanging an LED off the transistor's base resistor (disconnecting the transistor)?

Are you sure you have the transistor oriented correctly?

Once you've verified all of that, verify that the based resistor is allowing enough current to flow to the transistor to fully turn it on. You could then try to disconnect the arduino's output from the transistor, then use a 3-4.5 volt source, connected to the ground and the base resistor - to try to turn on the transistor in a "manual" fashion (repeat and recheck everything above as well if things are working right).

The idea is to try one thing, one change - at a time - and troubleshoot your way down the chain. Whatever you do, don't alter -two- things at the same time between tests; take your time, one step at a time, to isolate the cause.

Thanks for the quick and detailed reply. I will do as suggested

Its still not working but i figured the following:

  1. The leads are making contact the breadboard terminal.I used a 5V signal to turn on the coil and the relay fired and the pump turned on.

  2. I checked several documents and my diode is correctly oriented and works.

  3. Transistor is correctly oriented

  4. The voltage at the leg (collector) of the transistor is LESS ( about 1/5 ) than the supplied voltage. I think that's the problem. Can someone confirm if a MPS2222A-331 transistor can be used here.

Thanks

You said you power directly the Coil side or the relay , was that in the bread board?

yes i put the wires into the breadboard.

Hmm - Any chance you have a extra Light or LED you can hook in parallel to the Coil - to see if something is failing do to load or relay :slight_smile: ?

And can you measure and tell us the voltage on both the base and collector of the transistor for both states (off / on), to confirm its switching properly. If the transistor is off I would expect its collector to be at the relay's supply voltage.

Have you verified the pin out for that transistor part number - they can vary by manufacturer even.

xan213:
4. The voltage at the leg (collector) of the transistor is LESS ( about 1/5 ) than the supplied voltage. I think that's the problem. Can someone confirm if a MPS2222A-331 transistor can be used here.
Thanks

With the transistor on or off? On, it should be closer to 0v. If it's sitting at 1/5 of supply (ie. 1v) when it's on, then you have only 4v left for the coil.

Off, it should be close to supply V due to there being no current through the coil so no V drop accross it.

I'm guessing you meant on, so it seems the TR isn't turning all the way on.

Sorry it took me a while to put together the stuff i needed to implement your suggestions.I still haven't managed to make this setup work.

Woody - I connected an LED ( across the coil i.e in parallel as suggested) and still nothing. In the ON state the voltage across the coil is approximately zero.

MarkT/ roncoop - On my last attempt during the ON state the voltage ( collector side) fluctuates between 0.043V to 0.821. In the OFF state it is 0.004V.

I bought the transistor from 'Radioshack' with no datasheet or reference to their manufacturer. I placed an order for some new transistors with a better vendor that will provide the pinout data.

xan213:
I bought the transistor from 'Radioshack' with no datasheet or reference to their manufacturer. I placed an order for some new transistors with a better vendor that will provide the pinout data.

It doesn't matter who made the MPS2222 transistor, they are all the same more or less, pinout is the same for sure.

The connections on your picture are all wrong.

Look at this picture. Disregard the component values and the transistor part number.

If you connect one side of your relay coil to your positive supply, the other side of the relay to the collector of the transistor, the emitter of the transistor to ground. You connect a resistor on the base of the transistor - anything between 1K and 10K is fine. If you touch this resistor to positive supply the relay should be activated.

Datasheet for your transistor: http://www.ece.msstate.edu/courses/design/2006/spring/design1/interactive_human_skeleton/Datasheets/Unused/MPS2222A.pdf

I don't follow, which parts exactly are wrong ?

I have my digital out pin connected to a 1kohm resistor then to the base of the transistor. The collector side of the transistor is connected to the anode of my diode and then the cathode is connected to the positive power supply (+5V). There are small wires (white) that connect the relay coil on either side of the diode. Which part is wrong.

xan213:
MarkT/ roncoop - On my last attempt during the ON state the voltage ( collector side) fluctuates between 0.043V to 0.821. In the OFF state it is 0.004V.

That doesn't make any sense (your findings, not the way you wrote it).

If you put 5v to one end of a relay coil and don't connect the other end to anything (your transistor when it's off), you should mesure 5v on the other end of the coil. IE. no current flowing through it so no V drop accross it. Then if you gnd the other end (your transistor turning on), of course you'll have 0v on that end, or really close to it.

My best guess here, since I can't put my hands on the thing, you've got the leads on the transistor swapped around. Your "off state", measuring .004v looks to me as if it's really the on state as that's pretty close to gnd. Your other readings are inconclusive. Makes it seem as if you've got the pinout wrong.

Here's a thought: Google up how to test a transistor with an ohm meter. You can work out the pinout yourself pretty easily.

It works. The transistors from Radioshack were probably faulty or just didn't work. After i changed the pinout on my new transistor (http://www.alliedelec.com/search/productdetail.aspx?SKU=70014158) everything worked fine. Thank you roncoop and company.

Glad to hear it worked.

If you're curious, testing the possibly bad transistor is really easy, it just acts like two back to back diodes if it's good.

Cheers.