I have a home automation project and am looking to use multiple current sensors (ACS712) for multiple appliances. I just need to know whether current is present or not instead of the current value. Is it possible, that I connect the ACS712 sensor to the digital input of Arduino, and get HIGH or LOW via digitalRead() function. If not, please suggest an alternative to detect ac current is present or not with digital input i.e. HIGH or LOW that can be read via the digitalRead() function.

  • 1
    This has already been asked on EE.SE. You will end up being asked the same questions here; if you don't help us then we cannot help you. – CharlieHanson Dec 7 '15 at 19:08
  • The answers over at EE also suggest that this is not the most appropriate sensor for this purpose. Given you are detecting AC, note that the ACS712 returns values representing the sine-wave, crossing over at "0", which is 2.5v output from the sensor. So you could take samples via the Arduino over a short period and detect the peaks in software to determine the total current, but from the answers below and at EE it seems an alternative sensor component, or additional circuit between the ACS and the Arduino would make the most sense if you need to use this particular sensor. – Grant Jan 29 '16 at 4:55
  • Please do not cross-post the same question on different Stack Exchange sites. See Is cross-posting a question on multiple Stack Exchange sites permitted if the question is on-topic for each site? – Nick Gammon Jan 29 '16 at 5:28
  • 1
    I'm voting to close this question as off-topic because posting a question to multiple sites is explicitly prohibited. – Chris Stratton Jan 29 '16 at 5:33

Considering an ATMEGA with a 5V VCC we have:

LOW  = < 0.3*VCC = 0,3*5V = 1.5 V
HIGH = > 0.5*VCC = 0,5*5V = 2.5 V

You can connect directly to the Arduino if the output of your sensor is higher than 2.5 volts whether current is present or below 1.5 volts if not. This would translate to HIGH or LOW output from digitalRead() function respectively.

You need to recalculate this values for the 3 volt version of Arduino, probably in this case is better the comparator solution to ensure up to 3 volts max logic level.

Example circuit as follow, just need to set voltage divider to desired threshold (note this is for 5v case),


| improve this answer | |
  • You should instead use the Peak Detector example from the datasheet; it's designed for AC use and is much more appropriate for a current/no-current output. – CharlieHanson Dec 7 '15 at 19:10

Use a comparator for an adjustable threshold and feed the output into the arduino digital pin.

| improve this answer | |
  • 2
    Can you please expand your answer to include how to do this? What components would the OP need? Thanks! – Anonymous Penguin Dec 11 '15 at 0:48
  • Your answer would be even more useful if you could include more detail. For example, can you suggest a comparator that would be suitable, or a link to a tutorial that does something similar. – dlu Dec 31 '15 at 17:45
  • Depending on which Arduino, it already has an analog comparator. – Nick Gammon Jan 12 '16 at 5:38

It seems like you could do this with a transistor (if "faking" a digital signal from the ACS712 doesn't work). A simple circuit where the VIOUT of the ACS712 drives the base of a switching transistor connected to a digital pin on the Arduino with an internal pull up might do the trick (assuming that the ACS712 give you a voltage on VIOUT that is proportional to the current).

| improve this answer | |

The Arduino/AVR (for instance ATmega328p, chap. 22) has an analog comparator (D6/AIN0, D7/AIN1 or any analog pin). This could be used with the correct reference voltage.


| improve this answer | |

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