Minimum ADC reference voltage?

RogerClark
Fri May 26, 2017 11:26 am
Guys.

I thought I read somewhere that the F1 ADC ref voltage could be set at 1V, but perhaps this was for the F3 not the F1

As far as I can see from the datasheet,

ADC input range: VREF- ≤ VIN ≤ VREF+

and

VREF- =V SSA (I think this is 0V)

2.4 V ≤ V REF+ ≤ VDDA

i.e ADC min range is 0 to 2.4V

I was hoping to be able to set VREF+ to something lower, so that I can measure a range up to 0.1V, but it looks like I’m going to need to use an opamp, to bring the signal up to a range where I can use it.

BTW. I want to measure USB current drawn for monitoring phone charging. I have a simple inline dongle which has an OLED display and works well to give instantaneous measurements, but I’d like to plot charge current over time e.g. use a BluePill and a ILI9341 display.


zoomx
Fri May 26, 2017 1:39 pm
How much is the internal reference voltage?
I searched for all RM0008, found 14 occurences of vrefint but didn’t find the value.

Edit: forgot to add the word “internal”


ag123
Fri May 26, 2017 1:57 pm
not too familiar with adc but
AN2586 Getting started with STM32F10xxx hardware development
http://www.st.com/content/ccc/resource/ … 164185.pdf
page 7 1.2 Power supply schemes
seemed to suggest there is both VREF+ and VREF-
it would seemed VREF- would normally be grounded, while VREF+ would be between 2.4V – Vdda
since VREF- is at ground i.e. 0v. i’d think in this case the range of analog voltages that can be read by the ADC would be between 0 – VREF+ (VDDA) ~ 3.3v?
i’m using some sensors which has analog voltages varying between ground 0v – 3.3v and it would seem that it is indeed the case.
perhaps one way to test is to use a potentiometer / variable resistor to test it

Rick Kimball
Fri May 26, 2017 2:06 pm
If you are talking about the LQFP48 stm32f103 chips, they don’t even have a VREF+ pin. Nor do the LQFP64 chips.

Pito
Fri May 26, 2017 5:00 pm
Except 144pinners, there is no way to setup Vref. It is always wired internally to Vdd :(

RogerClark
Fri May 26, 2017 9:47 pm
Pito wrote:Except 144pinners, there is no way to setup Vref. It is always wired internally to Vdd :(

ahull
Sat May 27, 2017 1:18 am
What sort of resolution do you require? If we assume that we can get 11bit resolution of a 3.3v signal, then each bit = 1/2048*3.3
or 0.001611328v, so your 0 to 0.1v signal would give you 62 steps of resolution without amplification, or around 7 bit accuracy.. for anything better, you would indeed need an op-amp. If the best we can get from the STM32f103 is 10bits, then you are reduced to about 6 bit accuracy (31 steps).. and so forth. There is an interesting article on oversampling on the STM32 series here -> http://www.st.com/content/ccc/resource/ … 177113.pdf

I suspect the impedance of the ADC is not a significant factor as you are presumably measuring voltage drop over a very low value resistor, in order to estimate current. In some use cases adding an opamp could improve the input impedance, and thus accuracy.. but in this scenario, it is not a factor.


RogerClark
Sat May 27, 2017 4:38 am
ahull wrote:What sort of resolution do you require? If we assume that we can get 11bit resolution of a 3.3v signal, then each bit = 1/2048*3.3
or 0.001611328v, so your 0 to 0.1v signal would give you 62 steps of resolution without amplification, or around 7 bit accuracy.. for anything better, you would indeed need an op-amp. If the best we can get from the STM32f103 is 10bits, then you are reduced to about 6 bit accuracy (31 steps).. and so forth. There is an interesting article on oversampling on the STM32 series here -> http://www.st.com/content/ccc/resource/ … 177113.pdf

I suspect the impedance of the ADC is not a significant factor as you are presumably measuring voltage drop over a very low value resistor, in order to estimate current. In some use cases adding an opamp could improve the input impedance, and thus accuracy.. but in this scenario, it is not a factor.


ag123
Sat May 27, 2017 4:59 am
i guess you are trying to measure current, in that case an op amp would probably help as the voltage difference is likely pretty small. the resolution may be rather poor if an op amp isn’t used.

i’ve wanted to mess with strain gauges only to realise that the resistance changes is extremely small micro-ohms.
this would mean needing elaborate setups like whetstone bridges and ‘instrument amps’ i.e. very large amplification say in excess of 10,000x and higher. my guess is an even very tiny out-of-balance on the whetstone bridge may throw the op amp to saturation rendering it ‘useless’. after that i postponed that & simply wait out until i run into an ‘easier’ way to do it.

i’ve been wondering how those digital weighing scales seem to be doing it so ‘easily’. i’ve heard about piezo-resistive sensors but i’m yet to find common and ‘cheap’ piezo-resistive sensors that can do that.

just 2 cents


RogerClark
Sat May 27, 2017 6:58 am
Yes.

I want to measure current of up to 2 amps from USB chargers.

I may be able to use an ACS712-5A hall effect current sensor, I think it outputs 0A as 2.5V as its output is 0V for -5A and 5V for +5A (as its directional)

So if I put it in backwards ;-)

Then I get the full range of 2.5V to 0V in the range 0 to 5A forward current (decreasing voltage is increasing current)

So that would be 2.5/5 Volts per Amp = 0.5V per Amp.

So, from Andy’s calculation….

I think this means I can get 1.161/0.5 = 3.22 mA accuracy

That sounds too good to be true. Or if not its ideal ;-)


ahull
Sat May 27, 2017 10:00 am
@Roger Youtube user Julian Ilett does something similar here..

He describes the build of the “Arduino Ammeter” in a couple of earlier videos


RogerClark
Sat May 27, 2017 10:46 am
Thanks.

It looks like he is doing the same thing I thought of, except with the ACS512 being a 5V device, he will get full range of +/- 5A (or whatever the range of his Hall effect device)

I just checked my box of spares and I can only find a 30A version (which I bought for mains current measurement), so I’ve just ordered some 5A versions from eBay

I’ll double check in case I have an 5A kicking around somewhere else, but I think I may have to wait for the slow boat from China on this one


Leave a Reply

Your email address will not be published. Required fields are marked *