# how to measure current of high voltage 150Hz pwm signal?

I have a step-up converter which produces 130V DC and 12mA max current

I generate 130V pulses using an optoisolator PWM duty vary between 10 to 50 (255 max) at 150Hz frequency,

but my load (resistive load - assume it is a potentiometer) resistance changes - some times it draws 1mA, sometimes it is 3mA,5mA,9mA,12mA as well

so I need to measure this current once it is connected to the load, from an Arduino

I could not find a proper solution (circuit) to measure current, how to measure this current from the PWM pulses?

edited

the booster is not isolated, a simple step-up booster converter based on booster controller external MOSFET switch, inductor etc...

I need to measure current referenced to the gnd

• I would suggest measuring the voltage across a low side shunt.
– user16324
Commented Mar 19, 2020 at 8:28
• "but my load (resistive load - assume it is a potentiometer)" - What is the load exactly? How accurately do you need to measure the current? Please show us a schematic of the setup. Commented Mar 19, 2020 at 9:01
• @Bruce Abbott I need accuracy at least 0.2mA precision, sorry I cannot show schematic, simply assume you have a booster 130V 12mA max current and need to measure the current draw to the load, I need to measure current continuously
– oppo
Commented Mar 19, 2020 at 9:30
• @Brian Drummond I know but I did not find any reference material on that can you provide a method? based on opamps? because all the examples I found are less than 60V voltage across a low side shunt, I couldn't find one 130V or higher
– oppo
Commented Mar 19, 2020 at 9:32
• "sorry I cannot show schematic, simply assume you have a booster 130V 12mA max current and need to measure the current draw to the load" - that's a pity, because there might be simple solution but without any idea of how the parts are wired we have to assume the worst case (fully isolated supplies, no access to load ground connection etc.). Commented Mar 19, 2020 at 10:40

If the Arduino and load share a common ground then you may be able to put a current sense resistor in the load's ground wire and measure voltage across it directly, or if that is not possible measure current at the ground side of the voltage converter output.

However in the general case where grounds are not shared a fully isolated measurement will be required. The current sensing circuit then 'floats' at the high voltage, and the signal has to be transferred through an isolation barrier. At high current a Hall effect current sensor could be used, but measuring 1mA with 0.2mA precision is beyond the capabilities of typical Hall sensors.

A conventional circuit that measures voltage across a shunt resistor needs a power supply referenced to the high voltage, and a way of accurately transferring the signal to the ground-referenced Arduino input.

To power the circuit you can simply use an isolated DC/DC converter module. To transfer the signal you could use an optocoupler, a transformer, a small capacitor or even an rf link. The signal could be encoded as an analog voltage or current, pulse width, frequency or digital code word. Which method to chose depends on various factors such as cost, design and building skills, EMI issues, component availability etc.

Here's one possibility:-

simulate this circuit – Schematic created using CircuitLab

The IL300 is a linear optocoupler with two matched photodiodes, one for feedback and the other for output. The op amp 'servos' the LED current until the feedback photodoide passes a current that drops the same voltage across R3 as the voltage across the shunt (which drops 10 mV per mA of load current). The other photodiode passes the same current on the Arduino side, but this current goes through 10 times higher resistance so it produces 10 times higher voltage, ie. 100 mV per mA of load current.

The high voltage part of the circuit is powered by a RECOM REME3.5 isolated DC/DC converter. Its positive output is tied to the 130V power supply positive, which is 'ground' for the shunt resistor and the positive power supply for the op amp.

• how did you figure out common-mode voltage of mcp6021 supports up to 130V? in other words or + in and - In supports up to 130V ?
– oppo
Commented Mar 19, 2020 at 16:34
• It doesn't. The MCP6021 has rail-to-rail inputs and max 6.5V supply voltage. The REM3.5E0505 puts out 5V to power the op amp. Common mode input voltage is the positive of that supply. Negative of that supply is 5V below 130V (or whatever voltage your step-up converter produces). Commented Mar 19, 2020 at 19:29
• @oppo: This op-amp -- like most (all?) other integrated op amps -- does not directly support 130 V inputs. However, this clever circuit shifts all of the pins of the op-amp -- including the power pins and output pin -- close enough to the input voltage so that the op-amp will still work fine. Then the optocoupler shifts that signal back down where the Arduino can read it. Commented Mar 19, 2020 at 23:25

Simple low side current sense with a non-inverting amp. Power the amp from the same power source as your mcu's ADC, scale the amplification as you see fit (max failure current should make a signal near max of your ADC input). As scaled here, you get ~2.3V for your max 12mA signal. I've simplified your circuit as the current source in this diagram as you've stated you are on the same ground, so this simplification should suffice. Choice of op-amp is up to you, but you want something that can drive close to ground and has a common mode range that goes below ground.