AlexanderTonn / SolarPowerhouse

Solar balkony power plant, which includes control logic for switching between micro inverter and battery depending on the state of charge. The repository containing any drawings and manuals.
Apache License 2.0
0 stars 0 forks source link

[BUG] ADS1115 measuring SCT013 not properly #10

Closed AlexanderTonn closed 11 months ago

AlexanderTonn commented 11 months ago

:bug: Describe the bug

 :bangbang: To Reproduce**

Steps to reproduce the behavior:

:interrobang: Expected behavior

:camera: Screenshots

If applicable, add screenshots to help explain your problem.

:computer: Desktop (please complete the following information):**

 :iphone: Smartphone (please complete the following information):**

Additional context

Add any other context about the problem here.

AlexanderTonn commented 11 months ago

The solution was to set up the highest data Rate of ADS1115. In the documentation of powerUC the author is also describing that a higher sample rate is necessary

void setup() {
// ... 
ads1.setGain(GAIN_TWO);
ads2.setGain(GAIN_TWO);
ads1.setDataRate(RATE_ADS1115_860SPS);
ads2.setDataRate(RATE_ADS1115_860SPS);
// ...
}

Quote of official Doc of powerUC:

If you use a component with SCT013 with ±1V RMS output and ADS1115, the required code is similar to the code we see in >the input to the ADS1115. You need to consult the Adafruit library for ADS1115.

In order to sample the ADS1115 at a higher speed, we need to modify the file, ‘Adafruit_ADS1015.h’.

With this modification, we will be able to reduce the sampling time from about 8-9 milliseconds (about 100 hertz) to about >1.8 milliseconds (about 500 hertz). As we leave the Nyquist frequency, we improve the measurement behavior.