cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F4 voltage and current measure

stm32f4
Associate II
Posted on May 12, 2014 at 15:19

Hi All.

I'm trying to use my F4 to get information from an external sensor(is a piezometer).

I configure DMA+ ADC on PC1 pin and seems to work(i read something).

I have same problems adn i can't figure out.

1) PC1 voltage is floating. Still if i use a pull-down resistor(10KOhm)

2) Sensor has an external source power at 12V. I made a volt regulator to traslate it from 12V to about 2.28V. May a measure directly this Voltage(connecting to PC1)?

3) How can get mA of current in input? Sensor produce a range of mA(from 20mA to max 40mA). Is there any limitation on STM32F4?

I hope someone may give me some hints.

Thanks.

Carmelo

#stm32f4-volt-ma-measure
6 REPLIES 6
Trev
Associate II
Posted on May 12, 2014 at 15:33

The ADC measures voltage not current so if you want to measure current you need to convert it into a voltage first  -- ideally a voltage that covers the Vref range. Can you provide a schematic for what you are doing?

stm32f4
Associate II
Posted on May 12, 2014 at 15:51

Yes . The schema is this

0690X00000602r2QAA.jpg

Trev
Associate II
Posted on May 12, 2014 at 21:40

Try again. No part numbers for the voltage regulator or sensor provided. No details how the STM32 is connected, what is used for Vref etc. etc. etc.

PC1 cannot be both floating and 2.88V ??? Have you tried to just simply measure a known voltage e.g. generate half of Vref using a simple voltage divider (e.g. with two 1k resistors)?

Expalin what you are trying to achieve. If it is to measure current in the sensor then the approach above is very wrong.
stm32f4
Associate II
Posted on May 12, 2014 at 22:08

sorry, my fault. retry:

1)part number is   LM317T for voltage regulator

2) Sensor is

http://www.google.it/url?sa=t&rct=j&q=&esrc=s&source=web&cd=1&cad=rja&uact=8&ved=0CDAQFjAA&url=http://www.valcom.it/public/prodotti/documenti/mn18i01.pdf&ei=vydxU-OPFNOa1AX43IDgDg&usg=AFQjCNHDEjqddtXzVFUg_ex9DFKswc8pBQ&bvm=bv.66330100%2cd.d2k

3) At this moment stm32f4 is connected to my laptop using USB

4) What i intend about floating is this. Stm32f4 connected only to my laptop and i have a 10K resistor (pull-down) between pin pc1 and pin gnd of stm32

5) Instead of a voltage divider i realize a voltage regulator using the LM317T integrate

in my project i need to measure somes voltage sensor and some current sensor like this attached.

Can you please suggest me the rigth approach?

thanks a lot.

Trev
Associate II
Posted on May 13, 2014 at 09:13

The sensor output is a standard 4 - 20mA current loop. Please google ''4 - 20 mA'' and you will find lots of information on this very standard interface. You can simply drop the current across a know resistance to generate the required voltage range on the input. Just calculate the resistor value using ohms law i.e. R = Vref/Imax. I still do not know what Vref voltage you are using (the analog reference voltage) on the STM32 but assuming Vref  is 3.3V then R = 3.3V/20mA = 165 ohms. Pick 160 ohm standard value (keep range just inside Vref). Also you need to supply the sensor with more than 12V (read page 8 of the sensor manual). You should also consider protecting the input from over-voltage but that's a separate discussion.

stm32f4
Associate II
Posted on May 13, 2014 at 15:14

Hi Trev.

Thanks for hints.

I modify the resistence and now seems to work good. Senson can user power from 12 to 30V.

thanks again.

Carmelo