Trying to detect if there is power voltage with current sensor ACS712 - Raspberry pico W #11922
-
Hi, The power bank will be always attached to a power supply az-delivery ac-05-3 (220v to 5v) My goal is to check if 220v is present. I'm not interested to calculate watt or ampere. I can't find a schema or a logic when I try to read from the current sensor
|
Beta Was this translation helpful? Give feedback.
Replies: 5 comments 4 replies
-
Do you mean you want to measure how much current the AC-05-03 is drawing? Using a 30Amp sensor to detect 40mA is probably not a good choice. |
Beta Was this translation helpful? Give feedback.
-
The ACS712 cannot detect voltage, just current. And the quiescent output voltage is Vcc/2, which will be modulated by the pattern of the current, like with +/- x mV, 50Hz. With a few mA on a 30A range sensor, you will always read Vcc/2 and some noise. |
Beta Was this translation helpful? Give feedback.
-
This circuit should apply to the RP2040 too: https://www.upesy.com/blogs/tutorials/measure-voltage-on-esp32-with-adc-with-arduino-code |
Beta Was this translation helpful? Give feedback.
-
To tell whether the 5V supply is present or not, you do not need the ADC input. You can use any digital GPIO pin and test for 0 or 1.
|
Beta Was this translation helpful? Give feedback.
-
Thanks for the hint. It should indeed be 3.3kOhm. I selected a relatively low impedance to cater for the higher leakage current of a Schottky diode compared to a bipolar diode like a 1N400x. But the Schottky diode has a lower forward voltage, which is better here. A quick test with a 1N5817 and 5V showed a leakage current to 2.5µA, the data sheet specified a max. of 500µA at 20V. |
Beta Was this translation helpful? Give feedback.
The ACS712 cannot detect voltage, just current. And the quiescent output voltage is Vcc/2, which will be modulated by the pattern of the current, like with +/- x mV, 50Hz. With a few mA on a 30A range sensor, you will always read Vcc/2 and some noise.
I have my doubts whether you can connect the power bank and the Power supply in parallel. Better use two diodes like 1N5817 to decouple them. And then you can feed the output of the power supply through a voltage divider directly into a GPIO pin, which can be checked for low or high. Low means: no power from the power supply, high means power supply on.