Author Topic: Interfacing 24VDC to 5VDC. How decent is my solution?  (Read 13991 times)

0 Members and 1 Guest are viewing this topic.

Offline 128erTopic starter

  • Regular Contributor
  • *
  • Posts: 229
  • Country: de
Interfacing 24VDC to 5VDC. How decent is my solution?
« on: April 24, 2015, 09:29:53 pm »
Hi,

for a small LED-signage project I need to handle 24VDC as input signals for a microcontroller. I come up with the circuit attached.

The current through the opto coupler should be around 10 mA. The zener is intended to provide a threshold. So that the input is only triggered above 18-19VDC.

I still have some doubts.

- Is it a total no-go to share the same ground between the high and low voltage side. Does it make the opto coupler completely obsolete? The 5V logic circuit is supplied directly with a linear regulator from the same 24VDC supply as the inputs. I think with a isolated DC/DC converter it would be much safer and easier to reach the goal. I assume without isolated DC/DC supply I have to take a lot of care to protect the logic circuit (e.g. in case of reversed polarity), if it is possible at all.

- In case of reversed polarity at the input, I have placed a diode antiparallel to the opto coupler. Would it be better to put the diode in series with the opto coupler? If the input voltage would be reversed in the circuit below, I would have to choose at least a >1W resistor for R10. With the diode in series and reversed polarity there would be no current flowing (except the leakage current) until the breakdown of the diode . And the diode drop would be negligible I think.

- Should I add more protection to the input? Maybe I will use this circuit in a industrial environment. Perhaps a Varistor with a reasonable threshold voltage would be good, also for the case that someone could accidently connect 230V mains to the input. But then I also have to choose a big resistor or a fuse to handle the energy which is present.

I get the feeling, that I do not come around an isolated DC to DC converter, to seperate all properly. From PLCs I know that they all have complete insulated inputs, therefore they always need a separate supply rail for the I/O modules.


Thank you all for sharing your knowledge!



 

Offline Mad ID

  • Regular Contributor
  • *
  • Posts: 167
  • Country: 00
Re: Interfacing 24VDC to 5VDC. How decent is my solution?
« Reply #1 on: April 24, 2015, 09:51:10 pm »
Hi.

I always put a diode in series for a circuit like this one to safeguard from reverse polarity.

Regarding the isolation, what is the point of isolation if both 24V and 5V are coming from the same source? There is no possibility of ground potential difference so this is good IMHO.

And for transients to be honest I'm note sure but all of my designs manufactured in thousands never returned because of opto-coupler input failure. Guess they are quite robust..
 

Offline paulie

  • Frequent Contributor
  • **
  • !
  • Posts: 849
  • Country: us
Re: Interfacing 24VDC to 5VDC. How decent is my solution?
« Reply #2 on: April 24, 2015, 11:26:23 pm »
The isolator, diodes, and pull-up resistor are irrelevant. All that's required is a simple resistor of such value as to not violate MCU input zener max current. Typically 2ma so a 100k or even 1m would be orders of magnitude safe for most MCUs. I suspect some internet "expert" will come along shortly to explain why this is dangerous or impossible and suggest a more complicated/expensive solution.
 

Offline retrolefty

  • Super Contributor
  • ***
  • Posts: 1648
  • Country: us
  • measurement changes behavior
Re: Interfacing 24VDC to 5VDC. How decent is my solution?
« Reply #3 on: April 25, 2015, 12:45:09 am »
The isolator, diodes, and pull-up resistor are irrelevant. All that's required is a simple resistor of such value as to not violate MCU input zener max current. Typically 2ma so a 100k or even 1m would be orders of magnitude safe for most MCUs. I suspect some internet "expert" will come along shortly to explain why this is dangerous or impossible and suggest a more complicated/expensive solution.

 Indeed I've seen a AVR application note showing how one could connect a 120vac hot lead to a digital input pin through a high ohm resistor for typical zero crossing detection applications. But i think they did note that it might have electrical code compliance issues.  :)
 

Offline Seekonk

  • Super Contributor
  • ***
  • Posts: 1938
  • Country: us
Re: Interfacing 24VDC to 5VDC. How decent is my solution?
« Reply #4 on: April 25, 2015, 12:53:39 am »
A LED is just a diode and for 30 years I have never found one with less than 170V reverse breakdown. -5V has been stuck in data sheets forever.
 

Offline paulie

  • Frequent Contributor
  • **
  • !
  • Posts: 849
  • Country: us
Re: Interfacing 24VDC to 5VDC. How decent is my solution?
« Reply #5 on: April 25, 2015, 01:06:15 am »
Awwww... you guys are no fun at ALL!
 

Offline Richard Crowley

  • Super Contributor
  • ***
  • Posts: 4317
  • Country: us
  • KJ7YLK
Re: Interfacing 24VDC to 5VDC. How decent is my solution?
« Reply #6 on: April 25, 2015, 01:26:04 am »
Huh?  If "The 5V logic circuit is supplied directly with a linear regulator from the same 24VDC supply as the inputs." then why do you even need an opto-isolator at all?

If you want to use the "industry standard" solution:  http://www.opto22.com/site/pr_details.aspx?cid=4&item=IDC5

 

Offline David_AVD

  • Super Contributor
  • ***
  • Posts: 2806
  • Country: au
Re: Interfacing 24VDC to 5VDC. How decent is my solution?
« Reply #7 on: April 25, 2015, 06:57:48 am »
If isolation is not a requirement, an NPN transistor with pullup (like the output of the opto) will do.

The base of the transistor would have a series resistor (and zener for a higher threshold) as well as a resistor from base to 0V.
 

Offline Mad ID

  • Regular Contributor
  • *
  • Posts: 167
  • Country: 00
Re: Interfacing 24VDC to 5VDC. How decent is my solution?
« Reply #8 on: April 25, 2015, 07:10:40 am »
If isolation is not a requirement, an NPN transistor with pullup (like the output of the opto) will do.

The base of the transistor would have a series resistor (and zener for a higher threshold) as well as a resistor from base to 0V.

Isn't the optocoupler solution more robust in the case the cable is long and prone to noise pickup? With optocoupler circuit a 10mA current has to flow to trigger the input...with other suggested solution low noise current can switch the input?
 

Offline ciccio

  • Frequent Contributor
  • **
  • Posts: 659
  • Country: it
  • Designing analog audio since 1977
    • Oberon Electrophysics
Re: Interfacing 24VDC to 5VDC. How decent is my solution?
« Reply #9 on: April 25, 2015, 07:40:56 am »
A LED is just a diode and for 30 years I have never found one with less than 170V reverse breakdown. -5V has been stuck in data sheets forever.
I too believed this, but discovered that BLUE high efficiency LEDs did not like 30 V reversed DC...even with a 10 kohm series resistor. They break. All of them.  A simple 1N4148 in antiparallel solved the issue.
In the same board, GREEN LEDs did not have the same problem. They took the reverse voltage without problems.

Best regards
Strenua Nos Exercet Inertia
I'm old enough, I don't repeat mistakes.
I always invent new ones
 

Offline Mad ID

  • Regular Contributor
  • *
  • Posts: 167
  • Country: 00
Re: Interfacing 24VDC to 5VDC. How decent is my solution?
« Reply #10 on: April 25, 2015, 07:53:59 am »
I too believed this, but discovered that BLUE high efficiency LEDs did not like 30 V reversed DC...even with a 10 kohm series resistor. They break. All of them.  A simple 1N4148 in antiparallel solved the issue.
In the same board, GREEN LEDs did not have the same problem. They took the reverse voltage without problems.
Best regards

Why do they die if current is limited with 10kR?
 

Online Zero999

  • Super Contributor
  • ***
  • Posts: 19491
  • Country: gb
  • 0999
Re: Interfacing 24VDC to 5VDC. How decent is my solution?
« Reply #11 on: April 25, 2015, 08:01:31 am »
A LED is just a diode and for 30 years I have never found one with less than 170V reverse breakdown. -5V has been stuck in data sheets forever.
You must be joking.

The reverse breakdown for most LEDs is around the 20V to 30V range. Red LEDs tend not to be damaged by reverse breakdown which is why you can just connect them with a suitable series resistor to the mains but the more modern blue and green LEDs tend to be more sensitive and can be easily damaged by reverse breakdown.
 

Offline Kjelt

  • Super Contributor
  • ***
  • Posts: 6460
  • Country: nl
Re: Interfacing 24VDC to 5VDC. How decent is my solution?
« Reply #12 on: April 25, 2015, 08:12:58 am »
- Is it a total no-go to share the same ground between the high and low voltage side. Does it make the opto coupler completely obsolete? The 5V logic circuit is supplied directly with a linear regulator from the same 24VDC supply as the inputs.

So where does this 24Vdc imput come from, from some other industral control board, a sensor? How long are the lines between the external device and your input.

If the cables are long and the environment is noisy the ground voltage could be at the point of return on the input be different from your local ground and feeding it back you could create ground loop problems as often in av equipment that is more sensitive. But even a digital circuit can at some point have ground current problems.
So normally you would use a two wired cable with 24Vdc out and the matching return 24Vdc-gnd and isolate those from the local ground .
That is why you would use an opto. If you have no noise, short cables clean environment skip the opto as suggested. Perhaps we need some more detailed info on the exact ( industrial) application.
 

Offline ciccio

  • Frequent Contributor
  • **
  • Posts: 659
  • Country: it
  • Designing analog audio since 1977
    • Oberon Electrophysics
Re: Interfacing 24VDC to 5VDC. How decent is my solution?
« Reply #13 on: April 25, 2015, 12:21:04 pm »
I too believed this, but discovered that BLUE high efficiency LEDs did not like 30 V reversed DC...even with a 10 kohm series resistor. They break. All of them.  A simple 1N4148 in antiparallel solved the issue.
In the same board, GREEN LEDs did not have the same problem. They took the reverse voltage without problems.
Best regards

Why do they die if current is limited with 10kR?
Direct current was limited by 10 kohm, and they worked.. When the voltage was reversed they died, even if the 10 k resistor was there. Amen.. RIP
Strenua Nos Exercet Inertia
I'm old enough, I don't repeat mistakes.
I always invent new ones
 

Offline SeanB

  • Super Contributor
  • ***
  • Posts: 16276
  • Country: za
Re: Interfacing 24VDC to 5VDC. How decent is my solution?
« Reply #14 on: April 25, 2015, 12:39:04 pm »
Not surprising, look at how close they are to burning out with forward current, then look at the power dissipation at reverse breakdown with the same current flow.
 

Offline NiHaoMike

  • Super Contributor
  • ***
  • Posts: 9007
  • Country: us
  • "Don't turn it on - Take it apart!"
    • Facebook Page
Re: Interfacing 24VDC to 5VDC. How decent is my solution?
« Reply #15 on: April 25, 2015, 05:42:10 pm »
The isolator, diodes, and pull-up resistor are irrelevant. All that's required is a simple resistor of such value as to not violate MCU input zener max current. Typically 2ma so a 100k or even 1m would be orders of magnitude safe for most MCUs. I suspect some internet "expert" will come along shortly to explain why this is dangerous or impossible and suggest a more complicated/expensive solution.

 Indeed I've seen a AVR application note showing how one could connect a 120vac hot lead to a digital input pin through a high ohm resistor for typical zero crossing detection applications. But i think they did note that it might have electrical code compliance issues.  :)
The key is to use multiple resistors in series in order to get enough voltage rating. I have used that approach in multiple projects of my own and have seen it used a lot in various UPSes.
Cryptocurrency has taught me to love math and at the same time be baffled by it.

Cryptocurrency lesson 0: Altcoins and Bitcoin are not the same thing.
 

Online Zero999

  • Super Contributor
  • ***
  • Posts: 19491
  • Country: gb
  • 0999
Re: Interfacing 24VDC to 5VDC. How decent is my solution?
« Reply #16 on: April 25, 2015, 06:27:59 pm »
The isolator, diodes, and pull-up resistor are irrelevant. All that's required is a simple resistor of such value as to not violate MCU input zener max current. Typically 2ma so a 100k or even 1m would be orders of magnitude safe for most MCUs. I suspect some internet "expert" will come along shortly to explain why this is dangerous or impossible and suggest a more complicated/expensive solution.

 Indeed I've seen a AVR application note showing how one could connect a 120vac hot lead to a digital input pin through a high ohm resistor for typical zero crossing detection applications. But i think they did note that it might have electrical code compliance issues.  :)
The key is to use multiple resistors in series in order to get enough voltage rating. I have used that approach in multiple projects of my own and have seen it used a lot in various UPSes.
Whether it complies with the regulations depends on whether the microcontroller's power supply is SELV or FELV, i.e. whether it's sufficiently insulated from the user.
 

Offline retrolefty

  • Super Contributor
  • ***
  • Posts: 1648
  • Country: us
  • measurement changes behavior
Re: Interfacing 24VDC to 5VDC. How decent is my solution?
« Reply #17 on: April 25, 2015, 07:02:07 pm »
Quote
Why do they die if current is limited with 10kR?

Because the failure mechanism is different for the two different cases. In forward current, max heat dissipation is the destructive force. In reverse it's a junction puncture failure.

 

Online Zero999

  • Super Contributor
  • ***
  • Posts: 19491
  • Country: gb
  • 0999
Re: Interfacing 24VDC to 5VDC. How decent is my solution?
« Reply #18 on: April 25, 2015, 08:01:27 pm »
It depends on whether the LED's junction is actually punctured by over voltage or not, some just act like zener diodes and tolerate it quite well, others die.

Anyway, back on topic: if isolation isn't required, a potential divider is probably best. Of course, a single high value resistor will do but the threshold will still be low which will make it more susceptible to noise.
 

Online langwadt

  • Super Contributor
  • ***
  • Posts: 4414
  • Country: dk
Re: Interfacing 24VDC to 5VDC. How decent is my solution?
« Reply #19 on: April 25, 2015, 08:24:27 pm »
The isolator, diodes, and pull-up resistor are irrelevant. All that's required is a simple resistor of such value as to not violate MCU input zener max current. Typically 2ma so a 100k or even 1m would be orders of magnitude safe for most MCUs. I suspect some internet "expert" will come along shortly to explain why this is dangerous or impossible and suggest a more complicated/expensive solution.

yes it will work just fine but the input protection diode is usually not a zener, it is diodes to ground and supply
and there is the caveat, you must be sure to always use more current than is injected in the supply via the protection diodes





 
 

Offline paulie

  • Frequent Contributor
  • **
  • !
  • Posts: 849
  • Country: us
Re: Interfacing 24VDC to 5VDC. How decent is my solution?
« Reply #20 on: April 25, 2015, 08:31:39 pm »
Yes, pretty much what I said.

Anyway, what's up with all this "just use a resistor" stuff? I recall some years back suggesting that instead of expensive Maxim/Analog level converters would cause instant troll accusations and post reported for safety violation. Ahhhh... those were the days...
 

Offline Richard Crowley

  • Super Contributor
  • ***
  • Posts: 4317
  • Country: us
  • KJ7YLK
Re: Interfacing 24VDC to 5VDC. How decent is my solution?
« Reply #21 on: April 25, 2015, 09:24:32 pm »
It depends on the situation. If you are designing some completely isolated system that can run "hot-chassis" (i.e. directly powered from the mains without isolation) then indeed simply using a high value (~1M) resistor directly into the Atmel pin is even a technique features in Atmel Application Note AVR-182.  q.v.

http://www.atmel.com/images/doc2508.pdf
Note particularly Fig. 1 on page 2 and the associated description.
 

Offline David_AVD

  • Super Contributor
  • ***
  • Posts: 2806
  • Country: au
Re: Interfacing 24VDC to 5VDC. How decent is my solution?
« Reply #22 on: April 25, 2015, 10:24:14 pm »
If isolation is not a requirement, an NPN transistor with pullup (like the output of the opto) will do.

The base of the transistor would have a series resistor (and zener for a higher threshold) as well as a resistor from base to 0V.

Isn't the optocoupler solution more robust in the case the cable is long and prone to noise pickup? With optocoupler circuit a 10mA current has to flow to trigger the input...with other suggested solution low noise current can switch the input?

You can adjust the resistors to change the sensitivity but yes, there are times where an opto may be more appropriate.  I've used both methods many times over the years.

Using a plain resistive divider can be an issue where the micro may not be powered up when an input signal is applied.
« Last Edit: April 25, 2015, 10:27:41 pm by David_AVD »
 

Offline 128erTopic starter

  • Regular Contributor
  • *
  • Posts: 229
  • Country: de
Re: Interfacing 24VDC to 5VDC. How decent is my solution?
« Reply #23 on: April 25, 2015, 11:59:43 pm »
Thanks for your input so far. Here are some more informations in which application this should be used.

Often I need indication lights with very individual messages, to show different conditions of machines or product test systems. Very popular are these modular signal towers, where you can stack up different lights. They are very good for mounting them on top of switching cabinets. They shine 360° and are clearly visible from distance. And you can attach plates of acrylic glass to label them. But they quickly become quite large and impractical for close distance applications.

Like this for example:
http://www.tpautomation.de/shop/images/product_images/popup_images/8WD4408-0FA_2.jpg

Overall size is, height: 500 mm, width: 200mm

And to use HMI panels or some other type of display for this, would be total overkill.

My goal is, to build a base unit with a small footprint, for which I can print individualized signs for the specific task. LEDs will act as a backlight to shine through the front cover. So I can make reasonable sized illuminated signs. For the first step I want to make a version with three LED modules, which I can independently control via 24VDC inputs. Or depending on the task, I could switch all three modules with a single input and use it as one big display. This functions should be adjustable by some DIP or rotary code switches.

Let me know if there still exist a nice solution, or my idea is totaly dumb. Before I reinvent the wheel.  ::)

Regarding to the environment where this will be used . . .

In almost all cases there will be a 3-phase VFD or inverter for DC motors in the same switching cabinet from what my device will be powered and controlled. Or big thyristor power controllers for high temperature furnaces. I expect, that in most cases the cable that provides power and input signals is not longer than 20-30 m.

I began to draw a schematic, but at the moment I have issues to export it from Eagle. But I have attached a picture how the thing could look like.

« Last Edit: April 27, 2015, 01:46:58 pm by 128er »
 

Offline ciccio

  • Frequent Contributor
  • **
  • Posts: 659
  • Country: it
  • Designing analog audio since 1977
    • Oberon Electrophysics
Re: Interfacing 24VDC to 5VDC. How decent is my solution?
« Reply #24 on: April 26, 2015, 08:32:14 pm »
Not surprising, look at how close they are to burning out with forward current, then look at the power dissipation at reverse breakdown with the same current flow.
Excuse me, I do not understand your point: direct current is limited at about 3 mA, dissipation is in the order of milli Watts.
Strenua Nos Exercet Inertia
I'm old enough, I don't repeat mistakes.
I always invent new ones
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf