From 64fae55e08452e454f57f852a57c16196750e1d7 Mon Sep 17 00:00:00 2001 From: Walt Sorensen Date: Fri, 26 Aug 2016 10:49:31 -0600 Subject: [PATCH] Add notes about PWM freq making current readings unreliable. - Added notes about how the PWM frequency can make the current readings unreliable. (from parent library) --- README.md | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 006998b..2c8f56c 100644 --- a/README.md +++ b/README.md @@ -162,7 +162,26 @@ Version History - 1.0.1 (2011-11-07): Adds support for Arduinos not based on ATmega168/328. - 1.0.0 (2011-10-28): Original release. -Notes about timers: +### Current readings +------------------- + +The current readings returned by `getM1CurrentMilliamps` and +`getM2CurrentMilliamps` will be noisy and unreliable if you are using +a PWM frequency below about 5 kHz. We expect these readings to +work fine if you are using a board based on the ATmega168, ATmega328P, +or ATmega32U4, since this library uses 20 kHz hardware PWM on +those boards. + +On other boards, this library uses `analogWrite` to generate PWM +signals, which usually means that the PWM frequency will be too low to +get reliable current measurements. If `analogWrite` uses a frequency +of 490 Hz or more on your board, you can add a 1 µF +(or larger) capacitor between each current sense line you are using +and GND. To make `getM1CurrentMilliamps` work well, you would add the +capacitor between M1CS and GND. To make `getM2CurrentMilliamps` work +well, you would add the capacitor between M2CS and GND. + +### Notes about timers: ------------------- - Timer0 is used by the functions millis(), delay(), micros() and delayMicroseconds(),