4

I'm trying to sense a current that will flow in a motor (current shouldn't exceed 2Amps), and I'd like to have a high resolution on this measurement. I was hoping on using the ACS712, but it says the precision is 185mV/A. Since the current in my applicaiton won't exceed 2A, it means 185*2 = 370mV (right?)

I'm using a STM32F4 with 12bit ADC which means with a Vref of 3.3V it's an increment each 0.8mV. So in the end I'll get a resolution of 463 steps.

Is there a way to get a higher resolution ? I don't really like the idea of a shunt resistor, maybe an amplificator could do the trick but will I be able to get a precise measurement ? enter image description here (iA is the measurement)

Btw, I'm trying to replace it with an ACS711 which operates on 3.3V but it'll give me only 110mV/A resolution

Here's the Vref+/- connection enter image description here

nairyo
  • 160
  • 2
  • 11
  • If you want good quality measurements, use the MCU's internal bandgap voltage reference instead of 3.3v as the reference; the 3.3v rail may have 5-10% error as well as noise, swamping any gains from a high quality shunt monitor. – Nick Johnson Jun 03 '15 at 08:15
  • So you're saying having an op-amp + shunt resistor is the way to go ? – nairyo Jun 03 '15 at 08:36
  • I wasn't saying anything about your sensing solution, just that you shouldn't use the 3.3v rail as your reference voltage on the ADC. – Nick Johnson Jun 03 '15 at 08:38
  • Sorry, misundertood your comment. What rail should I be using ? The 3.3 comes out of a TL1963 1.5A – nairyo Jun 03 '15 at 08:41
  • 1
    He's saying that you shouldn't use any rail directly for the reference voltage. If you want to use a 3,3V reference you can use the 3,3V rail but you should low pass filter it (a capacitor from the ref pin to ground, and a resistor from the cap to 3,3V). In your case you do not want 3,3V but something closer to 400mV as a reference for the ADC. You can use a resistive divider to get a lower voltage from 3,3, or use the more precise bandgap reference integrated in the microcontroller. – jms Jun 03 '15 at 08:59
  • I added the connection diagram of my Vref+/-. So I should make a voltage divider with a lp filter to make the Vref about 500mV ( so in order to get a good resolution for my current sensor?) – nairyo Jun 03 '15 at 09:08
  • 1
    You can still use that 3.3V to power the MCU, but you should use a reference voltage to define the upper limit for the ADC. Your ADC already has a built-in reference you can use. Its voltage is much more precise, giving more accurate measurements. And due to the 2.5V, the resolution is better in your case. May be, your MCU allows an external voltage reference for its ADC, then you could use something like an AD680 with a 5:1 voltage divider to set the upper voltage for the ADC to 500mV. – sweber Jun 03 '15 at 09:09
  • Yes, that will remove the need for an amplifier. Edit: I do not see an imput for an external reference voltage in your answer. No, running the microcontroller at a lower voltage is not the best way to increase ADC sensitivity. – jms Jun 03 '15 at 09:13
  • The STM32F401CEU6 UFQFPN48 won't allow me to change the Vref because it's connected to Vdda. So op-amp it is I guess – nairyo Jun 03 '15 at 09:16
  • 1
    The MCU you're using has an embedded bandgap reference voltage which you can use - no need for an opamp. – Nick Johnson Jun 03 '15 at 09:40

3 Answers3

7

Most micro-controllers with ADC's have an internal bandgap reference with a voltage of ~1V (see datasheet for more precise values and tolerances; ex.: the STM32F415xx series has a bandgap reference of 1.21V). This effectively increases your resolution to 1253 steps full scale by flipping a software switch.

If you want to do even better, you have a few options:

  1. Use an op-amp to amplify the output of your current sensor
  2. Use a higher resolution external ADC
  3. Use a lower voltage external reference (for example, something like this). Note that a simple voltage divider directly into the vref pin is almost never a good idea.

In none of these cases do you need to change the voltage supply to your microcontroller.

As a side note, I don't understand your aversion to using a shunt resistor. For moderately low currents (few amps) it is the most accurate way to measure currents. For example, the ACS712 chip you've listed has an accuracy of 1%. That means you get an accuracy of 6.64 bits (~100 steps). It is very easy to get shunt resistors with 0.5% accuracy, giving an accuracy of 7.64 bits (~200 steps). Using a 0.1% accurate shunt gives you 9.97 bits of accuracy (~1000 steps).

If you use a very small shunt resistor with an instrumentation amplifier the burden voltage will be negligible. For example, say you have an in-amp with a gain of 100x (very do-able). An appropriate shunt resistor to get 0-1.21V full scale needs a shunt resistor of 6.05mOhms, and will have a burden voltage of 12.1mV. For all intensive purposes this is negligible. You can reduce this even more by using a 1000x in-amp circuit (also very do-able).

helloworld922
  • 16,600
  • 10
  • 54
  • 87
  • I don't wan't to use a shunt because it looked easier to use the ACS71X. By the way, the reference voltage is internally fixed to supply voltage on this chip. What is the in-amp called on a datasheet ? couldn't find it – nairyo Jun 03 '15 at 11:34
  • An "op-amp", short for "operational amplifier", "in-amp" was a typo. – Techydude Jun 03 '15 at 13:14
  • 1
    in-amp is short for "instrumentation amplifier". It is like an op-amp, but there are key design differences. Notably, it is designed to provide a very high gain to amplify slight voltage differences between the two inputs while having high impedance inputs. In-amps can be built using op-amps, though in practice you need really good matching if you want good accuracy at high gain, so get a pre-built chip. I've never seen a hall sensor described as "easier to use" than a shunt. Fewer components, maybe but board geometry is extremely important for hall sensors. – helloworld922 Jun 03 '15 at 17:38
1

You say you want to do "high resolution" current measurement. When you say "high resolution" and then say you're using a 12-bit ADC in a microcontroller, in the same sentence, you're redefining "high resolution. Downward. Anyway, you'll be lucky to get 10-10.5 effective bits, so you're already down to ~1000 codes over full scale (assuming you do what's necessary and amplify your sense measurement so that 2A = "full scale". Is that high enough resolution for you?

If so, then you'll need to follow the advice given in other answers, about choosing an appropriate reference (internal band-gap, or a decent <0.05% external reference, NOT a supply rail no matter how well filtered one might claim to make it), AND use an op-amp to amplify your current measurement with a shunt resistor so that 2A = your reference votlage, and use decent PCB design practises to keep your analog circuitry relatively clean. My interent is bog slow tonight so I can't download a STM32F4xxx datasheet at the moment, but 99.9% it'll support the option to have an external voltage reference.

Techydude
  • 4,089
  • 15
  • 23
1

I would add an op-amp with a gain of 8 to the output of the ACS712, to take advantage of the full range of the ADC in your microcontroller. So 2A would be represented by 8*463 steps = 3704, almost the full range (4096) of the 12-bit ADC with a full-scale voltage of 3.3v.

enter image description here

The LMV321 is a rail-to-rail version of the LM321.

The gain of a non-inverting amplifier is \$1 + \frac{R2}{R1}\$, or in this case \$1 + \frac{93.1}{13.3} = 8\$.

Or use an op-amp with a gain of 12 for the ACS711. In that case, 2A would be represented by 12*275 steps = 3300.

tcrosley
  • 47,708
  • 5
  • 97
  • 161
  • thanks, that's exactly what I did, altough I used a 1K and a 167 resistor ( I prefered to stick with a gain of 7). Is there any reason I should multiply the values of those resistors by 10 or 100 ? I mean I know the gain is 1+R2/R1 but does low resistor values affect anything ? – nairyo Jun 04 '15 at 12:54
  • I like to use resistors in the range of 10K to 100K or so if possible. Just like Goldilocks, you don't want too small, or too high. Something in the middle is just right. [This thread](http://electronics.stackexchange.com/q/173731/1322) discusses the topic in more detail. In your case, I would now choose R1 = 19.1K and 115K. – tcrosley Jun 04 '15 at 17:33