# How to measure DC current with a microcontroller?

I have a project where I need to measure DC currents in the range of 0-150 A. I am using an STM32F446RE MCU. I can't use the solution where I convert current to voltage using resistors and reading them using the ADC pin of my MCU. I have found some components like the ACS712 Current Sensor that internally converts current (0-30 A) into a voltage, which I could later read using my MCU, but I can only find cases where they use a PIC MCU. For example: https://circuitdigest.com/microcontroller-projects/digital-ammeter-circuit-using-pic16f877a-acs712 .

What changes would I need to do the make this work on my MCU?. Does anyone have any ideas?

• Why can't you use a shunt resistor? What resolution do you need? – awjlogan Apr 19 '18 at 18:02
• I could use a Shunt resistor if I was only measuring currents from 0-5A.Because I need to measure from 0 to 150 A the power rating of the resistors would need to be very high while the value of Ohm would need to be low. – Pedro Lopes Apr 19 '18 at 18:05
• It doesn't matter if it's 150 A, you can still use a shunt, it would just have to be (very) high powered. – awjlogan Apr 19 '18 at 18:07
• The ACS712 is a Hall effect current sensor, something like that is probably your best bet. – awjlogan Apr 19 '18 at 18:09
• Google hall sensor 150A. – StainlessSteelRat Apr 19 '18 at 18:40

Using the general formula gives $$V_{ADC} = \frac{R_{2}}{R_{1}+R_{2}} \cdot VI_{OUT} = \frac{3000\Omega}{2000\Omega+3000\Omega} \cdot 5V=3V$$