Getting full analog resolution readings from 10-30V high voltage sensor output

I have a sensor that gives out readings of between 0 - 10V and I want to be able to map this entire 0 - 10V into the 0 - 1023 range for analog readings on the Arduino. This is important as I need the full resolution of the 0 - 10V as my application requires a very high accuracy for the sensor reading. The sensor I am using is a high grade industrial quality type.

The normal way would be to use a voltage divider circuit to break the high voltage into smaller voltages so that the Arduino can safely read it within a 0 - 5V range. The problem with this approach is that you lose the full resolution of the high voltage sensor output.

To illustrate:- lets say you have a 0 - 30V sensor output range. Using the normal approach, you would use 6 resistors in series , say 10K ohms each, to break the 30 V into six 5-volt readings across each resistor, but you would only connect the reading across the first resistor which will be 0 - 5V into the analog read of the Arduino. But by using this method, you are effectively reducing the resolution of the sensor by six times.

I have attached an image of what I am trying to accomplish for a sensor output range of 0 - 10V. Is there a means of mapping the 5 - 10V range across the second resistor into a 0 - 5V range safe for the Arduino?

I have searched Google and this Arduino forum but wasn’t able to find a solution. A solution would be useful to the community for people who want to use such sensitive sensors with a high voltage output reading and needing to get full resolution. Any tips would be appreciated.

roto2.png

lohjianhui:
The normal way would be to use a voltage divider circuit to break the high voltage into smaller voltages so that the Arduino can safely read it within a 0 - 5V range. The problem with this approach is that you lose the full resolution of the high voltage sensor output.

To illustrate:- lets say you have a 0 - 30V sensor output range. Using the normal approach, you would use 6 resistors in series , say 10K ohms each, to break the 30 V into six 5-volt readings across each resistor, but you would only connect the reading across the first resistor which will be 0 - 5V into the analog read of the Arduino. But by using this method, you are effectively reducing the resolution of the sensor by six times.

Really? How do you figure?
50% of 30V full-scale is 15V; 50% of 5V full-scale is 2.5V.
What's your point?
Is it "6 resistors"? If you used two resistors 25K and 5K, would it be different?

0-10V with a voltage divider gives you a resolution of 10V/1023 or about 10mV.

0-30V with a voltage divider gives you a resolution of about 30mV.

If you want more resolution you need an ADC with more than 10 bits of resolution.

You could use auto-ranging (variable attenuation, variable amplification, or a variable reference) to get higher resolution at lower signal voltages, but you'll still have the same resolution at the high-end of the range.

For example, with the optional 1.1V reference and no attenuation (no voltage divider) you can get resolution of about 1mV with inputs of 1V or less.

You could also build some sort to auto-ranging circuit that uses a summing amplifier (op-amp) that subtracts a known voltage. That could give you high resolution at higher signal levels. But, that would get tricky and analog noise and tolerances might make the true resolution worse.

not sure I follow the loss or resolution.

if your primary sensor is connected to a sensor that can read 0 to 15,000 pecks
the AI is 10 bit, so

15000/1024 = 14.6484375 pecks that is your calculated reading per step for the 10bit AI

at 30 volts, the step change would be 0.029296875 volts per step, for 14.6484375 pecks per step.

at 5 volts, the step change wold be 0.0048828125 volts per step for 14.6484375 pecks per step.

if you want a higher resolution, the best way is to design a good circuit. circuit noise can destroy readings faster than higher resolution can resolve them.

all things being equal in the circuit, use a higher bit count A/D converter. the teensy has a higher res one built in. 13 bit resolution available.. IIRC.

Hi, with your diagram, you have an arduino analog input more than 5V above gnd ref.
This is not within spec.
You will kill the input.
The answer is an external ADC with more bits.
Tom.... :slight_smile:

lohjianhui wrote:

my application requires a very high accuracy for the sensor reading

Then forget using an Arduino with its 10 bit ADC.

Tom, his diagram is ok from what I can see, and is really the basis behind his question, how to divide the input sensor signal to a range the Arduino input can take, though his approach is unorthodox and is more complex than simply using a ADC that is correct for the job.

There are many high quality ADC's available that you can either get as I2C or SPI that you can then communicate to, that will have much better performance, which is what you are really wanting.

Be prepared to design a good circuit and PCB to avoid noise and other EMI.
Also, think about your input impedance and how far the sensor will be from the ADC input.

I'll stress again, forget using the ADC in the Arduino if you want high accuracy, stability and good resolution.


Paul

Use this:

The 34401A. It has RS-232 so you can use the arduino to read it.

For $1200 all your measurement worries are over.

rockwallaby:
lohjianhui wrote: Then forget using an Arduino with its 10 bit ADC.

Tom, his diagram is ok from what I can see, and is really the basis behind his question, how to divide the input sensor signal to a range the Arduino input can take, though his approach is unorthodox and is more complex than simply using a ADC that is correct for the job.


Paul

??
A1 input will see more than 5V, since gnd doesn't change !
If he wanted it to work, he would have to switch gnd from O V to 5V for values > 5V ... a little tricky :wink:

Specify what resolution you need and what range you need it over.

alnath wrote:

A1 input will see more than 5V, since gnd doesn't change !
If he wanted it to work, he would have to switch gnd from O V to 5V for values > 5V ... a little tricky

Take another look at the diagram and you will see cleary he specifies two analog outputs, each with a range of 0Volts to 5Volts, which is quite ok to push into an Arduino.

His trickery lies in the module where he will need to do a DC offset to shift the 5V to 10V component down.

Like I said, this is the wrong method and overly complex and the software will be a nightmare for him to get right.


Paul

rockwallaby:
His trickery lies in the module where he will need to do a DC offset to shift the 5V to 10V component down.

a-ha !
6 resistors in the voltage divider, each has a 5 volt drop across each one.
putting that 4 volt drop into 6 AI pins would allow one to see the same change 6 times over and then since any error would be present in each at the same time, all the time, summing would not be needed.
taking HALF of the reading into one AI pin and the other half into a second AI pin would always have one at zero of 5v while the other was active. that means looking at the output and taking everything from 0-15 volts and converting it to 0-10 volts, but then only read 0-5 volts, effectively making the AI only see half of the value. the lower half.

while this is ranging from 0-5 ( or 0-10) the other input would be at zero because the level has not risen into the upper half of the output range.

once the process does pass that mid-point, the first AI pin will be maxed out and the second will start to see a value, this being the second half of the range. then this second one would only see from half on up to the maximum.

sounds like one could create a pair of instrument op-amps, create a zero and span adjustment to get these two values into the AI pins.

all one needs to do is to sum the two AO pins.

when the process is less than half, the upper range will see zero. all the activity will be less than half of the full scale.

when the process does pass that mid-way point, the first range will be saturated and all the reading will be in the second half. so, just adding 1024 to the second range would make the math work out easily.

Since the OP did not ask if it was a good way, or a smart way to do this, we should not judge.

it would allow for a level of accuracy that was twice the normal one-pin input and only require some external parts to make the two instrument op-amps in order to make the ranges.

rockwallaby:
and the software will be a nightmare for him to get right.


Paul

AI-0 will be 0 to half the process.
AI-1 will be half the process to the full process
VALUE = AI-0 + AI-1
this will add the lower value to 0 whenever the range is in the lower half of the output.
it will add 1024 to the value whenever the process is above half the value.
seems like the math is simple and straightforward.

dave-in-nj wrote:

it would allow for a level of accuracy that was twice the normal one-pin input and only require some external parts to make the two instrument op-amps in order to make the ranges.

For only a doubling of raw ADC counts, I certainly don't see the point of trying to make this work, so from 1024 to 2048 counts, when you can go out and buy a 12 or 16bit ADC that give far greater resolution.

Having a 'switch over' point is like trying to bias the transistors in a class 'A' amplifier, where you will suffer non-linearity around that point due to design around the switch point.
So, around the mid-point of input signal, you will get jitter, how do you account for that in the code?

In an ideal circuit, it is fine, but in the real world, you will have problems.

Also, the internal ADC in the Arduino needs calibration as the analog reference is not anywhere near accurate, and the OP did state he wants 'very high accuracy'.

Yes, if you were skilled in op-amps and analog concepts in general, then you can make such a circuit work, but I believe the OP does not have these skills, or he would not have asked the question.

Yes, the math you show is how it might look, but with all the other problems that will most likely appear, the code to compensate will become complex very quickly, thereby blowing away any accuracy you were initially after.


Paul

If you want more resolution you need an ADC with more than 10 bits of resolution.

AMEN.

ADS1115

FYI,
Don’t forget to read this:

// Adafruit_ADS1115 ads;  /* Use this for the 16-bit version */
Adafruit_ADS1015 ads;     /* Use thi for the 12-bit version */

Note: the default code is for the 12-bit version. You need to comment that out and uncomment the 16-bit
code statement.

P.S.- Do the math. 216 = 65536
65535/30V= 2184 counts per volt = 2.184 counts per mV

dave-in-nj:
a-ha !
6 resistors in the voltage divider, each has a 5 volt drop across each one.
putting that 4 volt drop into 6 AI pins would allow one to see the same change 6 times over and then since any error would be present in each at the same time, all the time, summing would not be needed.
taking HALF of the reading into one AI pin and the other half into a second AI pin would always have one at zero of 5v while the other was active. that means looking at the output and taking everything from 0-15 volts and converting it to 0-10 volts, but then only read 0-5 volts, effectively making the AI only see half of the value. the lower half.

while this is ranging from 0-5 ( or 0-10) the other input would be at zero because the level has not risen into the upper half of the output range.

once the process does pass that mid-point, the first AI pin will be maxed out and the second will start to see a value, this being the second half of the range. then this second one would only see from half on up to the maximum.

sounds like one could create a pair of instrument op-amps, create a zero and span adjustment to get these two values into the AI pins.

all one needs to do is to sum the two AO pins.

when the process is less than half, the upper range will see zero. all the activity will be less than half of the full scale.

when the process does pass that mid-way point, the first range will be saturated and all the reading will be in the second half. so, just adding 1024 to the second range would make the math work out easily.

Since the OP did not ask if it was a good way, or a smart way to do this, we should not judge.

it would allow for a level of accuracy that was twice the normal one-pin input and only require some external parts to make the two instrument op-amps in order to make the ranges.

I agree with you, ( I would have agreed with Racschemel, but someone already that that today and I think it is going to his head, ... that whole once a year thing going on there)
but, the OP did not ask if it would be smart or easy, He did not ask for the the simplest way to get a higher accuracy, at low cost with minimal programming.
You are correct in pointing out that one would have to take cautionary steps to make sure the slopes of the two instrument op-amps were aligned, or the calibration to make sure there was neither an overlap, nor a gap at the transition point.
it is very possible that the OP wants 6 'ranges' in an effort to get a higher resolution. and that is what we are really discussing, resolution, not accuracy. and in that aspect, I believe the OP has resolution confused with accuracy.
Also, I have come across more than a few posters that have no funds and a $20 teensy with it's 16 bit ADC is beyond their means.
lastly, someone with such a specific question is most likely trying to do a homework assignment and they have to answer the questions.
especially when there are two posts of almost the exact same question, phrased in different ways on the same day.

@Dave,
I agree with you :wink: (it's homework)

Forum guidelines should be such that students who ask questions relating to their home work or assignment work, are requested to state this in their title or in their first paragraph.

I have seen many posts of students, apparently in their last year of studies who seemingly are depending on us to asnwer their questions in a rush for them to be awarded a degree in their electronics or engineering course.

I have no interest in providing assistance for their whole assignment question to their project work, as this form of help generally doesn't expand the students mind.

I don't believe many students who ask full assignment qustions do enough research to begin with.
The possible explanations could be that they can't be bothered or are in too much of a rush, with bad time management or simply haven't developed enough skills with online research, any of which look poorly on that student.


Paul

hi everyone,

I am the OP for this thread. I am appreciative of all your replies and the feedback has been constructive. I am not an expert on electronics, analogue circuits and op-amps although I have some basic electrical engineering background. I have a better understanding of my problem now - my approach is wrong. I appreciate the advice on op-amps and analog circuits but it is beyond my understanding for now. I will try using a higher resolution ADC as suggested in a few of the posts in this thread.

Just to assuage your concerns about being a student - no I am not a student. This is for a real world commercial interactive installation. I work as a creative technologist for a creative agency and have been tasked with improving the design for a sensor. The sensor is a laser range finder that measures up to a distance of 6m. The software application for this needs to know the distance in millimeter accuracy so 1023 bits of resolution does not quite cut it for the resolution. So thats some contextual background for the OP in this thread.

Once again, thanks everyone for your replies. Have a merry Christmas!

I was under the impression that most distance sensors were time based ?
the pulse sent, count time, note difference, calculate distance. if that is the case, you have a much more accurate pirmary sensor in a digital format than you will get in an analog value.

if your sensor is only availability in an analog output, check in to the teensy. very similar to the Arduino, but with a high resolution ADC built in and very cost effective.

Thank you for the clarification lohjianhui, I appreciate it.

Dave, yep, spot on, I would look at a sensor that provides a digital comms link rather than analog output.
But, maybe the laser range finder is already in situ and lohjianhui is stuck with using the analog signal from it, in which case, the suggestion of Teensy is worthwhile checking into.


Paul