You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+52-21
Original file line number
Diff line number
Diff line change
@@ -26,6 +26,8 @@ Not yet available as Arduino library.
26
26
27
27
</div>
28
28
29
+
#### If you find this library useful, please give it a star.
30
+
29
31
<br/>
30
32
31
33
# Table of content
@@ -79,40 +81,62 @@ Using the [more exact formula](https://github.com/MakeMagazinDE/DigitaleFilter/b
79
81
The **maximum output value for integer filters** is: InputValue - ((1 << (ShiftValue -1)) -1), i.e **85 for InputValue 100 and ShiftValue 5** (Lowpass5).
80
82
81
83
### The [SimpleEMAFilters.hpp](https://github.com/ArminJo/Arduino-Utils/blob/master/src/SimpleEMAFilters.hpp#L66) contains:
82
-
- A fixed set of 6 **ultrafast** EMA (Exponential Moving Average) filters which require only **1 to 2 microseconds**.
83
-
- 3 derived filters (highpass and 2 bandpasses) by just subtracting one lowpass from input (highpass) or from another lowpass (bandpass).
84
+
- A set of **ultrafast** EMA (Exponential Moving Average) filters which require only **1 to 2 microseconds**.
85
+
- 3 highpass and bandpass filters, generated by just subtracting one lowpass from input (highpass) or from another lowpass (bandpass).
86
+
- 16 and 32 bit Biquad filters.
84
87
- Display routines for Arduino Plotter.
85
88
86
89
All implemented filters are applied at once to the input test signal calling `doFiltersStep(int16_t aInput)` and the results can in turn easily be displayed in the Arduino Plotter.
87
90
88
-
### Plotter outputs representing e.g. a 40, 20, 10, 5 Hz square / sine wave at a sample rate of 1 ms (or 80, 40 ... Hz at 0.5 ms and so on)
91
+
### Plotter outputs representing e.g. a 42, 21, 10.5, 5.2 Hz square / sine wave at a sample rate of 1 ms (or 84, 42 ... Hz at a sample rate of 0.5 ms and so on)
92
+
93
+
Arduino Plotter output for a rectangle input signal with a amplitude of +/- 100. E.g. LowP3 is the Lowpass with alpha 1/8 implemented by `>> 3` and the cutoff frequency of 21 Hz.
Arduino Plotter output for a rectangle input signal with a amplitude of +/- 100. E.g. Lowpass3 is the one with alpha 1/8 implemented by `>> 3` and the cutoff frequency of 21 Hz.
92
-
<br/><br/>
93
96
Note the following facts:
94
97
- Highpass is always Input - Lowpass.
95
-
- The Bandpass1_3 has an overshoot.
96
-
- The 2 Lowpass3 and the 2 Lowpass5 lines are overlapping each other for this (high) amplitude.
98
+
- Therefore highpass -here HighP3_16- can have an overshoot of 100%.
97
99
- The output of DoubleLowpass3 and 4 is more and more resembling a delayed sine.
98
-
- The output of Lowpass5 and DoubleLowpass4 have almost the same amplitude but DoubleLowpass4 is way more resembling a (delayed) sine.
99
-
- The output of TripleLowpass3 has a higher amplitude than DoubleLowpass4 with both looking quite like a (delayed) sine.
100
+
- The output of LowP5_32 and DoubleLowP4_16 have almost the same amplitude but DoubleLowP4_16 is way more resembling a (delayed) sine.
101
+
- The output of TripleLowP3_16 has a higher amplitude than DoubleLowP4_16 with both looking quite like a (delayed) sine.
Arduino Plotter output for a rectangle input signal with very low amplitude of +/- 20 where you see clipping effects due to the limited resolution of the used 16 bit math.<br/>
105
+
Arduino Plotter output for a rectangle input signal with very low amplitude of +/- 20 where you see clipping effects due to the limited resolution of the used 16 bit math.
The Lowpass3_int32 and Lowpass5_int32 are 32 bit fixed point implementations for higher resolution which requires **4.2 µs instead of the 1.8 / 2.5 µs of 16 bit**.
| Bandpass and reject filters.<br/>Bandpass is generated by subtracting one lowpass from onother with different shift value.<br/>Reject filter is input minus bandpass.| High order Lowpass. |
| LowPass1, 3, 5 and 8.<br/>Lowpass8 behave like a integrator here, resulting in a triangle output. | LowPass3, 5 and 8.<br/>Comparison of different implementations with 16 bit integer, 32 bit integer and 32 bit float. |
| BiQuad filters with damping factor = 0.<br/>You see the overshoot. ||
138
+
|||
139
+
116
140
117
141
The floating point implementation of the 1/32 EMA filter takes **24 to 34 µs**.<br/>
118
142
There are convenience functions implemented for EMA filter, but normally it is better to implement it inline by e.g.
@@ -190,6 +214,15 @@ First voltage is measured. If voltage is zero, then the unknown resistance to gr
190
214
- Sleep and sleep with watchdog functions.
191
215
- Available Ram, Heap / Stack memory display.
192
216
217
+
RAM starts of variables initialized with values != 0, followed by variables initialized with 0 and variables not initialized by using attribute `__attribute__((section(".noinit")))`. It ends with the heap and the stack.
218
+
219
+
#### Sample output if stack runs into data
220
+
```
221
+
Size of Data + BSS, Heap start, Stack end=2041
222
+
Stack used 20 of 7
223
+
Currently available Heap=0
224
+
```
225
+
193
226
# MillisUtils.cpp
194
227
Unifies millis() timer handling for Digispark, AttinyCore and Arduino cores.
195
228
- Start, stop and modify milliseconds timer and value.
@@ -265,5 +298,3 @@ The library examples are tested with GitHub Actions for the following boards:
265
298
- Arduino Leonardo
266
299
- Digispark (using ATTiny85 @1MHz)
267
300
- Generic ATTiny85 @1MHz
268
-
269
-
#### If you find this library useful, please give it a star.
0 commit comments