Simple library for Allegro ACS37800 current and voltage sensor
Find a file
2023-08-09 19:28:11 +02:00
Inc Initial commit 2023-08-09 11:22:26 +02:00
Src Initial commit 2023-08-09 11:22:26 +02:00
LICENSE.md Create LICENSE.md 2023-08-09 19:28:11 +02:00
README.md update readme 2023-08-09 11:36:23 +02:00

STM32 library for Allegro ACS37800

Simple library that contains the essential functions like measuring RMS and instantaneous voltage and current.

Usage

Setup

The device can be set up by declaring the acs37800_t type

acs37800_t sensor;

The parameters for the sensor then needs to be set

sensor.divRes = 2000000;
sensor.i2c_address = 0x60;
sensor.i2c_device = &hi2c1;
sensor.senseRes = 3200;
sensor.maxCurrent = 90;
sensor.maxVolt = 160;

Set bypass n_enable if measuring DC and set amount of samples, (and write same to eeprom with third parameter (optional))

acs_setBybassNenable(&sensor, true, true);
acs_setNumberOfSamples(&sensor, 1023, true);

For DC, read instant current and voltage

acs_getInstCurrVolt(&sensor, &current1, &voltage1);

For AC, read RMS

acs_getRMS(&sensor, &current1, &voltage1);