Closed PanduHalimie31 closed 2 years ago
Thanks for your question. There is too little information to analyze your case, so I start with some generic questions.
Q1 What processor board do you use? Q2 How is the ACS onnected? Q3 Have you initialized the sensor to 5A?
A low current when nothing connected can be noise. Q4 If you disconnect the device, what current does it report?
Q5 Have you compared your ACS712 measurements with a multimeter?
Answer 1: I use Atmega328P as the microcontroller chip. Answer 2: The ACS VIOUT pin connected to Atmega328P A0 pin. Answer 3: Yes, i have and using the 5A chip. Answer 4: For now, without any device connected. It shows around 50-70mA. Answer 5: Yes. The multimeter shows the same number but just more stable around 60mA.
Sorry for the late response.
Sorry for the late response.
No need to apologize, most people have more things to do in life ;)
OK so there seems a 60 mA current. I am going to check the datasheet
Do you have a capacitor on the FILTER pin?
What voltage do you measure with DMM) between GND and VCC ? What voltage do you measure with DMM) between GND and VIOUT?
If your voltage is not 5000 mV you need to adjust the midpoint. Either by setting it by calling device.autoMidpoint() or by calling device.setMidPoint(vvalue)
Thanks you! So, yes. I do have a 1nF Caps on the filter pin. Here's are the schematic, its connected to a relay.
The voltage i got by measuring those pins are 2.534V (both GND - VCC and GND - VIOUT). I called ACS.autoMidPoint(); on my code already which show 511-512 since it ADC/2. Or it's different from what you mentioned above?
GND VCC should be sround 5V, that cannot be 2.534V, please measure again
AutoMidpoint seems to return a value as expected.
Ah yes, my bad. It's 5V for GND - VCC pins. Lost focus for a moment.
Think I found the cause From the datasheet
Please note that the ATMEGA 328 has 1024 levels ADC for 5V The sensor only uses +- 1V for 5A so around 200 steps of the ADC are used for 5A. That means that 1 step is around is about 25mA
So the 30-60 mA you see is just one or two bits of the ADC, which is probably noise.
possible solutions:
The ADS1115 is a 16 bit ADC while the 328 has only 10 bit, that means 64 x precision (in theory). That means 1V has 12800 steps so 1 step is in the order of 0.1 mV
You won't get all that extra accuracy in practice as such ADC is more sensitive for noise
in theory there is no difference between theory and practice, but in practice there is.
Ah i see the issues now. Will try the possible resolution soon and see what i got. Thanks for time and of course the answer! Will inform you soon about the update of my device.
Tried out changing the NoisemV and the numbers im getting is much better and realistic than before. For now, the problems is fine at all no need to continue as im getting a better realistic numbers overall. Also i used setMidPoint(512) so the midpoint wont fluctuate.
Thanks for your time!
Good to hear it is solved
Sorry in advance as the question is irrelevant to the ACS712 library. You mentioned to use a low-pass filter of 1K resistor + 10 uF capacitor. The filter will have a cut-off frequency of ~16 Hz. How did you come up with the values of resistor and capacitor? I am asking as I need a low pass filter for my 20A ACS712 sensor. Thank you and again excuse me for the irrelevant question.
@panbak Was just a starting point for a possible solution. Did not calculate them. In the datasheet page 11++ there is information about filtering.
Thank you! Also I don't understand what the second parameter is when calling ACS712 ACS(25, 5.0, 4095, 185);
Is it the sensor operating voltage?
float volts = 5.0 is the voltage of the internal ADC
For an UNO and NANO this is typically 5.0 volts, for an ESP32 this is 3.3V.
This voltage is used to calculate the _mVpstep that is used with the analogRead() to measure the sensors output.
Might need explanation in the readme.md file
something like this
updated description in readme.md (no release)
Hello, excuse me. I got some question to ask. Im using 5A ACS712 Chip for my device. One thing i realized is without anything (any load) connected to my device. It's still showing up 30-45mA. I'm a little confused on why is this happening. Another question is, when i charge my phone it shows the current is around 100-150mA. Meanwhile it should be around 2A/2000mA. Any idea on why is this happening?
Thank you in advance.