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.
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.
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?
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..
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..
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)?
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.