I am trying to detect when there is a current in a given circuit using only a digital input and basic components (e.g. diodes, resisters, transistors); current is intermittent and power is small, 40-100mA @ 12V. I do not need to measure the current, simply know when it is present or not present.

I am trying to avoid additional chips e.g. INA219, optocouplers, etc. Is it possible to detect (again, not measure, only detect) current this way? Detection does not need to be rapid, within 100ms would be fine.

The load can have resistors, diodes, etc. in series or parallel. A voltage drop of up to 2 volts is fine. The power supply is stable around 12 volts and near the load. The digital input/output logic is 3.3V (Raspberry Pi); the presence of current would ideally be read as 3.3V (or at least 2) while the lack of current would ideally be read as 0V (or less than 2).

The important detail I forgot to mention is that the voltage source switches polarity. It is stable at 12 volts, but current can flow in either direction.

  • \$\begingroup\$ Interesting question, and I'm sure the answer is yes, but this doesn't sound like a Pi specific question. \$\endgroup\$
    – joan
    Commented Jan 14, 2021 at 14:23
  • \$\begingroup\$ Perhaps MAX4172. My Rpi4B with Python is using it to measure/detect 0~5mA diode current, so far so good. PS - But you need MAX4172 chip and its digital output Vo to detect current. \$\endgroup\$
    – tlfong01
    Commented Jan 14, 2021 at 14:32
  • 2
    \$\begingroup\$ Pls specify tolerance to a lossless method of measurement (e.g. 700 mV or 50mV or 5mV?) and define current threshold value and tolerance. \$\endgroup\$ Commented Jan 14, 2021 at 15:59
  • 2
    \$\begingroup\$ What specifically is the load that is taking the current? Can the load have a small series resistor inserted to the 0 volt end? Can that series resistor be permitted to drop about a volt when the 100 mA is present? What is the lower limit of current you wish to detect the presence of? How quickly do you want to detect the current? Is the power supply always 12 volts? If not, how can this change? What are the logic voltage levels for your digital input? How far away is the load from the 12 volt supply? How far away is the digital input from the load? \$\endgroup\$
    – Andy aka
    Commented Jan 14, 2021 at 15:59
  • \$\begingroup\$ "...less than 100mA @ 12V" - Not enough information. What is the minimum current that needs to be detected? _"current is intermittent" - What is the minimum period of this current draw that needs to be detected? What is the maximum acceptable voltage loss caused by the current detection? Does this 12V supply share a common ground with your Pi? \$\endgroup\$ Commented Jan 14, 2021 at 17:59

2 Answers 2


Requires 50% rated load


simulate this circuit – Schematic created using CircuitLab

A precision comparator is needed for low threshold currents TBD.


If you are not critical on your output voltage I typically put a 2 diodes in series with the load on the low side and parallel them with a resistor maybe 10K depending on current. I then use a NPN transistor with the base connected to the load side of the diodes via a 300 ohm resistor and the emitter to ground. The collector is the output. Reverse and you can do the same on the high side. What happens when a load occurs the voltage drop across the resistors will reach the VF of the two diodes in series which is more than enough to turn on an NPN transistor. The diodes handle the current so they have to be sized appropriately. With the right transistor this can be accomplished with 1 diode but in either case you will be getting less then 12V.

  • 1
    \$\begingroup\$ A schematic will encourage up-votes. \$\endgroup\$
    – Mattman944
    Commented Jan 14, 2021 at 17:38

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.