From 81e2f57b63e560439ffdb93140fe95372c223f5e Mon Sep 17 00:00:00 2001 From: Rob Tillaart Date: Thu, 9 Dec 2021 15:39:23 +0100 Subject: [PATCH] update readme.md (#12) --- ACS712.cpp | 3 ++- ACS712.h | 4 ++-- LICENSE | 2 +- README.md | 22 +++++++++++----------- keywords.txt | 6 +++++- library.json | 2 +- library.properties | 2 +- 7 files changed, 23 insertions(+), 18 deletions(-) diff --git a/ACS712.cpp b/ACS712.cpp index cc49d2b..c373083 100644 --- a/ACS712.cpp +++ b/ACS712.cpp @@ -1,7 +1,7 @@ // // FILE: ACS712.cpp // AUTHOR: Rob Tillaart, Pete Thompson -// VERSION: 0.2.5 +// VERSION: 0.2.6 // DATE: 2020-08-02 // PURPOSE: ACS712 library - current measurement // @@ -18,6 +18,7 @@ // updated build CI, readme.md // 0.2.4 2021-11-22 add experimental detectFrequency() // 0.2.5 2021-12-03 add timeout to detectFrequency() +// 0.2.6 2021-12-09 update readme.md + license #include "ACS712.h" diff --git a/ACS712.h b/ACS712.h index 876c837..b90de71 100644 --- a/ACS712.h +++ b/ACS712.h @@ -2,7 +2,7 @@ // // FILE: ACS712.h // AUTHOR: Rob Tillaart, Pete Thompson -// VERSION: 0.2.5 +// VERSION: 0.2.6 // DATE: 2020-08-02 // PURPOSE: ACS712 library - current measurement // @@ -12,7 +12,7 @@ #include "Arduino.h" -#define ACS712_LIB_VERSION (F("0.2.5")) +#define ACS712_LIB_VERSION (F("0.2.6")) // ACS712_FF_SINUS == 1.0/sqrt(2) == 0.5 * sqrt(2) diff --git a/LICENSE b/LICENSE index 8eba944..c3d6b3d 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2020-2021 Rob Tillaart +Copyright (c) 2020-2022 Rob Tillaart Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/README.md b/README.md index 787a44c..4c0fcf2 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ # ACS712 -Library for the ACS712 Current Sensor - 5A, 20A, 30A +Library for the ACS712 Current Sensor - 5A, 20A, 30A. ## Description @@ -22,13 +22,14 @@ There are 2 core functions: - **int mA_AC(float freq = 50)** The frequency can be set to typically 50 or 60 Hz however other values e.g. 50.1 or 40 or 123.456 are possible. -To measure DC current a single **analogRead()** with some conversion maths is sufficient to get +To measure DC current a single **analogRead()** with conversion maths is sufficient to get a value. To stabilize the signal **analogRead()** is called twice. To measure AC current **a blocking loop for 20 milliseconds** is run to determine the peak to peak value which is converted to the RMS value. To convert the peak2peak value to RMS one need the so called crest or form factor. This factor depends heavily on the signal form. For a perfect sinus the value is sqrt(2)/2 == 1/sqrt(2). +See Form factor below. ## Interface @@ -41,7 +42,7 @@ It defaults a 20 A type sensor, which is defined by the default value of mVperA. Since version 0.2.2 frequencies other integer values than 50 and 60 are supported, the lower the frequency, the longer the blocking period. Since version 0.2.3 floating point frequencies are supported to tune optimally. -- **int mA_DC()** blocks < 1 ms as it just needs one **analogRead()**. +- **int mA_DC()** blocks < 1 ms (Arduino UNO) as it just needs one **analogRead()**. | type sensor | mVperA | LSB 5V-10bit | @@ -69,7 +70,7 @@ Also known as crest factor; affects AC signals only. - **void setFormFactor(float ff = ACS712_FF_SINUS)** manually sets form factor, must be between 0.0 and 1.0 - **float getFormFactor()** returns current form factor. -The library has a number of predefined form factors +The library has a number of predefined form factors: | definition | value | approx | notes | |:---------------------|:--------------|:------:|:--------| @@ -79,21 +80,22 @@ The library has a number of predefined form factors | | | | | It is important to measure the current with a calibrated multimeter -and determine / verify the form factor of the signal. This can help -to improve the quality of your measurements. +and determine / verify the form factor of the signal. +This can help to improve the quality of your measurements. #### Noise Default = 21 mV. -- **void setNoisemV(uint8_t noisemV = 21)** set noise level, is used to determine zero level e.g. in AC measurements. +- **void setNoisemV(uint8_t noisemV = 21)** set noise level, +is used to determine zero level e.g. in AC measurements. - **uint8_t getNoisemV()** returns the set value. #### mV per Ampere -Both for AC and DC. Is defined in the constructor and depends on +Both for AC and DC. Is defined in the constructor and depends on sensor used. - **void setmVperAmp(uint8_t mva)** sets the milliVolt per Ampere measured. - **uint8_t getmVperAmp()** returns the set value. @@ -117,8 +119,6 @@ to adjust. Testing with my UNO I got a factor 0.9986. Current version is not performance optimized. -Current version of detectFrequency can block forever. The second part has no timeout guard. - ## Test @@ -148,7 +148,7 @@ The examples show the basic working of the functions. - mA_AC blocks 20 ms so might affect task scheduling on a ESP32. This needs to be investigated. Probably need a separate thread that wakes up when new analogRead is available. -**detectFrequency** also blocks pretty long. +- **detectFrequency** also blocks pretty long. - int point2point(float freq) function for AC. Is part of mA_AC() already. Needs extra global variables, which are slower than local ones Or just cache the last p2p value? diff --git a/keywords.txt b/keywords.txt index ff847fd..1d00bb9 100644 --- a/keywords.txt +++ b/keywords.txt @@ -1,4 +1,4 @@ -# Syntax Coloring Map For ACS712 +# Syntax Colouring Map For ACS712 # Data types (KEYWORD1) ACS712 KEYWORD1 @@ -21,6 +21,10 @@ getNoisemV KEYWORD2 setmVperAmp KEYWORD2 getmVperAmp KEYWORD2 +detectFrequency KEYWORD2 +setMicrosAdjust KEYWORD2 +getMicrosAdjust KEYWORD2 + # Constants (LITERAL1) ACS712_LIB_VERSION LITERAL1 diff --git a/library.json b/library.json index 56a1051..bd8a690 100644 --- a/library.json +++ b/library.json @@ -21,7 +21,7 @@ "type": "git", "url": "https://github.com/RobTillaart/ACS712.git" }, - "version": "0.2.5", + "version": "0.2.6", "license": "MIT", "frameworks": "arduino", "platforms": "*", diff --git a/library.properties b/library.properties index 7216624..4d6880c 100644 --- a/library.properties +++ b/library.properties @@ -1,5 +1,5 @@ name=ACS712 -version=0.2.5 +version=0.2.6 author=Rob Tillaart , Pete Thompson maintainer=Rob Tillaart sentence=ACS712 library for Arduino.