cancel
Showing results for 
Search instead for 
Did you mean: 

Using an STM32G484 OpAmp as a Shunt Sensor

carlosdelfino
Senior

 

I'm developing a power bus manager where I monitor current and voltage drop across a shunt resistor. I chose the STM32G484 as the MCU because it has enough OpAmps and ADCs for my project.

However, I have a question that might only be related to electronics, but I'd like to be sure it won't affect the MCU.

The bus is supplied by a DC-DC switched-mode power supply where the highest voltage is 12V. We know the voltage drop across the shunt resistor is minimal. So, could I connect the "plus" and "minus" inputs directly to the shunt resistor? Is it necessary to define the gain loop? Or can I work without it? In this case, the question is whether the MCU allows parameterizing the input where "plus" and "minus" are connected directly to the GPIO without any internal interference.

Thank you for your support.

ps: The project is being developed under CC-By 4.0 license and is available at https://kepr.rapport.tec.br

4 REPLIES 4
Andrew Neil
Super User

Look at the datasheet specifications for the STM32's input pins: they will probably tell you that the voltage at any pin can't exceed the STM32's VDD, and that the maximum VDD is a lot less than 12V ...

 

PS:

Search for "Current-Sense Amplifiers" (CSA) - they are specifically designed for this application.

The big thing here is "Common-Mode" voltage.

There are even some which give a direct digital output; some also give voltage, power, etc ...

A complex system that works is invariably found to have evolved from a simple system that worked.
A complex system designed from scratch never works and cannot be patched up to make it work.

Regarding the power supply, there's no doubt it should be 1.7 to 3.3 volts; in my case, it will be 3.3 volts. However, according to the document "AN5093 - Application note: Getting started with STM32G4 Series hardware development boards," the OpAmps will only be 2V maximum, meaning it should have an internal LDO that levels this voltage. But even though the inputs are receiving the voltage from a 12-volt bus, it will only pick up the voltage drop across the shunt resistor. So that's my question: is there any potential problem?

I will read your suggestions.

To use the OpAmp in a way that it gives me the voltage difference between the "plus" and "minus" pins, do I just need to set it to "Standalone"?

I don't want to use a specialized current sensor because I'm learning, so I want to develop both my skills with the STM32 and with the mathematics and algorithms involved.


@carlosdelfino wrote:

 even though the inputs are receiving the voltage from a 12-volt bus, it will only pick up the voltage drop across the shunt resistor. .


If the shunt is in the +12V bus then its terminals will both be at +12V, with just a very slight difference due to the drop across the shunt.

That so-called "common-mode" voltage is the problem - you can't connect that to a 2V ADC input!

An alternative is to put the shunt in the 0V line...

A complex system that works is invariably found to have evolved from a simple system that worked.
A complex system designed from scratch never works and cannot be patched up to make it work.