2021-03-30 03:16 AM
Hi everyone,
I am too new at STM, so I couldn't understand how to measure DC current. Can anyone help me to do my setting and code, please. I found out code for AC current and I decided to change some parts of this code, but I couldn't understand how should I do settings of pinout and configuration.
Solved! Go to Solution.
2021-03-30 05:54 PM
Hello
do you mean ACS712?
This sensor converts current flowing to voltage on output pin. Current measuring pins are electricaly isolated from the rest pins.
All you need, is to measure the ouput voltage of ACS with one pin of MCU configured as "ADC input" but there are some pitfalls.
ACS712's VCC is 5v and max output is about 4.5~4.6v for 20 A. STM32 ADC inputs voltage range is 0 - ~3.3V(about max MCU's VREF or VDDA)
The sensitivity is 0.1V/A that means the usable range is from -20A to +8A for MCU's VDDA=3.3V (when output is connected directly to an ADC input pin ). Note that zero amperage, gives 2.5V output signal.
To use safely the full range of ACS, consider use a proper T resistor voltage divider connected from ACS output to an ADC input of MCU with factor 4.6/VREF
The rest is more simple. Just configure the ADC input pin.
CUBEMX can do the configuration and produce the code . (like the example below)
Strongly suggest to use a voltage divider, not to stress or damage the MCU.
2021-03-30 05:54 PM
Hello
do you mean ACS712?
This sensor converts current flowing to voltage on output pin. Current measuring pins are electricaly isolated from the rest pins.
All you need, is to measure the ouput voltage of ACS with one pin of MCU configured as "ADC input" but there are some pitfalls.
ACS712's VCC is 5v and max output is about 4.5~4.6v for 20 A. STM32 ADC inputs voltage range is 0 - ~3.3V(about max MCU's VREF or VDDA)
The sensitivity is 0.1V/A that means the usable range is from -20A to +8A for MCU's VDDA=3.3V (when output is connected directly to an ADC input pin ). Note that zero amperage, gives 2.5V output signal.
To use safely the full range of ACS, consider use a proper T resistor voltage divider connected from ACS output to an ADC input of MCU with factor 4.6/VREF
The rest is more simple. Just configure the ADC input pin.
CUBEMX can do the configuration and produce the code . (like the example below)
Strongly suggest to use a voltage divider, not to stress or damage the MCU.
2021-03-30 06:39 PM
Thank you so much. Yeah, I ment ACS712. I didn't know that ACS712 converts the current to voltage. I'll try it as soon as possible. Thank you so much again.