Author Topic: sensor scale is half of ADC scale  (Read 5499 times)

0 Members and 1 Guest are viewing this topic.

Offline HugoPTTopic starter

  • Contributor
  • Posts: 15
  • Country: pt
sensor scale is half of ADC scale
« on: November 06, 2014, 11:15:49 pm »
Hello friends.I have a current sensor ACS712 that gives me an output voltage from 2.5 to 5V.This means that @ 2.5V there is 0 amps and @ 5V 30 amps.Since my adc goes from 0 to 5V if I connect it directly I will loose half of the scale from my adc which will result in loss of precision.My idea was using an opamp with a gain of 2 to double the voltage.My question is, can I offset those 2.5V if I create a ref voltage in the non-inverting input?
If yes how?
Thanks for your time
Hugo Santos
 

Offline nuno

  • Frequent Contributor
  • **
  • Posts: 606
  • Country: pt
Re: sensor scale is half of ADC scale
« Reply #1 on: November 06, 2014, 11:40:57 pm »
I think there's an unidirectional version of that chip (check Allegro), that's what you want.
 

Offline hamdi.tn

  • Frequent Contributor
  • **
  • Posts: 624
  • Country: tn
Re: sensor scale is half of ADC scale
« Reply #2 on: November 06, 2014, 11:46:53 pm »
i think if you put 2.5V in your µC VREF- if you have such option , you can get full scale ADC
Or put 5V in your ADC  input channel and the output sensor to VREF-, that way you don't have to add any voltage reference to your circuit, and your reading will be fullscale-adc_reading
« Last Edit: November 06, 2014, 11:50:36 pm by hamdi.tn »
 

Offline Rick Law

  • Super Contributor
  • ***
  • Posts: 3482
  • Country: us
Re: sensor scale is half of ADC scale
« Reply #3 on: November 07, 2014, 04:56:32 am »
i think if you put 2.5V in your µC VREF- if you have such option , you can get full scale ADC
Or put 5V in your ADC  input channel and the output sensor to VREF-, that way you don't have to add any voltage reference to your circuit, and your reading will be fullscale-adc_reading

The OP needs to measure 2.5V to 5V, not 0 to 2.5V.  So circuitry will have to be added to offset the 2.5V to shift the 2.5v to 5v down to 0V to 2.5V.

The question is whether one will add more error (with having to offset) than to accept the 1/2 scale of your ADC.  Unless you design the offset and 2x multiplication (or 2.5V reference) carefully, you would introduce far larger error than 1/2 resolution lost.

Say you are using an Arduino UNO (10 bit ADC), each count is 4mV for 5V scale.  Double the resolution would mean each count is 2mV.  Your x2 or -2.5V shift circuitry will need to be better than 2mV to keep your 2mV accuracy gain.   2mV accuracy circuit is no easy task.  Typical 1% components will get you +-25mV for 2.5V.   25mV error is 12X the resolution gain you would get if you are using 10bit ADC.  So, to decrease the ADC error from 4mV to 2mV, you added circuitry (1% components) that introduce a 25mV error?!

I suspect you are probably better off using the upper half of the ADC.  Think about it and see if what I just describe make sense to you.  Perhaps there are other factors I failed to include.

Rick
« Last Edit: November 07, 2014, 04:58:49 am by Rick Law »
 

Offline mikerj

  • Super Contributor
  • ***
  • Posts: 3327
  • Country: gb
Re: sensor scale is half of ADC scale
« Reply #4 on: November 07, 2014, 04:47:15 pm »
I think there's an unidirectional version of that chip (check Allegro), that's what you want.

ACS715 is a 30A unidirectional sensor, I have one on my desk in front of me :)

A simple inverting op-amp with a gain of -1 and the non-inverting input tied to 2.5v will do what the OP wants, but it will invert the slope i.e. zero current will be 2.5v, maximum scale will give 0v.  Obviously you need to think about the performance of the op-amp, input offset voltage and rail-rail output etc.
 

Offline hamdi.tn

  • Frequent Contributor
  • **
  • Posts: 624
  • Country: tn
Re: sensor scale is half of ADC scale
« Reply #5 on: November 07, 2014, 08:19:49 pm »
Am pretty much sure that you can have a full scale ADC without adding any thing or reducing precision just by using VREF- of you µC , i will test it as soon as i can, anyway , you can use a differential opamp and with a single amp you can add a x2 gain and subtract 2.5V offset. Use precision  R-R amp  ;)
 

Offline dannyf

  • Super Contributor
  • ***
  • Posts: 8221
  • Country: 00
Re: sensor scale is half of ADC scale
« Reply #6 on: November 07, 2014, 08:24:46 pm »
Quote
which will result in loss of precision.

No. It will result in loss of resolution, however.

Those things are not terribly accurate so I don't know why you even want to go through the trouble of debiasing it in hardware.

If I am concerned about errors caused by supply fluctuations, I would use a 2:1 divider on Vcc and use either two adc channels or a differential channel to null the bias.
================================
https://dannyelectronics.wordpress.com/
 

Offline Seekonk

  • Super Contributor
  • ***
  • Posts: 1962
  • Country: us
Re: sensor scale is half of ADC scale
« Reply #7 on: November 08, 2014, 11:23:50 am »
Assume this is a hobby app. If this is not time dependent,take a couple readings and add them together to get bigger numbers. Least bit is just noise anyway.  A couple samples will give you a useful number.  Order emerges out of chaos.   If you are set on doing this look at 715 data sheet, circuit #3.  The note says tested with a 712.
 

Offline Psi

  • Super Contributor
  • ***
  • Posts: 10229
  • Country: nz
Re: sensor scale is half of ADC scale
« Reply #8 on: November 08, 2014, 11:38:37 am »
Even the unidiretional version doesn't start at 0V. At zero amps its around 0.6V.
Greek letter 'Psi' (not Pounds per Square Inch)
 

Offline kxenos

  • Frequent Contributor
  • **
  • Posts: 284
  • Country: gr
Re: sensor scale is half of ADC scale
« Reply #9 on: November 08, 2014, 12:29:24 pm »
You need a difference amplifier:

V2 is your positive and V1 is your negative.
http://en.wikipedia.org/wiki/Operational_amplifier_applications
But you have to choose carefully for op-amp and resistors. As I believe you are not familiar with op-amps allow me to give you some hints:
The output of general purpose op-amps doesn't swing up to power supply voltage. If you need to get 5V output from a general purpose op-amp you will have to supply it from a greater voltage. Else you need a rail-to-rail op-amp which will swing to almost it's supply voltage minus 1-2mV. A way around this is to set Vref to 2.5V and make your signal swing 0 to 2.5V. Then you can use any op-amp you like.
Your total error should be less than half an LSB. For example if you have Vref=5V and 10 bits of resolution then it is 5/1024=4.88mV per LSB so your total error should be less than 2.44mV. That should include input voltage and current offset, bias current etc. To minimize these errors you should match resistors R1 with R2 and Rf with Rg. Try to run a simulation first.
Good luck
« Last Edit: November 08, 2014, 12:32:01 pm by kxenos »
 

Offline mboich

  • Contributor
  • Posts: 18
Re: sensor scale is half of ADC scale
« Reply #10 on: November 08, 2014, 03:14:31 pm »
The inverting op amp, as suggested above works great, but keep in mind that the input impedance is then R1, rather than the impedance of whatever ADC you're using. I ended up using a second opamp channel to buffer my sensor in a similar situation.
 

Offline Jeroen3

  • Super Contributor
  • ***
  • Posts: 4193
  • Country: nl
  • Embedded Engineer
    • jeroen3.nl
Re: sensor scale is half of ADC scale
« Reply #11 on: November 08, 2014, 03:27:18 pm »
Reverse the current sensor to set the range of the ACS from 2.5 V for 0A to 0 V for maximum current.
Then connect Vref to 2.5 V.

Please be aware of any limitation regargding Vref. Some chips do not allow Vref+ to be much lower than Vdd. And they will tell you not to connect Vref- to something 0.x volts above Vss.
« Last Edit: November 08, 2014, 03:29:27 pm by Jeroen3 »
 

Online nctnico

  • Super Contributor
  • ***
  • Posts: 28013
  • Country: nl
    • NCT Developments
Re: sensor scale is half of ADC scale
« Reply #12 on: November 08, 2014, 03:54:42 pm »
The inverting op amp, as suggested above works great, but keep in mind that the input impedance is then R1, rather than the impedance of whatever ADC you're using. I ended up using a second opamp channel to buffer my sensor in a similar situation.
Fortunately the Allegro current sensors usually require a minimum load of 4700 Ohm. Still I think it is easier to just use half the ADC scale and oversample 4 or 16 times to shape the noise into the extra bits. The current sensors are noisy enough for that. There are also versions which output the reference voltage. If that gets sampled as well with the same ADC you can take care of the offset in software.
There are small lies, big lies and then there is what is on the screen of your oscilloscope.
 

Online ejeffrey

  • Super Contributor
  • ***
  • Posts: 3907
  • Country: us
Re: sensor scale is half of ADC scale
« Reply #13 on: November 08, 2014, 05:03:49 pm »
If you want to keep the signal non-inverted, make a standard gain-2 non-inverting amplifier, but connect the ground resistor of the feedback network to +5V instead of to ground.  That will give you a gain of 2, but centered around 5V.  The standard caveats apply: offset and gain errors in the amplifier add to your error, and a 'rail-to-rail' opamp can't actually go to zero volts so you may have problems near zero signal.
 

Offline dannyf

  • Super Contributor
  • ***
  • Posts: 8221
  • Country: 00
Re: sensor scale is half of ADC scale
« Reply #14 on: November 08, 2014, 05:05:41 pm »
All this complexity is trying to solve a problem that doesn't exist.
================================
https://dannyelectronics.wordpress.com/
 

Offline Seekonk

  • Super Contributor
  • ***
  • Posts: 1962
  • Country: us
Re: sensor scale is half of ADC scale
« Reply #15 on: November 08, 2014, 08:23:26 pm »
DUH....The app note gives all the components to do exactly what he wants.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf