Skip to content

Commit

Permalink
Add notes about PWM freq making current readings unreliable.
Browse files Browse the repository at this point in the history
- Added notes about how the PWM frequency can make the current readings unreliable. (from parent library)
  • Loading branch information
photodude authored Aug 26, 2016
1 parent 8354544 commit 64fae55
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand Down

0 comments on commit 64fae55

Please sign in to comment.