Arduino Controlling transistor

I have a device that runs on 24v DC and it uses 24 V logic. I would like to control it with my arduino Uno. I thought that using a simple NPN transistor would work in the attached configuration. Is this the way to do it? The 24V device has its input pins pulled down to ground internally.

Thanks in advance

No, that is an emitter follower and would only output around 4V when switched on. You could use a high side switch to do the job, like this:

Note: The +9V should be 24V.
R1 = R2 = R3 = 1K.
The LOAD would be the 24V device's internal pull-down.

Your circuit (emitter follower) won't work, because it can source only 0 to Vcc of the output pin :frowning:

Simple solution; use an photo coupler for the NPN transistor, and drive it by the digital output pin.

Here's an example of a circuit for the excellent photo coupler suggestion by DrDiettrich:

Good suggestions, i am looking into both. sadly I have 200npn transistors and no PNP. Your ideas seem like a great long term solution but I was wondering if I could use something like an inverting logic gate like this one as a temporary patch.

I really do not want to invert my signal so could I stack to inverting gates together?

Maybe??

jacob84401:
I really do not want to invert my signal so could I stack to inverting gates together?

If you're using a Uno, why not just invert the signal in software?

Do you know the value of the pull-down resistor.

An NPN transistor with emitter to ground, a 1k resistor between base and Arduino pin, and a 10k resistor between +24volt and collector might work.
Depending on the switch points of the 24volt logic.
Lower the value of the collector resistor to 1k if needed.
Leo..

RogerRowland:
If you're using a Uno, why not just invert the signal in software?

I want an active on for safety reasons, meaning if my arduino fails and cannot supply voltage to the base dont want it to activate the other 24v device.

Wawa:
Do you know the value of the pull-down resistor.

An NPN transistor with emitter to ground, a 1k resistor between base and Arduino pin, and a 10k resistor between +24volt and collector might work.
Depending on the switch points of the 24volt logic.
Lower the value of the collector resistor to 1k if needed.
Leo..

Do I don't know that resistor value.

Are you talking about something like this

Yes.
The collector resistor pulls the 24volt logic high.
How high depends on the unknown internal resistor value.
This is passive pullup, and active pull-down (NPN transistor).

What you really need is active pull-up (PNP transistor), and passive pull-down.
Like the schematic in post #1
Or active pull-up and passive pull-down by the internal resistor of the 24volt logic (post#3).
Leo..

DrDiettrich:
Your circuit (emitter follower) won't work, because it can source only 0 to Vcc of the output pin :frowning:

Simple solution; use an photo coupler for the NPN transistor, and drive it by the digital output pin.

dlloyd:
Here's an example of a circuit for the excellent photo coupler suggestion by DrDiettrich:

I am not too sure what i should be looking for in a photo coupler. Will this one work?

http://www.ebay.com/itm/10pcs-PC817-PC817C-EL817C-LTV817-PC817-1-DIP-4-Optocoupler-Photocoupler-New-/360945472738

What data sheet values do I need to be concerned with?

The PC817 looks OK. If marked with PC817C or PC817D it will have a better transfer ratio. With 5mA through the LED, the transistor output will source or sink 10-20mA for the PC817C and 15-30mA for the PC817D. http://www.sharpsma.com/webfm_send/1835

To ensure a stronger collector signal, please change the 4.7K resistor to anything from 220Ω to 470Ω.

dlloyd:
The PC817 looks OK. If marked with PC817C or PC817D it will have a better transfer ratio. With 5mA through the LED, the transistor output will source or sink 10-20mA for the PC817C and 15-30mA for the PC817D. http://www.sharpsma.com/webfm_send/1835

To ensure a stronger collector signal, please change the 4.7K resistor to anything from 220Ω to 470Ω.

Okay I will buy the PC817C

Could you explain what is exactly ment by the Current transfer ratio (CTR: MIN.50% at IF =5mA, VCE=5V)?

Thanks for you help!

Current transfer ratio is similar to gain ... its the ratio (in percent) of the collector current / led current. If the CTR is 50% and you have 5mA through the LED, then the maximum current the collector can source/sink is 2.5mA (0.5 current gain).

The PC817C has 200-400% CTR. Current gain is 2-4.
The PC817D has 300-600% CTR. Current gain is 3-6.

dlloyd:
Current transfer ratio is similar to gain ... its the ratio (in percent) of the collector current / led current. If the CTR is 50% and you have 5mA through the LED, then the maximum current the collector can source/sink is 2.5mA (0.5 current gain).

The PC817C has 200-400% CTR. Current gain is 2-4.
The PC817D has 300-600% CTR. Current gain is 3-6.

Thank you for your help that makes sense. You have been great.

I have a device that runs on 24v DC and it uses 24 V logic.

What is the device? Just because it has a 24v power input does not mean that the logic runs at 24v!

I can't think of anything that uses 24v logic! If you give you device 24v on anything but its power input the odds are you will fry it!.

Mark

holmes4:
What is the device? Just because it has a 24v power input does not mean that the logic runs at 24v!

I can't think of anything that uses 24v logic! If you give you device 24v on anything but its power input the odds are you will fry it!.

Mark

Correction then the device runs on 220v 3 phase AC. Many large industrial machinery sensor use 24v DC logic.