I'd like to build a battery charger control circuit using an Arudino, a relay module, and a current sensor.

I'd use the relay to turn on AC power to a "smart charger" for one or more sets of lithium cells in bike headlights (and other types of battery chargers too. This is just a typical use-case). One of the headlights will draw as much as 2 amps at 5 volts. I suspect the other one only draws 500 mA, or perhaps 1A.

I want to sense the current being drawn by the charger(s), and detect when they switch off and their 5V current use drops from 500-2500 mA to the trivial amount of power used energize the power supply and drive their display LEDs (probably <50 mA at 5V.)

500 mA at 5V, the lowest expected "active" current, will be a very small amount of current at 125 VAC. (about .02A, by my calculations)

I COULD cut the USB charging cable and put my current sensor on the low voltage side, but I'd like to make this a versatile charger controller that I could hook to just about any smart mains-powered battery charger by just plugging the charger's AC power cable into my controller. (And possibly adjusting the threshold current, although I'm hoping to make it smart enough to measure a baseline charging current and detect the drop in current when charging completes.)

What could I use to measure the AC current and feed that information into the Arduino? Ideally a digital signal would be best. A variable input voltage driven by current would be my second choice, and a logic 1 that drops to a logic zero when the current drops below a set threshold would be my third choice.

I'm interested in either an off-the-shelf current sensing module, or something I can build.

If this is a more appropriate question for the Arduino Stack Exchange, I apologize. It seems like a decent fit for this site.

Some background:

I've built a home-brew passive current sensor myself before that lets me switch my shop-vac on and off when I turn on my drill press or other power tool. I wound bell wire around a ferrous rod (a nail, if memory serves) and then wound the load wires from the drill press around that, creating a crude transformer. I fed the output of that into a full-wave rectifier diode I had lying around, and attached the positive output from the rectifier to an electrolytic capacitor, and tied both negatives to ground. Then I connected the positive lead of the capacitor to the positive input of a solid state relay. Finally, I ran the mains power into through the load side of the solid state relay. When I draw enough current through the power tool load, it generates a stiff enough output to raise the voltage out of the capacitor enough to turn on the solid state relay. However, this rig only detects several amps of current. I want something much more sensitive.

I'm expecting to need to use active components here. I might be able to build an analog circuit using an op-amp, but my electronics knowledge is a bit weak (I'm a software guy) so I would struggle to figure out to configure it. I seem to remember that the ratio of a resistor on the input and a "feedback" resistor lets you adjust the sensitivity of an op-amp circuit, but I'd have to do some serious digging to figure out what type of op-amp to use and what resistor values would be appropriate. I guess I could use a properly sized potentiometer to adjust the current threshold, but again, my preference would be a way to convert the current measurement to digital information that I could then handle through software on the microcontroller.

  • \$\begingroup\$ Hall sensor may be used. Check Allegro Microsystems, they have some, i.e. ACS70331 \$\endgroup\$
    – user263983
    Commented Nov 16, 2020 at 13:20

1 Answer 1


This circuit will amplify most anything


simulate this circuit – Schematic created using CircuitLab

The D1 rectified the amplified input, with some deadband (several hundred milliVolts, if not more).

  • 4
    \$\begingroup\$ How does the OP use this circuit to measure ac current? I think you have left out a lot of important information. \$\endgroup\$ Commented Dec 30, 2018 at 3:34
  • \$\begingroup\$ the 1uH represents the transformer winding. Notice the inclusion of input-protection diodes. \$\endgroup\$ Commented Dec 30, 2018 at 22:57
  • \$\begingroup\$ still not helpful. regardless of the existence of diodes. is the coil supposed to be an extra winding? "This circuit will amplify most anything" also hardly even qualifies as hand waving. \$\endgroup\$
    – danmcb
    Commented Aug 1, 2022 at 13:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.