Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

[SOLVED] ACS712 to PIC ADC, need to offset and scale the ADC input

Status
Not open for further replies.

Jetstream

Newbie level 4
Joined
Apr 4, 2017
Messages
5
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
57
Hi Guys,

I need to sense DC current of a 300vdc power rail. The amps to be sensed are in the range of 0-10A.

I currently have a ACS712ELCTR-20A-T hooked up to a PIC and can measure the output no problem. At 0amps I can read 2.5v at the adc and the voltage swings as the current changes, no problem there.

The problem I have is that I'm stuck with the ACS712 due to availability/logisitics etc...
and I want to make better use of the PIC's ADC by doing the following:

1) Instead of 2.5v (adc) = 0 amps, I want 0v (adc) = 0 amps.

2) I also want to stretch the range of the ACS712 so that 0v (adc) = 0 amps and 5v (adc) = 15 amps.

I want to do this using only a +5vdc supply, not a +/- bipolar supply.

I was thinking that an opamp circuit using a MCP602 might do the trick in a scale and offset type circuit, but I can't get it to work right.

Any ideas on how to implement this function?

Regards,
JetStream
 

Mapping 0A to 0V isn't reasonable because it possibly cuts current near zero and doesn't allow software zero adjustment. Did you notice unipolar sensor families like ACS713 which have a zero offset of 0.5 or 0.6V?

Scaling and zero-shifting the sensor output is nevertheless possible with a single OP in differential amplifier configuration.
 

1) Instead of 2.5v (adc) = 0 amps, I want 0v (adc) = 0 amps.

2) I also want to stretch the range of the ACS712 so that 0v (adc) = 0 amps and 5v (adc) = 15 amps.

I want to do this using only a +5vdc supply, not a +/- bipolar supply.

so, if you want to measure only Positive Current , and not negative (reverse way)
you can use an AOP for that ..
i did **broken link removed** with an rail to rail AOP TLC271

i also used MCP6S22 programmable AOP for LM35DZ sensor scale amplification.
it needs somme initialisation before to use.

is MCP602 programmable ?
 

Hi,

a simple difference amplifier circuit could be used to shift the zero value.
Instead of using an LM35 I recommend to use ADC_Ref. This needs less parts and the zero value doesn´t drift.
(At least way less than with two Refs)

Klaus
 

..Instead of using an LM35 I recommend to use ADC_Ref. ...


in my pplication, LM35DZ is used as TEMPERATURE SENSOR. (no Vref) independant measure
using internal +Vref 1,024V..
I use a Device T092 4040 4.1 as + Vref for PIC ADC, connected to RA3 input =external +Vref
bcause Internal +4.096 PIC ref can't deliver egnouh current..
To power up ACS712 supply with this same +4.096V reference
so independant from +VCC Fluctuations. and less zero drift

and easiest to convert ADC value 4096 mV <-> 1024 pts
 

Hello all,

Firstly, thanks for taking the time to reply to my post.

FvM:
----
I ideally wanted the ACS715LLCTR-20A-T but availability is beyond samples seems to be difficult.

paulfjujo:
----------
AOP??

I'll look into the MCP6s22 and see if it will do the job.

No the MCP602 isn't programmable, just something we have on the shelf.

Klaus ST:
---------
I had considered a differnce amp but struggled to get the results I was hoping for and I did use the TI reference guide on scale and offset circuitry mention by Okada.

The point of using the Vref in the PIC is nice idea though.

Okada:
------
I had used the TI doc you mentioned, but as I had replied to KlausST's post, I didn't get the results I hoped for. I'll revisit it an see if I missed something.


Overall, I think you guys are pointing me in the direction I had originally gone down.
What I'll do is revisit the circuit design and see where I had gone wrong and post back with my results if I'm still stuck.
 

Hi,

if you need help, then show us your difference amplifier.
(It´s just an OPAMP with 2 x 2 equal resistors. Maybe you need to modify it somehow. Let´s see)


Klaus
 

Hi Klaus,

Here's what I have so far:

The circuit:


The graph of what I want:



The trendline of the is only accurate for both the blue flat line and slope. The slope itself described by Y=2.5x-6.25. I need the circuit to implement the slope.

At the mometn the circuit output doesn't generate anything even close to the slope section when I use m=2.5, c=-6.25.

JetStream
 

hello

i sppose V1 is ACS712 output 2,5 *12 / (12+0,768) = 2,34V

Why V3=1,5V , not 2,5V ?
to remove 2,5V offset of ACS712
 

Hi,

The circuit in post#9 is no true difference amplifier circuit.

Again: look for "difference amplifier circuit"
You will find a circuit with an opamp and four resistors.
It has two input nodes, one output_reference node and one output.

Klaus
 

Hi Klaus,

Did the necessary digging and found the circuit you were referring to, then cranked the formula for it:



I had used the spare op amp in the MCP602 to provide a voltage reference and these were my results:



I think, other than the slight curve at the lower end of the slope, it is exactly what I want!

Cheers buddy!
JetStream
 

The problem with post #9 was that the claimed transfer curve didn't fit the actual operation of the inverting amplifier. Apparently you had confused two different circuits. Nevertheless can the intended function implemented with a single OP, if you want.

A disadvantage of the implemented "ideal" transfer function Vout = 2*(Vsensor - 2.5) is that the actual sensor zero point may be outside the observable ADC voltage range and a zero calibration isn't feasible without input signal. You better shift the zero point above ADC zero so that actual sensor offset can be easily adjusted.
 

Hi,

Now the circuit is correct. Well done.

I don't call it "reference".
A reference is meant to be stable, but you use Vcc, which is not stable.
It will drift with time, it will drift with temperature and it will drift with VCC current.
Therefore you will see a lot of offset errors you can't compensate.

In case you have a stable and clean true 5V reference voltage, then you could simplfy your circuit:
Don't use the first Opamp, just replace R1 with two 20k resistors, one to GND, the other to Vref.

The two resistors act as if they are in parallel and give a source impedance of 10k. And it acts as a voltage divider and gives 2.5V.

Klaus
 

In case you have a stable and clean true 5V reference voltage, then you could simplfy your circuit:
Don't use the first Opamp, just replace R1 with two 20k resistors, one to GND, the other to Vref.
ACS712 zero is specified at Vcc/2, no matter if supply voltage is stable or not. Using Vcc/2 as "reference" is thus correct in any case. Subtracting "stable" 2.5V reference from unstable Vcc/2 zero sensor output would introduce an additional error term.

Nevertheless my suggestion about shifting the sensor zero inside the ADC range holds.
 

Hi Klaus & FvM,

Sorry for not replying earlier, just come back from hols.

Yes I agree with your point FvM about offsetting, I'll consider what level of adjustment after stress testing the design.

Both, you wish I can mark this thread as solved.

BR,
JetStream
 

Hi,

You are the OP. If you are satisfied with the solution, then just push the "mark as solved" button.

Klaus
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top