3 Replies Latest reply on Oct 11, 2018 10:18 AM by sanyika95

    Current measuring with STM32 Nucleo


      I just got an STM32 Nucleo with the 24V Intelligent power switch expansion board. I heard it can measure current with it. I am using the Arduino IDE for the easier programming (my friend have given me a good library for it). I was able to read the voltage values on the multisense pin. How can I calculate the current from the voltage values?


      The datasheet of the microcontroller:



      The datasheet of the shield:


        • Re: Current measuring with STM32 Nucleo

          Okay, I have realized my own stupidity, but I still didn't get the current I am measuring with my multimeter.


          By using the formula from the datasheet, I should be able to calculate the load current.

          The Arduino's analogRead() function on the multisenseX pin gives me the needed to calculate the Usense. But first I calculated with 5V as reference voltage, later I read I should calculate with 3,3. This was my first mistake.

          So now I know:

          And as there is a voltage divider,


          Now the only thing I need is the value of K. In the datasheet there is a resistance, called RDSPower, but still don't how to get it. In the datasheet of the IC, there was values for the K: 2900, 2930, 2960. I tested with all of them, but the values still are not the same. The difference between them is around 100 mA. So if I can get somehow the good value of the K, I should be done.

          I have changed the resolution of ADC to 12 bit, that changed my second equation a bit. In the denominator there is 4095 in the case of 12 bit ADC instead of 1023.


          The other problem I realized is that, there is voltage on the multisense pin, even when there is no load on the output. How can I get rid of that noise, to correct the measurement?

          And the other problem is that, it doesn't measure the little currents in mA scale.

          (If I find it out before I get a reply, I will write about it, in the case if someone ever needs this, and find my post in the Google)

          1 of 1 people found this helpful
            • Re: Current measuring with STM32 Nucleo

              The value of K should be selected based on how much current is being sensed.

              use K1 (2960) for currents in the 1 A range

              use K2 (2930) for currents in the 3 A range

              use K3 (2900) for currents in the 12 A range


              The "noise" is probably either an offset or voltage noise.

              To get rid of the offset simply subtract the zero current reading from measurement readings.

              To get rid of voltage noise you can filter the signal or average a number of readings.

              4 of 4 people found this helpful