Simple library for Allegro ACS37800 current and voltage sensor
| Inc | ||
| Src | ||
| LICENSE.md | ||
| README.md | ||
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, ¤t1, &voltage1);
For AC, read RMS
acs_getRMS(&sensor, ¤t1, &voltage1);