Skip to main content
carlosdelfino
Senior
January 9, 2026
Question

Using an STM32G484 OpAmp as a Shunt Sensor

  • January 9, 2026
  • 1 reply
  • 365 views

 

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

1 reply

Andrew Neil
Super User
January 9, 2026

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.
carlosdelfino
Senior
January 9, 2026

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.

Buy me a coffeeMy Portal about Analog ElectronicsMy Youtube Channel where I share my learning about Analog Electronic
carlosdelfino
Senior
January 9, 2026

Okay, I understand now.

Let's go back to the project and use a Current Sense with Hal Effect.

Buy me a coffeeMy Portal about Analog ElectronicsMy Youtube Channel where I share my learning about Analog Electronic