Sense voltage while isolating MCU ADC port

Thread Starter

Goxeman

Joined Feb 28, 2017
176
±15% is the ratio of the current in the two photodiodes. There is no feedback that can correct it. The only way to deal with it would be a preset, but who wants to have to calibrate every input (the TS said there were many)?
From the diagram in Post #13 there appears to be no need for isolation. The TVS won't work too well at 3.3V, I would suggest schottky diodes to V+ and V-.
If there is a possibility of two different 0V connections then a differential amplifier would deal with it, as I suggested back in post #4, but if there is no possibility of different 0V connections, then the Post #13 circuit is OK.
I have just one ground

I could just use a 3,3V TVS, but why do you suggest two Shottky diodes instead of bidirectional TVS?
 

Thread Starter

Goxeman

Joined Feb 28, 2017
176
It is common practice to add Span and Zero adjustment controls to this type of device, not only to correct the Transfer value, but the tolerances etc in the other components.

I have used a fair number of these devices on practical commercial applications with minimum problems.

BYW: @Goxeman
I would not have the Load Switch disconnecting the ADC input at that point in the circuit
Where would you suggest it and why? Before the voltage divider? It’s easier (and cheaper) to find a load switch that works at a range between 1V and 5V rather than 6V and 40V
 

Thread Starter

Goxeman

Joined Feb 28, 2017
176
Hi @goxman,
When you say a number of Voltages sources to measure, what are the sources of the voltages and layout and distances etc from your measuring point.?

E
As I initially said this a new project but i would like to be able to use it in different applications like solar batteries, machine control or cars
 

Ian0

Joined Aug 7, 2020
13,155
I have just one ground

I could just use a 3,3V TVS, but why do you suggest two Shottky diodes instead of bidirectional TVS?
If there is only one ground then there is no need to isolate anything.

A TVS is a Zener. Low voltage zeners are great for guitar distortion effects but rubbish for almost anything else.
At 3.3V it is already conducting 200uA. 1mA will go through your sense resistors, so it will be 20% out.
The 3.3V TVS doesn't really conduct fully until it gets to 7.3V by which time your processor is dead,

Using Schottkies will dissipate any fault current into the power supply, but won't upset the readings because it will not conduct until the input voltage is lower than -0.3V or above 3.6V, but it will conduct before the processor protection diodes conduct.

If you are not in a hurry to do the measuements, then you could use 390k and 33k, (but put a capacitor across the 33k to lower the impedance the ADC sees). Then the current would be limited to a level that the processor protection diodes can easily deal with.
 

ericgibbs

Joined Jan 29, 2010
21,452
Hi G,
Sounds an interesting idea, but extra care will be required in ground returns and noise when used alongside machine control.
E


Update: if you follow the above suggestion, of 390k & 33k, check the linearity of the ADC signal input as approaches the 3V level when using Schottky diodes.

EG57_ 990.png
 
Last edited:

ericgibbs

Joined Jan 29, 2010
21,452
hi G,
Having a rough idea of your possible applications, it is possible that in many cases you will not be sure of the scaling of the user's source voltage input, so you should make provision for adjusting the span and zero, before the ADC input.
You don't want to keep modifying your MCU code to suit the particular voltage input.

E
 

Thread Starter

Goxeman

Joined Feb 28, 2017
176
If there is only one ground then there is no need to isolate anything.

A TVS is a Zener. Low voltage zeners are great for guitar distortion effects but rubbish for almost anything else.
At 3.3V it is already conducting 200uA. 1mA will go through your sense resistors, so it will be 20% out.
The 3.3V TVS doesn't really conduct fully until it gets to 7.3V by which time your processor is dead,

Using Schottkies will dissipate any fault current into the power supply, but won't upset the readings because it will not conduct until the input voltage is lower than -0.3V or above 3.6V, but it will conduct before the processor protection diodes conduct.

If you are not in a hurry to do the measuements, then you could use 390k and 33k, (but put a capacitor across the 33k to lower the impedance the ADC sees). Then the current would be limited to a level that the processor protection diodes can easily deal with.
Thanks for the advices, I will specially take in account about the Zener, you convinced me ;) The suggested resistor values would totally work, so you would have rather higher resistor values?

Thanks
 

Thread Starter

Goxeman

Joined Feb 28, 2017
176
hi G,
Having a rough idea of your possible applications, it is possible that in many cases you will not be sure of the scaling of the user's source voltage input, so you should make provision for adjusting the span and zero, before the ADC input.
You don't want to keep modifying your MCU code to suit the particular voltage input.

E
I dont understand what do you mean with the adjusting the span and zero. Do you mean like calibration of the system? I made a relation between the output voltage of the resistor divider and the input voltage for different input voltages.

In a previous post, you said that you wouldnt use the load switch to disconnect the ADC at that point but I cant see the drawback.
 

Ian0

Joined Aug 7, 2020
13,155
The suggested resistor values would totally work, so you would have rather higher resistor values?

Thanks
Two contradictory points.
1. Increasing the resistances in the potential divider reduces the possible fault current that would go through the processor protection diode.
2. The ADC needs a low source impedance if it is to sample quickly.
A capacitor across the lower resistor would ensure the low source impedance, but would limit the frequency you can measure.
If the voltage you are measuring doesn't change much, then that isn't a problem, and a bit of filtering would help remove all sorts of interference and noise.
 

ericgibbs

Joined Jan 29, 2010
21,452
I dont understand what do you mean with the adjusting the span and zero. Do you mean like calibration of the system? I made a relation between the output voltage of the resistor divider and the input voltage for different input voltages.

In a previous post, you said that you wouldnt use the load switch to disconnect the ADC at that point but I cant see the drawback.
Hi @Goxeman

Span means adjusting/setting the overall gain of the circuitry between the ADC source voltage input and the voltage you need to read at the MCU's ADC input.
A simple example would be, the source voltage range was from 0v to 2v which represented say 0 kg to 10 kg.
To get the maximum resolution from the ADC you would add gain to the 2V signal so that the ADC input would read 0v to 3.3v, which would give a ADC count of 0 through 1024 for a 10Bit ADC.
To achieve this 0v through 3.3v, considering the variable parameters of the system, you would add a variable potentiometer for the Gain setting.

Zero means the that the ADC voltage may not range from 0v to say 2v, but 0.5v to 2.5v, so to get the ADC input voltage to range from 0v to 2.0v a variable potentiometer would be used to offset the 0.5v to 0V. [ the Gain pot would then be adjusted to give 0v through 3.3v.


Note the limited range of your basic resistive divider, you are not getting the full range of ADC input voltage.
If you don't want to use an opto-coupler, consider as simple OPA circuit for the Span and Zero.

It is considered bad practice to leave a high input impedance disconnected 'floating'


Hope this covers your queries

E

The advantage is that your ADC would always operate over the full range and the program could be standardised
 

Ian0

Joined Aug 7, 2020
13,155
This will calculate the optimum resistances. it gives me 2k and 180Ω for a 40V input, which you can scale to 20k/1.8k or 200k/1.8k.

What is the switch for? @ericgibbs is perfectly correct that you should not leave the input floating.
 

Thread Starter

Goxeman

Joined Feb 28, 2017
176
This will calculate the optimum resistances. it gives me 2k and 180Ω for a 40V input, which you can scale to 20k/1.8k or 200k/1.8k.

What is the switch for? @ericgibbs is perfectly correct that you should not leave the input floating.
I thought that I could have the possibility to limit the time of the ADC exposed to a potential failure. I would enable or disable it with another pin of the MCU to take the measures when I want

What is the issue of leaving it floating? For wrong readings?
 

Thread Starter

Goxeman

Joined Feb 28, 2017
176
Hi @Goxeman

Span means adjusting/setting the overall gain of the circuitry between the ADC source voltage input and the voltage you need to read at the MCU's ADC input.
A simple example would be, the source voltage range was from 0v to 2v which represented say 0 kg to 10 kg.
To get the maximum resolution from the ADC you would add gain to the 2V signal so that the ADC input would read 0v to 3.3v, which would give a ADC count of 0 through 1024 for a 10Bit ADC.
To achieve this 0v through 3.3v, considering the variable parameters of the system, you would add a variable potentiometer for the Gain setting.

Zero means the that the ADC voltage may not range from 0v to say 2v, but 0.5v to 2.5v, so to get the ADC input voltage to range from 0v to 2.0v a variable potentiometer would be used to offset the 0.5v to 0V. [ the Gain pot would then be adjusted to give 0v through 3.3v.


Note the limited range of your basic resistive divider, you are not getting the full range of ADC input voltage.
If you don't want to use an opto-coupler, consider as simple OPA circuit for the Span and Zero.

It is considered bad practice to leave a high input impedance disconnected 'floating'


Hope this covers your queries

E

The advantage is that your ADC would always operate over the full range and the program could be standardised
Understood. Your proposal is to add a potentiometer to adjust let’s say, the max and min values. Id prefer doing everything through software though

I thought of the limited resolution of my measures due to the range I have to operate with the output of the resistor divider.

I understand there is no perfect solution
 

Thread Starter

Goxeman

Joined Feb 28, 2017
176
Hi G,
How many of these devices are you making and what MCU are you using.?
E
Hi Eric,

Im doing tests with a STM32.

How many devices will I make it’s a tough question to answer. Initially I will like to make 200-300 units and see how it goes
 

Ian0

Joined Aug 7, 2020
13,155
Initially I will like to make 200-300 units and see how it goes
Then you certainly don't want to have to calibrate each one!

I think it will be well enough protected with two schottky diodes and a high-value resistor that you won't need to isolate it.
 

ericgibbs

Joined Jan 29, 2010
21,452
Morning Gox,
Interesting project, my only concern is that you will be required to use your device with many unknown voltage sources.
Which could mean you would have to modify your MCU program, possibly on site of the user, which means possible coding and calibration.

If you could standardize your input conditioning circuit, say to give 0V through 3.3V, it, which will increase the resolution of the measurements, this would make the MCU re-coding easier.
E

Update: @Goxeman
Perhaps if you posted a couple of examples where your device would be installed and used by a client.?

Added: ESD protection PDF, may help with your project.
 

Attachments

Last edited:

Ian0

Joined Aug 7, 2020
13,155
Which type of A/D are you using on the STM32?
If you have the 16-bit delta-sigma, it is probably accurate enough for you to design for the maximum possible input voltage, but still have enough resolution to measure lower voltages with enough accuracy. What percentage accuracy do you need?
The accuracy also depends on the reference you are using - if it is the 3.3V supply then it's only as accurate as your voltage regulator - LP2951 is ±1% but 7833 is nowhere near that good!
1% is only 7-bit accuracy.
 

Thread Starter

Goxeman

Joined Feb 28, 2017
176
Morning Gox,
Interesting project, my only concern is that you will be required to use your device with many unknown voltage sources.
Which could mean you would have to modify your MCU program, possibly on site of the user, which means possible coding and calibration.

If you could standardize your input conditioning circuit, say to give 0V through 3.3V, it, which will increase the resolution of the measurements, this would make the MCU re-coding easier.
E

Update: @Goxeman
Perhaps if you posted a couple of examples where your device would be installed and used by a client.?

Added: ESD protection PDF, may help with your project.
Thanks E!!!!

Its interesting all the different environments that ST shows as examples. Figure 17, on page 14, shows the example of the protection of the ADC:
- What is the use of C1, is that capacitor acting a filter too?
- Why using R3 before C2? I understand that C2 is meant to reduce the impedance
 
Last edited:

Ian0

Joined Aug 7, 2020
13,155
A low impedance is necessary to drive the ADC, and that is provided by the op-amp. There is no need for a low impedance at the op-amp input.
Don’t use the circuit in Fig.17 - it is wrong. It looks as though it is meant to be a Sallen and Key filter, but C2 is in the wrong place (should be between R4 and the op-amp). As shown, it will almost certainly oscillate.
 
Top