megaxyu
Posts: 2
Joined: Mon Jun 22, 2015 7:28 pm

Re: how to trigger gpio pin with 24v

Tue Jun 23, 2015 2:19 pm

Thanks for the quick reply .

In case I do end up using an Octocoupler, should I fuse the incoming 24v ? The 24v is part of a PLC circuit with sensor inputs. The entire 24v circuit would be fused at around 3A, and there is a chance that one of these other input sensor cables may get damaged and get a short, in this case the fuse will usually blow but not damage the other inputs on the circuit. Will this still occur with the octocoupler or would this device be more sensitive. Should I fuse the incoming 24v to the octocoupler and if yes what size fuse would you recommend

ghp
Posts: 1420
Joined: Wed Jun 12, 2013 12:41 pm
Location: Stuttgart Germany
Contact: Website

Re: how to trigger gpio pin with 24v

Tue Jun 23, 2015 5:28 pm

Hello, an optocoupler is a device of prox 0.5€ value. You need a resistor too, of course. If something breaks down on 24V side, it will very unlikey affect the Raspberry side. "Isolation" is main purpose of these devices. And also the other way round, if the output side breaks, it will not affect the input from 24 V.
Regards,
Gerhard

gicolas
Posts: 2
Joined: Sun Feb 12, 2017 1:08 pm

Re: how to trigger gpio pin with 24v

Sun Feb 12, 2017 2:23 pm

Hi,

A question on this old post. Following the solution of @Tage (using optocoupler),
I am looking to convert 4 inputs to 3.3V
- the 4 inputs are from the same board which is either 12 or 24Vdc

Attached is the incomplete circuit based on tage suggestion and using a LTV-847 (4 channels instead of 4N28).

I have been reading the answer of @mahjongg using one Zener diode for all 4 inputs, but I don't understand how to connect it to all 4, considering the transistors.

Thank you for your help

Nicolas
Attachments
Universal Input.JPG
Universal Input.JPG (37.47 KiB) Viewed 1585 times

User avatar
mahjongg
Forum Moderator
Forum Moderator
Posts: 12410
Joined: Sun Mar 11, 2012 12:19 am
Location: South Holland, The Netherlands

Re: how to trigger gpio pin with 24v

Sun Feb 12, 2017 9:13 pm

its quite simple, the Zener simply acts like a voltage source, and you need just one such source for four constant current generators. As long as you connect the top of R6 to a constant 12V source, you need just one pair of R6 and zener, and can connect the bases of all 2N2222 transistors together to it. May I make a remark about your circuit, you have exchanged the emitter and collector, the emitter should be on the bottom side.

also if you insert the picture "in line" you can place

Code: Select all

[size=200][/size]
tags around the picture to enlarge it.

mastermushi
Posts: 37
Joined: Thu Apr 07, 2016 8:47 am

Re: how to trigger gpio pin with 24v

Wed Feb 15, 2017 12:40 pm

I have been doing the simillar project with DC36V, AC220V input and with 400V input from radiation sensor.

The very best soluton for <400V is to use optocoupler with current driver or simply a resistor.

Here is the typical "cheap" (resistor only) use of the optocoupler in the 220V schematics both on detecting and at the controlling branches of the project
sh1.jpg
sh1.jpg (33.61 KiB) Viewed 1544 times
Pull up voltage for RPI is 3.3V!!!!

gicolas
Posts: 2
Joined: Sun Feb 12, 2017 1:08 pm

Re: how to trigger gpio pin with 24v

Sat Feb 18, 2017 7:32 pm

Thank you Mahjongg and Mastermushi.
Here is my revised schematic following some advices on a different forum
(optocouplers not required since i have a common ground, can be replaced by Transistors)

Image

But now comes the issue of excessive heat from the transistors which go from 24Vac(34vdc) base to 3.3V on collector side.
Any suggestion, improvement? I am a beginner in electronics and struggle with that circuit for some time now.

Thank you in advance
Attachments
Schematic V2.JPG
Schematic V2.JPG (48.81 KiB) Viewed 1480 times

mastermushi
Posts: 37
Joined: Thu Apr 07, 2016 8:47 am

Re: how to trigger gpio pin with 24v

Tue Feb 21, 2017 3:14 pm

gicolas wrote:Thank you Mahjongg and Mastermushi.
Here is my revised schematic following some advices on a different forum
Thank you in advance
You have some errors.
In this kind of schematics please mind the transistor as the simple switch. Therefore you can write simple equivalent lines to detect those errors. For example: Your input transistor buffer equivalent is actually looks like:

Code: Select all

Ground --- [ 10 K ] --- Transistor (Switch) - [ 470 ] - |LED| --- VCC
And here you can see tht from Ground to LED you have total resistance of 10.470K
Therefore LED wont work.
What to do? Add +1 Transistor to each line. So 2n2222 with 10K will be the high impedance buffer and the second transistor is going to be the LED driver. The better practice is to spend three pins of the processor board to light those LEDs so you always know that software reacts on inputs.

And just for protocol: I have burned two RPIs with 36V inputs. The reason was simple: I have tried to use transistors, ignoring the best practice of optocoupler use. Do not take the risk!

Return to “Interfacing (DSI, CSI, I2C, etc.)”