NerdKits - electronics education for a digital generation

You are not logged in. [log in]

NEW: Learning electronics? Ask your questions on the new Electronics Questions & Answers site hosted by CircuitLab.

Basic Electronics » Relays and transistors

April 26, 2009
by paulip
paulip's Avatar

Im a little lost when it comes to both wiring up a transistor to use it as a switch and just buying a relay so that I can pass higher voltages.

Im trying to do something really simple...but cant get the hang of it...Im trying to just connect a circuit on a low voltage device to replace the button which currently activates it.

Can someone post a picture of what the board looks like with a relay wired in...I've read the basics of transistors and gating..and relays...and still dont ahve a clue.

thanks in advance.

-p

April 27, 2009
by mrobbins
(NerdKits Staff)

mrobbins's Avatar

Hi paulip,

I don't have a photo with a relay in use, but I think the easiest thing is to look at the Servo Squirter project. We explain how to use a 2N7000 n-channel MOSFET transistor to drive a motor. You can do the same thing, replacing the motor with the relay coil. (If you have a bipolar transistor, or BJT, this will change things slightly.)

Also, depending on the way the button you're replacing is connected, you can do something more like our iPhone-Controlled R/C Car project, where we use the 2N7000 transistors directly instead of the buttons on the transmitter.

Do you have more info about what you're trying to control? Anyway, hope this helps you get started!

Mike

April 27, 2009
by MacGyver
MacGyver's Avatar

Am I correct in assuming that there is not a system for multi-plexing / charlie-plexing / etc transistors that need to handle more than 40mA of current?

I am in a situation where I need to control 12 motors at 400mA each, one at at time with only 7 pins. Since I would have to ground the motors directly rather than through the MUC, I can't figure a way to handle this.

My current plan is to use a 16-1 Demultiplexer IC to use 5 pins(4control) and 12 transistors, because at $.95 for the demultiplexer ic and $.15 for transistors, its cheaper than most of the $1-$4 relays where I would need 12 of them.

Any thoughts on this? Is there a better or more standard way of controlling these?

Also, I have a project in mind using around 60 small hobby motors, is there anyone that sells 64-1 demultiplexers for 7pin usage, or is there a better way to go about controlling that many with a single MUC?

April 27, 2009
by mrobbins
(NerdKits Staff)

mrobbins's Avatar

Hi MacGyver,

I sketched this up for you:

12 motors with 7 pins

This relies on the fact that you don't want to control arbitrary combinations of multiple motors at the same time. You still have to make sure the transistors are appropriate for the load (at the reduced gate to source voltage).

I think some more brainstorming is in order for the 7 pins driving 60 motors. Hope that helps you get started thinking about it!

Mike

April 28, 2009
by paulip
paulip's Avatar

Skipping back a couple of posts....

I actually used the RC Car and the Water Gun to get my code and design thoughts.

I really just trying to activate a talking bobblehead doll by bypassing the momentary push button.

Without pictures im kinda lost..I get the idea of how to wire the transistor..OR to use the relay....but i get confused where each leg of the transistor goes...and/or how a 5v transistor can turn on a 9v relay...Ive read the info on voltage differance, etc...but im still in the dark.

Does anyone ahve a simple photo of where the wires go from a microcontroller to the transtor to the relay?

thanks

-p

April 28, 2009
by paulip
paulip's Avatar

As a continuing thought....maybe im using the wrong pin out of the processor...im using one which can light an LED...so perhaps i just need 5v relay...

-p

April 28, 2009
by paulip
paulip's Avatar

I seem to be getting chatty here....Ok..making progress...I can get the transistor to light an LED...and switch it on and off...which i guess means that Im finally getting somethig right....

Now i guess i need to either get a 5v relay...or do somethign else to use it as a switch....is there a diagram for using a transistor as a switch? or should i just buy a 5v relay?

-p

April 28, 2009
by DonNYC
DonNYC's Avatar

I am running into problems with the relay I am doing.

I cannot find the MOSFET and could not find one at Radio Shack so I got a 2N3904 NPN transistor.

I found some diagrams on the web for using a microcontroler to trigger a relay.

Here is a picture of what I have done;

alt image text

I can get the relay to be triggered by the microcontroler but when it the pin switches off the relay does not switch off. Even if i pull the wire from the microcontroler the relay stays on. It will only switch off when I pull the plug.

Is the relay pulling to much power through the transistor and overloading it?

Don

May 01, 2009
by paulip
paulip's Avatar

http://www.youtube.com/watch?v=Te5YYVZiOKs

This video solved my problem....I think i just never understood the location of the gate drain and source on my transistor...and that the Drain needs to be +5 from the battery...and the source just passes that +5 along to my device...

Now to get Don to help with the timer code to turn the relay off...

May 19, 2009
by mrobbins
(NerdKits Staff)

mrobbins's Avatar

Hi Don,

Did you manage to get this working? From my quick look at your photo, I think the emitter and collector of the 2N3904 are switched. I also wouldn't recommend driving the base of the 2N3904 like that, because you're putting a lot of current into it and may cause it to overheat and fail. A resistor in series with the base would be my recommendation.

Mike

May 19, 2009
by DonNYC
DonNYC's Avatar

I did not get it working yet.

I got a relay board just to get it done for now.

I also got some 2N7000's and I will try again. I ordered a book on electronics to learn more. I realized I have a lot to learn:)

I will keep you updated.

December 09, 2009
by BobaMosfet
BobaMosfet's Avatar

You do realize, of course, that with 7 pins, using BCD, you can control many, many more motors than 7. Think in binary, and then use an R2R network with an op-amp to determine which one you want to run. For understanding the R2R network, study how D/A converters work.

Post a Reply

Please log in to post a reply.

Did you know that multiple microcontrollers can communicate with each other? Learn more...