cancel
Showing results for 
Search instead for 
Did you mean: 

X-NUCLEO-IHM08M1 Op-amp current calculation

shlokGupta
Associate II

Hello everyone,

I’m working on a project where I am using the motor controller’s current sense circuitry (shunt + op amp). Here are my key details:

1. Hardware Setup:
- Board: X-NUCLEO-IHM08M1 with NUCLEO-H755ZI-Q

- Op Amp: TSV994

- Shunt Resistor: 0.01 Ω, 3 W rating (from BOM)

- Supply: 12 V, measured ~0.45 A from the power supply

2. Observations:
- At no load (no supply connected, only 3.3 V to the controller), the amplifier output is around 1.65–1.7 V, which I treat as the zero-current offset.

- When I measure actual load with the 12 V, 0.45 A supply, my code calculates 8–9 A from the ADC, which seems impossible because the supply is only delivering ~0.45 A total.
- I attempted to validate the amplifier gain using resistor ratios and the op amp datasheet. It suggests a total gain of around 13.7.

- I also used the approach of “maximum possible voltage” across the shunt (0.01 Ω) with a 3.3 V rail, concluding ~13–14× hardware gain.

- Yet, the measured “current” is far too high compared to the actual supply current.

3. What I’ve Tried:
- Offset Calibration: I subtract the ~1.65 V offset at zero current in code.

- Known Resistor Checks: I physically measured some resistors to confirm they match the BOM.

- Known Current Test: I tried a partial approach but the readings still show inflated current.

4. Questions

- Why might the amplifier or code still report 8–9 A if the supply is only 0.45 A?
- Could there be a second stage or firmware multiplier that’s boosting the reading?
- Is there a recommended method to measure the actual net gain or confirm the offset beyond the typical approach?

Any guidance or insight would be greatly appreciated. I suspect either a hidden second stage gain, incorrect offset usage, or a mismatch between BOM and real population. If anyone has seen similar overestimated current readings with TSV994 or a 0.01 Ω shunt, please share your debugging steps.

Thanks in advance!

6 REPLIES 6
AScha.3
Chief III

Hi,

so you use this circuit:

AScha3_0-1741427807908.png

Offset is about 3v3 / (6k8+680) * 680 * 5.7 = 1.71 V ;

gain (1 + 4.7) = 5.7 ; and from input x / (6k8+680) *6k8 = 0.909 -> gain 5.18 ;

so 1A in the 10 mOhm = 10mV  -> * 5.18 + 1.71 = 1.762 V;

0.45A -> 1.733 V ;

So your zero offset is ~ 1.71 , measure it at start with no current , and use this as offset;

what you measure then from ADC, when having 0.45A in use ?

If you feel a post has answered your question, please click "Accept as Solution".

 

Hi AScha.3,

When checked with similar parameters, my ADC reads a voltage of 2.5V at 0.45A.

 

And check with DMM, what IS real voltage at this ADC in ! (maybe there is 2.5 V ...)

-> to know, what to look for : hardware or software wrong..?

If you feel a post has answered your question, please click "Accept as Solution".
shlokGupta
Associate II

When checked on the oscilloscope, it validated the reading on the adc.

So what we have now :

- offset 1.7V  - ok.

- at 0.45A -> ADC shows 2.5V , real check on pin: 2.5V - right ?

- so whats real voltage at the 10 mOhm shunt ? 

+ check shunt , if possible: is it still 10 mOhm ...or other value now ?

 

+ btw , is current measurement by ADC at shunt a static/continuous current, or is it pulsed ?

What you see on scope ? (show it...)

If you feel a post has answered your question, please click "Accept as Solution".

Hello Ascha.3

  • Offset voltage is correctly set to 1.7V.
  • At 0.45A, the ADC shows 2.5V, and a direct voltage measurement at the pin also confirms 2.5V.

Shunt resistor verification

  • Measured resistance with an RLC meter: 0.1Ω instead of the expected 0.01Ω.
  • Oscilloscope shows similar spikes on both sides of the shunt resistor, ranging from 60mV to 300mV.
  • Varying duty cycle (5% to 80%) only affects the amplitude of the spikes, but the voltage across the shunt remains unchanged.

Nature of ADC current measurement

  • Timer 1: 40% duty cycle at 2 kHz (PWM signal).
  • Timer 4: ARR value similar to Timer 1's duty cycle to trigger ADC callback.
  • Current measurement is expected to be pulsed rather than static.

Oscilloscope observations

  • Power supply: 12.2V, load draws 0.28A.
  • Similar spikes on both sides of the shunt resistor, ranging from 60mV to 300mV.
  • Varying duty cycle (5% to 80%) affects spike amplitude but not voltage.

Before JP1 Removal (Fixed Voltage at Varying Duty Cycles)

  • PWM duty cycle (1% to 100%): Fixed voltage observed between 1.8V and 2.04V.
  • PWM at 0% corresponds to a specific offset voltage.
  • Power supply: 12.2V, load: 0.28A, spikes remain similar (60mV to 300mV).

After JP1 Removal

  • Voltages dropped to 0V due to the pull resistor R6 not being connected.
  • Current fetching from the power source remained unchanged.
  • Output pin (7) of TSV1994 op-amp IC: 0V (grounded).
  • ADC corresponded to the change, confirming expected behavior.

Attached Images for Reference

  • Image 1: TSV1994 Op-Amp IC
  • Image 2: Output with shunt resistor 0.01Ω, no load
  • Image 3: Output with shunt resistor 0.01Ω, powered load