# Translating digital inputs to analog voltage

#### Salomonander

Joined Mar 31, 2022
40
You guys helped me a great deal before…. So ill try again. Asking for help politely
i do have an installation that features around 16 fault signals. Meaning, if any of my 16 units have an error
the according channel switches 24v. Now im looking for a way to translate these digital signals to a voltage that indicates to me which unit is faulty. I have a gsm that allows me to check a 0-60v input on the go. So my idea was to find a way to translate the 16 inputs accordingly. Say unit #1 goes down gives 1V, unit #5 goes down gives 5V, unit #12 = 12V and so on. I dont mind if it works for more than 16 channels. But thats not a must.
Any idea how to go about this? My supply voltage is a single 24V line.

Thanks!

#### djsfantasi

Joined Apr 11, 2010
9,154
The circuit you’re looking for is a Resistor Ladder or an R-2R DAC (Digital to Analog Converter). It’s a simple arrangement of resistors which takes a digital output of several bits and produces an analog output.

Here’s an example of a 4 but digital to analog output circuit. You can search for R-2R DAC.

#### WBahn

Joined Mar 31, 2012
29,883
For 16 inputs, the resistors in an R-2R ladder are going to need to be extremely precise and there is going to have to be almost no noise. With sixteen bits, even with perfect components and zero noise, you need to resolve the signal to one part in 65,536, or 0.0015%. This also means that the noise must be considerably better than this, as well.

Your component tolerances, your supply voltages, and your input levels also have to be accurate to about that same level.

Worse, if you are off by just 1 LSB in your ADC conversion at the receiver, you could end up having incorrect data for all sixteen inputs (e.g., you read 1000 0000 0000 0000 but the transmitted value was 0111 1111 1111 1111).

#### WBahn

Joined Mar 31, 2012
29,883
You guys helped me a great deal before…. So ill try again. Asking for help politely
i do have an installation that features around 16 fault signals. Meaning, if any of my 16 units have an error
the according channel switches 24v. Now im looking for a way to translate these digital signals to a voltage that indicates to me which unit is faulty. I have a gsm that allows me to check a 0-60v input on the go. So my idea was to find a way to translate the 16 inputs accordingly. Say unit #1 goes down gives 1V, unit #5 goes down gives 5V, unit #12 = 12V and so on. I dont mind if it works for more than 16 channels. But thats not a must.
Any idea how to go about this? My supply voltage is a single 24V line.

Thanks!
Why are you considering encoding what is intrinsically digital information in an analog voltage value?

What alternatives have you considered?

What are the constraints you are working with?

#### metermannd

Joined Oct 25, 2020
343
What about putting voltage dividers on the inputs and using something like a CD4067?

#### WBahn

Joined Mar 31, 2012
29,883
What about putting voltage dividers on the inputs and using something like a CD4067?
Could you describe what you have in mind more clearly?

Where are the four control signals for the CD4067 coming from?

What is the purpose of the voltage dividers?

#### Ian0

Joined Aug 7, 2020
9,527
Do you need to know if more than one fault occurs simultaneously? Or would it be sufficient to know the highest priority fault?
It may be simpler and more accurate to send it as serial data.

#### WBahn

Joined Mar 31, 2012
29,883
How far apart are these units located (or, more to the point, how far apart are the points where your sixteen digital signals are located)?

Do they share a common, good quality ground reference?

Can all sixteen digital signals be brought to a single point, or are they scattered over a large area?

If you do choose to use an analog voltage, how will that signal get from wherever the digital information is available to wherever the point is that it will be measured?

What distance does this analog signal need to travel?

#### Salomonander

Joined Mar 31, 2022
40
Thanks guys, i was in bed already
an analog signal seemed appropriate as it would allow me to tell what went wrong on the go (gsm).
i can not buy another gsm unit - budget is tight and these are expensive.
my gsm has four digital inputs and two 0-60v inputs.
The analog value could only tell me one error at the time, but its better than nothing….

everything is very close to each other in the same switch cabinet. Cables can be as short as 30cm.

#### Ian0

Joined Aug 7, 2020
9,527
Connect the 16 fault outputs to the inputs of a pair of CD4532 priority encoders. That would give you four binary outputs which indicate the level of the highest priority fault.
You can make that into an analogue level with a R-2R ladder as @djsfantasi mentioned, or you could connect it to your four digital inputs.

#### Salomonander

Joined Mar 31, 2022
40
I could buy these units used for a reasonable price…. Maybe a viable solution?
Phoenix contact
i do not fully understand the manual though

#### metermannd

Joined Oct 25, 2020
343
Could you describe what you have in mind more clearly?

Where are the four control signals for the CD4067 coming from?

What is the purpose of the voltage dividers?
I went back and re-read the original post and doubt that my thought would fit OP's needs... but what had occurred to me was:

The voltage dividers was to reduce the 24V signals to a value that could be handled by a CMOS IC.

Since the 4067 looked like it could be used in either direction, my thought would be that a state change on any of the 16 inputs would cause that corresponding value to appear on the control lines. So, if #7 input was activated, the control lines would register 0111.

But that wouldn't be what OP wanted...

#### crutschow

Joined Mar 14, 2008
34,063
The most important question is, will you need to detect more than one fault at a time?

Detecting 16 different voltage levels is readily done.

Detecting 2^16 levels is a different story.
That could be more easily done by sequentially polling the signals with a 16-channel multiplexer.
Edit: A simple astable multivibrator can generate a slow clock pulse to drive a 4-bit binary counter and generate a sequential 4-bit address to the mux.
The gsm can (hopefully) read the 4-bit digital address along with the mux output to then determine which of the inputs is generating an error.
How fast do you need to detect an error signal?

Last edited:

#### crutschow

Joined Mar 14, 2008
34,063

#### Salomonander

Joined Mar 31, 2022
40
I am well prepared for it to only show one fault at a time. That would be ok. ill attach a copy of the phoenix contact manual. Resolution isnt great, but readable.
oh, and i do not think that my gsm can read any binary inputs. Its simple on/off commands only.
I do not fully understand how this device translates to 0-10v though

#### Attachments

• 1.3 MB Views: 17
Last edited:

#### Salomonander

Joined Mar 31, 2022
40
Here is a link to the GSM. I hope it works this time. if not, its a Phoenix Contact x200 gsm GSM

#### crutschow

Joined Mar 14, 2008
34,063
Okay, the GSM has 15-bit resolution over the 0-60V range which should give 1.8mV resolution.
So just add resistor dividers so that each of the 16 fault signals would give an easy-to-detect voltage value (e.g. 1V steps).

You stated the fault output switches 24V.
Do you know if the output is open-circuit or ground when there's not a fault, since that would make a difference in how the resistors are configured?

#### Salomonander

Joined Mar 31, 2022
40
They are simple switches attached to my Fuse/Rcd/Afdd combos. They have 1No and 1Nc contact. i was going to feed them with the same 24V Psu as the GSM unit. Here is a link to the fault switches:
Siemens 5ST3020
if i understand your question correctly they are open circuit. Off to bed. Thanks i appreciate the help!

#### WBahn

Joined Mar 31, 2012
29,883
Okay, the GSM has 15-bit resolution over the 0-60V range which should give 1.8mV resolution.
So just add resistor dividers so that each of the 16 fault signals would give an easy-to-detect voltage value (e.g. 1V steps).
How do you envision that working?

Let's say that Unit N delivers a voltage of N volts.

Which unit(s) have faults if the receiver gets a value of 22.009 V?

Is it just Unit #22?

Or could it be Units #10 and #12?

Or perhaps Units #1, 2, 3, 4, 5 and 7?

If you want to encode the fault status of all of the units onto a single voltage, then you need one voltage level for each of the 2^16 possible combinations of faults.

The receiver then has to be able to accurately and reliable distinction each of those 65536 different voltage levels in the presence of component tolerances, supply tolerances, and noise on the channel.

If the GSM only has 15 bits or resolution, then even if the components and other parameters are perfect, this fundamentally can't be done.

At the other end of the spectrum is to assign a time slot to each unit and then transmit each fault state using one of two voltage levels (say 10 V for good and 20 V for fault, or whatever) and transmit them sequentially. You can add framing information by having an additional time slot that is taken to a third level, say 5 V, between each set of sixteen data slots.

Or you can go with a reasonable mix of the two. For instance, group four units as a set and use a DAC to generate one of sixteen voltage levels for that set. Then you only need four time slots (plus the frame). You could use an 8-bit DAC and only have two data timeslots, but now you really need to start looking at the tolerances and noise since the receiver cannot make ANY errors in determining the correct binary value for the voltage level sensed.

#### kaindub

Joined Oct 28, 2019
120
Before you go too far I think this module is out of date. Most cell phone services have moved on from GPS.