Program for reading data from one (or two) ACS712 (current sense amplifier). Read the configuration before trying it.

Dependencies:   mbed

This program aims at implementing a simple current reader which, sensing from an ACS712, prints on the USB port the average of n samples.

The program can be configured at compile-time by setting few defines:

  • the number of channels: either only p20 or the sum of p19 and p20;
  • the number of samples to read before printing their average
  • the operating mode:
    • PIN_TRIGGERED: read a handful of samples when the pin p9 rises
    • USER_TRIGGERED: start reading when the user presses the character 's'
    • ENDLESS_READ: read continuosly

First of all, when the program starts, it read a bunch of samples and then sets their mean value as reference. This means that the software assumes that when such a reference value is read, there is no current absorption.

Download repository: zip gz

Files at revision 0:36d465acb1a2

Name Size Actions
[up]
main.cpp 3272 Revisions Annotate
mbed.bld 65 Revisions Annotate