I wrote a code for ACS712 sensor and i want someone to review it. I'm getting pretty accurate reading when compared to my multimeters.
https://github.com/deligent4/ac8712/blob/main/ac8712_rev2.ino
Link to the code. I'm new to coding started learning it recently.
I know there are codes available online fro but all they are doing is converting the analog voltage to current with some formulas (i have done the same). But the thing is they don't output stable reading, i mean when i connect sensor to Arduino at zero current, those codes always showed something is flowing through sensor but in reality there isn't any current Ofcourse by changing some constant values i can get 0 current value when no current flows, but as soon as I change the power source say mobile charger or power bank the values get randon. Not what i needed. Also there is library for this sensor too but that is also based on assuming that I'm having spot on 5V on 5v pin and taking it as reference.
https://github.com/deligent4/ac8712/blob/main/ac8712_rev2.ino
Link to the code. I'm new to coding started learning it recently.
I know there are codes available online fro but all they are doing is converting the analog voltage to current with some formulas (i have done the same). But the thing is they don't output stable reading, i mean when i connect sensor to Arduino at zero current, those codes always showed something is flowing through sensor but in reality there isn't any current Ofcourse by changing some constant values i can get 0 current value when no current flows, but as soon as I change the power source say mobile charger or power bank the values get randon. Not what i needed. Also there is library for this sensor too but that is also based on assuming that I'm having spot on 5V on 5v pin and taking it as reference.