# Transistor vs Relay



## gerard488 (Mar 10, 2013)

I am in the process of adding dcc motors and decoders to a HO scale crane in order to animate the cab, boom and hook. The instructions show three 12v relays to send power to the three motors but i am wondering if it is possible to use transistors instead of relays in order to save space. The motors will be running on 5 volts max.The complete instructions can be found here in the August 2012 issue of Model Railroad Hobbist online edition which is where I found them.
http://issuu.com/mr-hobbyist/docs/m...iewMode=presentation&mode=embed&pageNumber=53


----------



## wvgca (Jan 21, 2013)

simply, yes .... as the function leads sink [rather than feed power], a pnp would work okay, depending on current either to92 or the larger to220 case style..


----------



## gregc (Apr 25, 2015)

it looks like the relays are used to connect one or more motors to the DCC decoder motor output. The relays allow the decoder voltage to reverse polarity to drive the motors both forwards and in reverse. You can't replace a relay with a (BJT) transistor and still be able to reverse the motors.


----------



## trains galore (Jul 22, 2013)

The l293d H bridge IC might work well, I have used them before for small robotics projects and they allow you to control the direction (and speed if you want) of two motors with the one chip.
There are plenty of diagrams on the internet of how to wire them up and the chip itself is very cheap to buy.

For simplicity relays are probably easiest though, and you could get some very small ones with a 5v coil quite cheap.


----------



## gregc (Apr 25, 2015)

trains galore said:


> The l293d H bridge IC might work well,


isn't there an H-bridge in the decoder used not only as the PWM output driver but to reverse the polarity that the relays need to preserve?


----------



## trains galore (Jul 22, 2013)

Not sure but I guess there would have to be some sort of motor driver chip from the processor? 
Technically relays aren't polarised but many have a diode placed across the coil either internally or externally to stop the spike that occurs as the magnetic field breaks down when power is disconnected from the coil. This spike could easily damage other components so the diode blocks it. Unfortunately this also means that if you get the polarity wrong on the coil when you wire it up you create a direct short across the diode and burn it out. 

So you do have to be careful with them!


----------

