Lets Make a Simple Transistor or Relay Switch :)

Ok, a lot of people here on the Lynxmotion forums have been asking about making electrical switches.

Heres my proposal, can we please make up some sort of list of parts and a printable diagram of how to set them up, that way people can download and print it up and make their connections by refferring to the diagram. Im sure this setup can be inexpensive when homemade (which is what Im looking for) and most of the parts can probably be bought online for fairly cheap (that way the gas in your car to go buy them at the local radioshack isnt more expensive then the setup :laughing: ). Naturally I’d post something I could come up with, but i have yet to enter the world of electronics and diodes :laughing:

Can someone shed some light about this. :bulb:

In other words:

http://www.rthtg.net/e/relay_driver.gif

D1 = Common power diode
K1 = Relay (rating appropriate to your +V line)
Q1 = 2N2222 or equivalent
R1 = 10K ohm resistor

R2 and D2 are optional, but provide a nice LED indicator to tell you when your relay is energized - very handy if you have a number of these in play at once.

R2 = 470 ohm resistor
D2 = LED

It just about takes longer to draw the circuit in a paint program and publish it to the web than it does to build it.

Id like to point out that these setups are run by high/low voltages (thus being an electronic relay). Also, images of what these components look like will be up shortly.

I’m reposting the below switch setup if one needs a DIY switch that is controlled via servo type pulsed control signals.

uoguelph.ca/~antoon/gadgets/rc-sw.htm

Here is a nice HEXFET switch that EddieB submitted in another thread. I thought it would be a nice addition to this sticky. Thanks again EddieB!

img2.putfile.com/main/6/16408441734.jpg

Below are the Radio Shack parts which should be available at most RS stores. I use inexpensive 4 conductor cat3 phone wire for hookup wires.

MOSFET IRF510 Transistor 276-2072 $1.99
10K Ohm 1/4-Watt Carbon Film Resistor (5-Pack) 271-1335 $.99
1N914/4148-Type Diode (10) 276-1122 $1.39

I made the below setup using the radio shack parts. I used a 22k resistor (271-1339) instead of the 10k to have a little less drain on the battery. The board is half of a dual mini board (276-146, $1.99) and hooked up with pieces of cat3 phone wire. The two wires going to the left go to the controller hi/lo and ground. the two wires going to the right go to what is being controlled, the top wire goes to the power +, and the bottom wire goes to the power -. I tested it using 4.5v (3 batterys) for control, and the component being controlled was a 9 LED flashlight head being powered by 4.5v (3 batterys). I haven’t tried it controlling anything of a higher voltage, such as a 12v motor.

http://web.comporium.net/~shb/pix/mosfet2.jpg

Looks simple and easy to make (the point of this thread :wink: ) I hope this will help a lot of people.

If we’re sharing…

http://www.rthtg.net/e/xistor_switch_01.jpg
The basic transistor switch circuit, with LED indicator, used to switch power to a gearhead motor. Built on a random scrap of protoboard, using solid hookup wire. (The servo cable passes under the board with no connection - I just used the board and its mounting screws as wire-routing.)

http://www.rthtg.net/e/xistor_switch_02.jpg
Same circuit, but directly switching an array of LEDs, rather than a relay (remove the relay and suppression diode from the circuit). Built on random perfboard. The wire is salvaged from an old data cable that was being thrown out when we changed buildings at work. A 20-foot, 40-conductor cable provides enough brightly-colored 24-gauge solid hookup wire for a lifetime of projects. The bundle of rainbow-colored wires at the top of the photo were salvaged from an 18-conductor printer cable, which supplied lots of brightly-colored stranded wire for applications that call for more flexibility than solid conductors can provide.

http://www.rthtg.net/e/xistor_switch_03.jpg
A trio of transistor switches, laid out on perfboard, and again driving LED arrays instead of relays. Red, green, and blue wiring and status LEDs correspond to the driver circuits, while the yellow wire is for the return signal. Same source as above for the wires.

http://www.rthtg.net/e/xistor_switch_04.jpg
Driving a relay again, this time for house current. this board controls a desk lamp for use in time-lapse photography projects. Using a signal from the camera to turn the light on only when a photo is about to be taken means that I don’t need to leave a lamp on and burning 24/7, when I only really need it for about 15 seconds, every hour or two.

For scale purposes, all of these circuits are built on standard perfboard, with 0.10" hole spacing.

Just as a quick tip, one can use the basic DIP Programming Shunts (RS 276-1512, $.99 for 10) like below to make connections to the male pins on various boards. One puts the wire end down one hole in the shunt and solder it there. The other unfilled shunt hole is then slipped on the desired male pin. In 3 male servo pin setup, the common power and ground can be jumped off the end pins of an 8 pin bank.

http://web.comporium.net/~shb/pix/jump1.jpg

Final hookup tip. When I have to make long runs to servos, I use cat3 phone wire like below (using 3 of the 4 conductors). I put a slight curve on the ends of the bare wires for a slight inteferance fit, then slide them into the end of the servo connectors. I use the shunt jumpers on the other end of the wires to connect to a servo board. Comes in handy when the ready made servo connectors aren’t available.

http://web.comporium.net/~shb/pix/conn1.jpg

I’ve done some testing with my IR510 switch. With a ~4.8v control voltage, to appeared to operate a small 12v motor (.25a running no load), and a 12v 12w bulb (~1a current). I could not control my 12v harbor freight drill motor. With the 4.8v control voltage, the motor would not start, and the transistor got very hot very quickly. With a 12v control voltage (from the same battery powering the drill), the motor started and ran at 1.25a no load. The transistor also heated up, but not as quickly. I also swaped a 100k resistor for the 22k one I was using, and it was sufficient to keep the control line from floating. It appears that the IR510 switch is capable of controlling small motors and other moderate loads.

When a coil is switched off, it generates a large back EMF. The purpose of the diode in these circuits is to harmlessly diverte the EMF through the diode, protecting the transistor and keeping all the magic blue smoke in.

Relays, motors, solenoid and other devices with coils need this diode.

With other loads (if you use one to switch on a logic power supply, for example), the protection diode can be omitted.

If you are controlling loads of several amperes with the IRF510 you may need to increase the gate voltage as current flowing through the MOSFET has the effect of trying to turn it off. Once the MOSFET comes out of, for lack of a better word off of the top of my head, saturation it is in the linear mode and starts dissipating significant power.

If you are going to try driving loads of more than a couple amperes you may want to consider upgrading the IRF510 to something like a Fairchild MTP3055VL which is designed for 12A with a 5V gate voltage. At 12A it will be dissipating 2W so you need some sort of heatsink but at 5A to 6A it should be fine just by itself.

Increasing the resistor from the 10K certainly may save some power but it also means the MOSFET takes longer to turn off and stays in the linear region for a longer period of time. For high amperage loads you may actually want to decrease the resistor if you are switching at any significant rate.

Oh, also you probably want to upgrade the 1N4148 re-circulation diode to a 1N4001 or 1N5401 if you are > 5A load. The 4148 is only rated for about 100mA. :wink:

Hello all,

What do you think about the…

**Picoswitch **
( follow this link : dimensionengineering.com/PicoSwitch.htm )

…or…

** Battleswitch **
( follow this another link : dimensionengineering.com/BattleSwitch.htm )

…to control electrical power on and power off.

Much expansive and maybe much sure for “high voltage”…

James

Edit : Argh… This articles are already in the Lynxmotion online shop. Sorry for this needless reply.

Someone has taken the time and made the effort to do the work for you, at a cost. I think they are convenient, almost idiot proof, and expensive for what they are made from. However, if you have the money and are inclined to doing things the easy way with little risk of error they are a good solution.

There you go - a very good summary of what they are, and what I think of them.

I would add, though, that they are controlled like normal servos, with a varying PWM pulse train, rather than through on-off logic levels, as a transistor switch would be. Your control methods for either the Pico- or BattleSwitch units will be different than if you choose to go with the transistor switches presented in this thread.

Hey Thanks for that Seamus, I really appreciate that. I wish i could show you the detail work of my new relay switch, it’s AWESOME! But it’s already encased in hot-glue.

It has 2 output pins, and a small physical switch.

The physical switch* is between the ground and one of the output pins.
*When switched on, it’ll create a common ground to one of the output pins, Then when the relay is tripped it’ll create a common ground between both pins. So all i’d have to do is supply the voltage to the device in question, as long as they share a common ground.

When the physical switch is switched off, both output pins are independent and totally reliant on the relay. So i can connect just about anything to it.

I just wish i could show you the details, The entire thing is placed right on the Relay Switch, So it’s really small.

Heres a couple scans on my scanner, it’s the best i can do at the moment. You cant really see much of th detail because of the hotglue.
http://img215.imageshack.us/img215/130/001mit.jpg

You can see the tiny white physical switch which links one of the output pins to the ground, it’s currently switched off.
There are 2 more wires then there should have been, i messed up with the transistor, and had it on backwards, C was E. So instead of using a new transistor and starting over, i just cut it, and rewired it. Pretty damn good considering the size of the thing.

Only regret, i didn’t use a 22k resistor, as i read on page 1, that it’ll drain less power. But i had trouble finding an acceptable one in my scrap pile.

Edit: Heres a schematic of what i did.
img682.imageshack.us/img682/4205/relaydriver.th.jpg
I can set it so the top pin, when the relay is tripped, will have a common ground, neat huh!

Making a Simple Transistor or any Relay Switch is not the complex task. You can do that if you aware about the functions of points and diodes. You should have enough knowledge of the circuit and required power management. while making these switches make sure that the parts that are used for making should be of the best quality for the better result.

Half the links in this thread are 404’s and a couple images works.

Could someone repost the images in this thread? I’m curious about the images in Seamus post.