Author Topic: 24 volt input to microprocessor  (Read 7802 times)

0 Members and 1 Guest are viewing this topic.

Offline deadlockTopic starter

  • Contributor
  • Posts: 12
24 volt input to microprocessor
« on: October 24, 2014, 06:49:18 am »
I am working on a device that will need to detect a 24 volt digital signal from a very old system.
It is either 0v or 24v and I want to know which it is.

How can I safely wire up the signal to a microcontroller without frying it and to protect if for long time use?

1) Should I use a digital or adc input?
2) I have seen simple voltage divider solutions that is supposed to handle this but I don't know if this is good enough and I would also prefer for this to work on a large range of voltages so for example:
0v-0.5v = zero
>0.5v - 50v = one
Don't know if that is easily achievable

Any ideas or references appreciated
 

Offline Rerouter

  • Super Contributor
  • ***
  • Posts: 4694
  • Country: au
  • Question Everything... Except This Statement
Re: 24 volt input to microprocessor
« Reply #1 on: October 24, 2014, 07:07:09 am »
Digital input, with a resistor divider and a zener to clamp it to a level that is safe for the micro, e.g. 100K from the signal to the micro input, 27K from the micro input to ground, and a 4.7V zener in parrellel with the 27K resistor
 

Offline krish2487

  • Frequent Contributor
  • **
  • Posts: 500
  • Country: dk
Re: 24 volt input to microprocessor
« Reply #2 on: October 24, 2014, 07:25:45 am »
Or, if you have the feasibility. resistor divider network -> schmitt trigger (powered with 5V) -> digital input of the MCU.

surely a 1$ IC can replace a $0.10 zener!!!
 >:D
If god made us in his image,
and we are this stupid
then....
 

Offline richard.cs

  • Super Contributor
  • ***
  • Posts: 1191
  • Country: gb
  • Electronics engineer from Southampton, UK.
    • Random stuff I've built (mostly non-electronic and fairly dated).
Re: 24 volt input to microprocessor
« Reply #3 on: October 24, 2014, 08:14:06 am »
Or a high value series resistor and a small schottky clamping the input to the microcontrollers VCC, typically cheaper than a zener and works with less current, you just have to make sure there's never so little load on the supply rail that the input can push it up. Making the diode a schottky means the microcontrollers internal input diodes never conduct, you could use just a resistor (relying on the internal clamping diodes) and get away with it most of the time but it's a bit ugly and the injected charge can mess up the analogue inputs and the timers.
 

Online tggzzz

  • Super Contributor
  • ***
  • Posts: 19497
  • Country: gb
  • Numbers, not adjectives
    • Having fun doing more, with less
Re: 24 volt input to microprocessor
« Reply #4 on: October 24, 2014, 01:34:17 pm »
You would be wise to verify that (1) there are no large common-mode voltages between the two circuits (2) earthing/grounding considerations aren't relevant (3) it is 24V without large spikes.

There are solutions to all those potential problems, but from your description it is not possible to determine whether they might be relevant.
There are lies, damned lies, statistics - and ADC/DAC specs.
Glider pilot's aphorism: "there is no substitute for span". Retort: "There is a substitute: skill+imagination. But you can buy span".
Having fun doing more, with less
 

Offline Richard Crowley

  • Super Contributor
  • ***
  • Posts: 4317
  • Country: us
  • KJ7YLK
Re: 24 volt input to microprocessor
« Reply #5 on: October 24, 2014, 01:49:20 pm »
Perhaps I am more conservative than the rest of you, but I would use an opto-isolator to protect the (rather delicate) microcontroller circuit and chip from the unknown hazards of the "very old system".

Proper industrial systems make extensive use of optical-isolated input and output modules.  "Opto22" is a very popular vendor of this kind of protection.  They make modules for DC input, AC input, DC output, and AC output from microcontroller logic levels.



 

Online tggzzz

  • Super Contributor
  • ***
  • Posts: 19497
  • Country: gb
  • Numbers, not adjectives
    • Having fun doing more, with less
Re: 24 volt input to microprocessor
« Reply #6 on: October 24, 2014, 01:53:11 pm »
Perhaps I am more conservative than the rest of you, but I would use an opto-isolator to protect the (rather delicate) microcontroller circuit and chip from the unknown hazards of the "very old system".

Very true. Analog Devices makes some new higher speed fully isolated interfaces, and I'm sure other manufacturers do the same. But in this case an opto isolator is probably more appropriate.
There are lies, damned lies, statistics - and ADC/DAC specs.
Glider pilot's aphorism: "there is no substitute for span". Retort: "There is a substitute: skill+imagination. But you can buy span".
Having fun doing more, with less
 

Offline dannyf

  • Super Contributor
  • ***
  • Posts: 8221
  • Country: 00
Re: 24 volt input to microprocessor
« Reply #7 on: October 24, 2014, 02:37:24 pm »
I would put a resistor on the input and call it a day. The size depends on the current drop but 2ma or 10k or plus would work.
================================
https://dannyelectronics.wordpress.com/
 

Offline Seekonk

  • Super Contributor
  • ***
  • Posts: 1938
  • Country: us
Re: 24 volt input to microprocessor
« Reply #8 on: October 24, 2014, 02:39:28 pm »
>0.5v - 50v = one

How set are you on that voltage?  You could use a simple opto isolator.  That has a LED on the input and a transistor on the output.  Use a high value resistor on the pull up and you could easily accomplish 2V to 50V on the input.  And that would give you electrical isolation. 
 

Offline motocoder

  • Supporter
  • ****
  • Posts: 769
  • Country: us
  • Electrical Engineer
Re: 24 volt input to microprocessor
« Reply #9 on: October 24, 2014, 09:41:52 pm »
Perhaps I am more conservative than the rest of you, but I would use an opto-isolator to protect the (rather delicate) microcontroller circuit and chip from the unknown hazards of the "very old system".

This is the solution that I would use as well (assuming the input signal is not something faster than an opto-isolator can handle).
 

Offline Rufus

  • Super Contributor
  • ***
  • Posts: 2095
Re: 24 volt input to microprocessor
« Reply #10 on: October 24, 2014, 11:08:01 pm »
Proper industrial systems make extensive use of optical-isolated input and output modules.  "Opto22" is a very popular vendor of this kind of protection.  They make modules for DC input, AC input, DC output, and AC output from microcontroller logic levels.

They are ridiculously large and expensive for simple DC inputs. I have used them but only because they allowed the same board to be easily customized for combinations of AC/DC Input/Output.
 

Offline TonyStewart

  • Contributor
  • Posts: 44
  • Country: ca
  • just another carbon life form
Re: 24 volt input to microprocessor
« Reply #11 on: October 25, 2014, 03:24:21 am »
If this design considers a low voltage unimportant, OK but >0.5v - 50v = one would require a gain of 4 and clip to Vcc to detect this logic level.

It would be much more logical to relax the requirement to match the digital input threshold of 0=<0.8, 1=>2V and in between is maybe, which is often 2 diode drops or 1.3V for the threshold.  Then with 100K feed the logic input with a schottky diode clamp to Vcc inparallel with the built-in ones. or leave-out

In reality, all you need with ESD clamp diodes is a 100k series resistor
Tony Stewart EE in bleeding edge R&D, TE and Mfg since 1975.
 

Offline calzap

  • Frequent Contributor
  • **
  • Posts: 448
  • Country: us
Re: 24 volt input to microprocessor
« Reply #12 on: October 25, 2014, 03:42:31 am »
The frequency and current capacity of the 24 V source wasn't stated.  If it's not too frequent and has sufficient current, the old school solution of a relay might work and would provide excellent isolation. 24 V relays are plentiful.

Mike in California
 

Offline Macbeth

  • Super Contributor
  • ***
  • Posts: 2571
  • Country: gb
Re: 24 volt input to microprocessor
« Reply #13 on: October 25, 2014, 03:58:26 am »
The frequency and current capacity of the 24 V source wasn't stated.  If it's not too frequent and has sufficient current, the old school solution of a relay might work and would provide excellent isolation. 24 V relays are plentiful.

Mike in California
Urghh! That makes me want to spew! - He just needs a signal to a micro. A frikkin' relay is insane. The opto-isolator is belt and braces and I would go for that in a few off's. A simple pair of resistors would do the job adequately too if you were to mass produce at a cost.

A relay? for a signal?  :-//
 

Offline Richard Crowley

  • Super Contributor
  • ***
  • Posts: 4317
  • Country: us
  • KJ7YLK
Re: 24 volt input to microprocessor
« Reply #14 on: October 25, 2014, 04:29:55 am »
Urghh! That makes me want to spew! - He just needs a signal to a micro. A frikkin' relay is insane. The opto-isolator is belt and braces and I would go for that in a few off's. A simple pair of resistors would do the job adequately too if you were to mass produce at a cost.

You seem to be making very critical assumptions about the "very old system" (such as ground referencing, noise tolerance, life-safety criticality, etc.) that could well prove fatal to the microcontroller circuit with a simplistic interface circuit.
 

Online tggzzz

  • Super Contributor
  • ***
  • Posts: 19497
  • Country: gb
  • Numbers, not adjectives
    • Having fun doing more, with less
Re: 24 volt input to microprocessor
« Reply #15 on: October 25, 2014, 12:49:35 pm »
Urghh! That makes me want to spew! - He just needs a signal to a micro. A frikkin' relay is insane. The opto-isolator is belt and braces and I would go for that in a few off's. A simple pair of resistors would do the job adequately too if you were to mass produce at a cost.

A relay? for a signal?  :-//

Yes, for many signals a relay will be the optimum solution  - particularly for underspecified signals in an unspecified environment.

There may be cheaper simple alternatives - in a smaller number of circumstances.

Depending on the environment, "a simple pair of resistors" might be literally lethal. Or not. You don't have enough information to answer that question.
There are lies, damned lies, statistics - and ADC/DAC specs.
Glider pilot's aphorism: "there is no substitute for span". Retort: "There is a substitute: skill+imagination. But you can buy span".
Having fun doing more, with less
 

Offline Tandy

  • Frequent Contributor
  • **
  • Posts: 372
  • Country: gb
  • Darren Grant from Tandy, UK.
    • Tandy
Re: 24 volt input to microprocessor
« Reply #16 on: October 25, 2014, 01:32:43 pm »
I would suggest using an optoisolator, connect the input LED to your 24V circuit, connect the optocoupler output to the microprocessor. No danger of having unwanted higher voltages on your low voltage circuit.
For more info on Tandy try these links Tandy History EEVBlog Thread & Official Tandy Website
 

Offline Zero999

  • Super Contributor
  • ***
  • Posts: 19520
  • Country: gb
  • 0999
Re: 24 volt input to microprocessor
« Reply #17 on: October 25, 2014, 10:32:54 pm »
The problem with the relay could be the higher coil current and you need one with gold plated contacts for small currents.

An opto-isolator is probably the safest and easiest solution.

A single resistor could work but as others have stated, it could cause problems if the 0V rails aren't well connected.
 

Offline TonyStewart

  • Contributor
  • Posts: 44
  • Country: ca
  • just another carbon life form
Re: 24 volt input to microprocessor
« Reply #18 on: October 27, 2014, 03:47:34 am »
If this design considers a low voltage unimportant, OK but >0.5v - 50v = one would require a gain of 4 and clip to Vcc to detect this logic level.

It would be much more logical to relax the requirement to match the digital input threshold of 0=<0.8, 1=>2V and in between is maybe, which is often 2 diode drops or 1.3V for the threshold.  Then with 100K feed the logic input with a schottky diode clamp to Vcc inparallel with the built-in ones. or leave-out

In reality, all you need with ESD clamp diodes is a 100k series resistor

24V         100k -/\/\/\--    Schmitt Logic input
                                    ||
                              10K//0.01uF
                                    ||
24VReturn-  1K -/\/\/\--    3.5VReturn
Tony Stewart EE in bleeding edge R&D, TE and Mfg since 1975.
 

Online tggzzz

  • Super Contributor
  • ***
  • Posts: 19497
  • Country: gb
  • Numbers, not adjectives
    • Having fun doing more, with less
Re: 24 volt input to microprocessor
« Reply #19 on: October 27, 2014, 09:14:34 am »
The problem with the relay could be the higher coil current and you need one with gold plated contacts for small currents.

An opto-isolator is probably the safest and easiest solution.

A single resistor could work but as others have stated, it could cause problems if the 0V rails aren't well connected.

Firstly, and importantly, you are have omitted the limited context in which that statement was made.

Secondly it can be argued in either direction (without knowledge of the operating environment and objectives), for example...

The problem with optoisolator could be the sensitivity to reverse voltage spikes or overcurrent spikes, or temperature range, or high speed response transmitting a noisy signal.

A relay is probably the safest and easiest solution.

For the avoidance of doubt, I don't believe "a relay is probably the safest and easeist solution" any more than I believe "an optocoupler is probably the safest and easiest solution". The system context and objectives are needed to discriminate between the two.
There are lies, damned lies, statistics - and ADC/DAC specs.
Glider pilot's aphorism: "there is no substitute for span". Retort: "There is a substitute: skill+imagination. But you can buy span".
Having fun doing more, with less
 

Offline Rudolfo

  • Contributor
  • Posts: 30
Re: 24 volt input to microprocessor
« Reply #20 on: October 27, 2014, 09:51:00 pm »
24V input can easy be handled by the iC-JX IO-port, or see http://www.ichaus.de/wp1_mcu_interface for interfacing to 24V industrial world.
 

Offline TonyStewart

  • Contributor
  • Posts: 44
  • Country: ca
  • just another carbon life form
Re: 24 volt input to microprocessor
« Reply #21 on: October 27, 2014, 09:55:46 pm »
  • FWIW, Telecom Relays are gold plated and also known as (AKA) <2A contact rating.
  • Power Relays >=2A will eventually fail unless wetted with cap dump or 10% contact rating.
  • then we have sealed reed relays.

But I prefer low EMI, well designed  direct simple solutions for low cost, low failure mode, no Murphy's Law from inductive transients.
« Last Edit: October 27, 2014, 09:58:29 pm by TonyStewart »
Tony Stewart EE in bleeding edge R&D, TE and Mfg since 1975.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf