22[ ![ Arduino CI] ( https://github.com/RobTillaart/ACS712/workflows/Arduino%20CI/badge.svg )] ( https://github.com/marketplace/actions/arduino_ci )
33[ ![ Arduino-lint] ( https://github.com/RobTillaart/ACS712/actions/workflows/arduino-lint.yml/badge.svg )] ( https://github.com/RobTillaart/ACS712/actions/workflows/arduino-lint.yml )
44[ ![ JSON check] ( https://github.com/RobTillaart/ACS712/actions/workflows/jsoncheck.yml/badge.svg )] ( https://github.com/RobTillaart/ACS712/actions/workflows/jsoncheck.yml )
5+ [ ![ GitHub issues] ( https://img.shields.io/github/issues/RobTillaart/ACS712.svg )] ( https://github.com/RobTillaart/ACS712/issues )
6+
57[ ![ License: MIT] ( https://img.shields.io/badge/license-MIT-green.svg )] ( https://github.com/RobTillaart/ACS712/blob/master/LICENSE )
68[ ![ GitHub release] ( https://img.shields.io/github/release/RobTillaart/ACS712.svg?maxAge=3600 )] ( https://github.com/RobTillaart/ACS712/releases )
9+ [ ![ PlatformIO Registry] ( https://badges.registry.platformio.org/packages/robtillaart/library/ACS712.svg )] ( https://registry.platformio.org/libraries/robtillaart/ACS712 )
710
811
912# ACS712
@@ -16,14 +19,17 @@ Library for the ACS712 Current Sensor - 5A, 20A, 30A and compatibles.
1619The ACS712 is a chip to measure current, both AC or DC. The chip has an
1720analogue output that provides a voltage that is linear with the current.
1821The ACS712 library supports only a built in ADC by means of ** analogRead()** .
19- There are 4 core functions:
22+
23+ However since 0.3.4 there is an experimental ** setADC()** .
24+
25+ The library has 4 core functions:
2026
2127- ** float mA_peak2peak(frequency = 50, cycles = 1)**
2228- ** float mA_DC(cycles = 1)**
2329- ** float mA_AC(frequency = 50, cycles = 1)**
2430- ** float mA_AC_sampling(frequency = 50, cycles = 1)**
2531
26- The parameter cycles is used to do measure multiple cycles and average them.
32+ The parameter cycles is used to measure multiple cycles and average them.
2733
2834To measure DC current a single ** analogRead()** with conversion math is
2935sufficient to get a value.
@@ -36,8 +42,10 @@ This factor depends heavily on the signal form, hence its name.
3642For a perfect sinus the value is sqrt(2)/2 == 1/sqrt(2).
3743See ** Form factor** below.
3844
45+ For a 60 Hz environment the blocking is ~ 16.7 milliseconds, still pretty long.
46+
3947The ** mA_AC_sampling()** calculates the average of the sumSquared of many measurements.
40- It should be used when the form factor is not known.
48+ This function should be used when the form factor is not known.
4149
4250Note to make precise measurements, the power supply of both the ACS712 and the ADC of
4351the processor should be as stable as possible.
@@ -59,8 +67,8 @@ mA LSB = (1000 * 5000 mV) / (maxADC * mVperA);
5967```
6068
6169Although no 16 bit ADC built in are known, it indicates what resolution
62- could be obtained with such an ADC. It triggered the thought for supporting
63- external ADC's with this library or a derived version. See future .
70+ could be obtained with such an ADC. It triggered the experimental supporting
71+ of external ADC's with this library.
6472
6573
6674#### Tests
@@ -75,17 +83,16 @@ The library is at least confirmed to work with the following boards:
7583| ESP32 | 3.3V | 4096 | #15
7684| Promicro | 5.0V | 1024 | #15
7785
78- Please let me know of other working platforms / processors.
79-
86+ Please let me know of other working platforms / processors (and failing ones!).
8087
8188
8289## Compatibles
8390
8491Robodyn has a breakout for the ACS758 - 50 A. - See resolution below.
8592This sensor has versions up to 200 Amps, so use with care!
8693
87- Allegromicro offers a lot of different current sensors, that might be compatible.
88- These include bidirectional and unidirectional.
94+ Allegromicro offers a lot of different current sensors that might be compatible.
95+ These include bidirectional and unidirectional ones .
8996The unidirectional seem to be for DC only.
9097
9198https://www.allegromicro.com/en/products/sense/current-sensor-ics/current-sensors-innovations
@@ -215,7 +222,7 @@ The library does not support this yet.
215222
216223#### Form factor
217224
218- The form factor is also known as the crest factor.
225+ The form factor is also known as the ** crest factor** .
219226It is only used for signals measured with ** mA_AC()** .
220227
221228- ** void setFormFactor(float formFactor = ACS712_FF_SINUS)** manually sets the form factor.
@@ -224,12 +231,12 @@ Must typical be between 0.0 and 1.0, see constants below.
224231
225232The library has a number of predefined form factors:
226233
227- | definition | value | approx | notes |
228- | :---------------------| :--------------| :------:| :--------|
229- | ACS712_FF_SQUARE | 1.0 | 1.000 | |
230- | ACS712_FF_SINUS | 1.0 / sqrt(2) | 0.707 | default |
231- | ACS712_FF_TRIANGLE | 1.0 / sqrt(3) | 0.577 | |
232- | ACS712_FF_SAWTOOTH | 1.0 / sqrt(3) | 0.577 | |
234+ | definition | value | approx | notes |
235+ | :---------------------| :---------------- | :-------- :| :-- --------|
236+ | ACS712_FF_SQUARE | 1.0 | 1.000 |
237+ | ACS712_FF_SINUS | 1.0 / sqrt(2) | 0.707 | default |
238+ | ACS712_FF_TRIANGLE | 1.0 / sqrt(3) | 0.577 |
239+ | ACS712_FF_SAWTOOTH | 1.0 / sqrt(3) | 0.577 |
233240
234241It is important to measure the current with a calibrated multimeter
235242and determine / verify the form factor of the signal.
@@ -480,3 +487,12 @@ The examples show the basic working of the functions.
480487- setADC() to support > 16 bit?
481488 - uint32_t performance penalty?
482489
490+
491+ ## Support
492+
493+ If you appreciate my libraries, you can support the development and maintenance.
494+ Improve the quality of the libraries by providing issues and Pull Requests, or
495+ donate through PayPal or GitHub sponsors.
496+
497+ Thank you,
498+
0 commit comments