• Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Help with transistor and relay

Not open for further replies.


New Member
I'm building a USB device, using a PIC18F2455 chip. I've got the device recognised and coded - that's not the problem. The device is going to switch up to 4 relays after receiving a 5v signal from the microcontroller. As each relay is activated, an LED lights up too.

The schematic and PCB layout look fine to me - I'm sure I got a single relay working on my breadboard, but when I solder all this lot up, I can't get a single relay to switch on: the LED lights up when a signal is sent to the relevant output, but the relay simply does not switch on. (I'm concentrating on relay number 4 for now, but the problem exists on all relays).

I've checked that the diodes to the 5v side of the relays coils are the correct way around - in fact if I put 5v onto the emitter pin of the transistor (pin 3) the relay does switch over. I've also checked to make sure that 5v exists on pin 1 of the transistor. But if I put 5v onto pin 2 of the transistor, the LED lights up but the relay does not switch on.
(the transistor has part number BC517 if it's relevant).

Can anyone offer any assistance?
Many thanks,

Nigel Goodwin

Super Moderator
Most Helpful Member
I would say the schematic is wired completely wrongly - you want the relays in the collectors of the transistors (with a reverse diode across them), and a resistor feeding the base.

Check my Hardware Extras page of the tutorials for details.


Well-Known Member
Most Helpful Member
Your transistors are wired as emitter-followers that have a voltage loss of at least 0.7V. The diodes in series also have a voltage drop of at least 0.7V.
The output voltage of the PIC might be 4.5V and the 1.4V drops reduce the voltage to the relay's coil to only 3.1V.


New Member
Besides resulting in (theoretical) 3.1V at the relay you'll fry the PIC when connecting an LED to its output. Doing that the active I/O pin will almost drop to zero V.

Use the circuit I suggest and you won't overstress the PIC and have the LED at full brightness (current limiting resistor would ideally 95Ω for Uf=2.4V and If=20mA). The forward current will still be 19mA using 100Ω changing LED brightness barely visible.

The relay will also click happily. :)




This is a copy post there is already a complete thread covering all this.
He's already been told the relays are on the wrong side of the transistors and the diodes need to be put in anti-parallel with the relays.
Not open for further replies.

Latest threads

EE World Online Articles