0
\$\begingroup\$

Circuit

This is the simulation on Falstad that works:

Falstad Simulation

Where it is being done that way for tests purposes, but the objective is to use a TTL signal from the encoder to send a 24V signal to a PLC or Data Aquisition Board.

Problem

There are two transistors:

  • A PNP (BC558)
  • And a NPN (BC337)

The moment when the 24V source is turned on and the 5V switch is off, the LED lights on. Is it a problem from the transistor specs? Or It is to work that way and another thing is wrong...

Is it possible to make a TTL encoder signal conversion to 24V just with two transistors?

EDIT:

It worked with an optocoupler:

Circuit optocoupler

However, when testing with an encoder for the 5V input, the optocoupler couldn't switch on the required frequency. So a new NPN transistor was used and the circuit worked:

New circuit

And the PLC read the encoder pulses correctly.

So I got rid of the 24V at the base of PNP. It is working, however, any noise on the circuit can make it send pulses incorrectly.

\$\endgroup\$
9
  • \$\begingroup\$ You can drive simple loads with just only one NPN BJT. \$\endgroup\$
    – Long Pham
    Commented Jun 5, 2018 at 13:28
  • 2
    \$\begingroup\$ When the LED is supposed to be off, measure the voltage across the collector-emitter of the NPN transistor. It should measure about 23 V. If that voltage is much less the NPN is still conducting, then the TTL signal driving the NPN might not be close enough to 0 V when it is zero. \$\endgroup\$ Commented Jun 5, 2018 at 13:30
  • 2
    \$\begingroup\$ If you connect the base of the NPN to ground with a 10 k resistor the NPN should be off. Then that 18.6 V must increase. If it doesn't try a different NPN. \$\endgroup\$ Commented Jun 5, 2018 at 13:40
  • 2
    \$\begingroup\$ Also, just as a sanity check, the LED must be off when the NPN is removed. If it is not, you have another problem (like something is making current flow through the LED). \$\endgroup\$ Commented Jun 5, 2018 at 13:54
  • 1
    \$\begingroup\$ It sounds like the transistor you were using at first was broken. \$\endgroup\$
    – Hearth
    Commented Jun 5, 2018 at 15:06

1 Answer 1

1
\$\begingroup\$

I think because at the base of your PNP, there is a 24 voltage supply connected to a much higher resistor than at the Emitter. You wont have a perfect voltage supply or components. If the voltage at the emitter doesn't get high enough it won't turn off the PNP. The voltage has to be equivalent or higher. Probe the Base to ground and the Emitter to ground to see if the base is high enough. Theoretically it should be, but with leakage and stuff it might not be.

I would suggest to get rid of the PNP and just control the LED with the NPN.

\$\endgroup\$
2
  • \$\begingroup\$ Unfortunately the input from the PLC is PNP \$\endgroup\$ Commented Jun 6, 2018 at 11:49
  • 1
    \$\begingroup\$ I wonder if you add a cap to ground where you are seeing the noise and that should filter out the noise. Caps are high pass filters and wont let the DC flow to ground but if there are any spikes such as noise, the noise would freely flow through the cap to ground. \$\endgroup\$
    – Diegs18
    Commented Jun 6, 2018 at 17:24

Not the answer you're looking for? Browse other questions tagged or ask your own question.