• 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.

Transistor as a switch

Not open for further replies.


New Member
Hello, I'm new to the forum.

I'm having trouble using a transistor as a switch to activate a solenoid electrovalve when an inductive sensor detects metal.

Here's the circuit:

Here are the details.

The sensor is a HT-P12NA PNP Inductive sensor (24V, 200 mA) that has 10V in the output when is sensing metal

The electrovalve has a 24V, 300mA Relay that activates it (it's a pneumatic valve)

I've tried two different transistors: 2N2218 (Vce max=30V, Ic max = 0.8 Amp) and BC639 (Vce max=80V, Ic max = 1A)

The problem is as follows:

With out the electrovalve (using a multimeter as the load) it works just fine, when the sensor is sensing metal, the transistor goes to saturation and I get 24V DC where the valve should be. But, when I put in the valve, and the sensor is on, I only get about 5V, so the relay on the valve never activates.

I tried a lot of Resistor values with no luck. I aldo checked the transistor placement a million times.

Any advice?

Note: As a power supply i'm using an 220V to 24V AC transformer and a bridge rectifier. The DC voltimeter shows a 24 V DC output, but, of course, the supply it's not perfect DC, could that be causing any trouble with the electrovalve internal impedance?

Thanks in advance.


50R looks pretty low for the base resistor it will pass 186mA which seems overkill, you could be overloading the sensor.

The base resistor only needs to be 330R to allow approximately 1/10th of the collector current into the base.

Please post the datasheet for the sensor.
Last edited:


Well-Known Member
Most Helpful Member
The way I read the (Spanish) data sheet, when operated on 24Vdc, the sensor sources 200mA at voltage of 22.5V (24-1.5V). Why not just get a more sensitive 24V relay and drive it directly between the output wire and ground?
The snubber is a good idea...

If you want about 30mA of base current (per Hero), then R1 should be (22.5V-0.7V)/0.03A = ~680Ω
Last edited:
Not open for further replies.

Latest threads

EE World Online Articles