I am new with SCT013 but I managed to work with an Uno. The next step is to switch to an ESP32 for sending the data to a server. Here comes the problem.
Maybe there is some solution for this here, but I didn’t find it. So here it goes…
When I use the very bone sketch for getting the data from the CT, it works like a charm.
// EmonLibrary examples openenergymonitor.org, Licence GNU GPL V3
#include "EmonLib.h" // Include Emon Library
EnergyMonitor emon1; // Create an instance
void setup()
{
Serial.begin(9600);
emon1.current(1, 111.1); // Current: input pin, calibration.
}
void loop()
{
double Irms = emon1.calcIrms(1480); // Calculate Irms only
Serial.print(Irms*230.0); // Apparent power
Serial.print(" ");
Serial.println(Irms); // Irms
}
This outputs the data. I tied the CT to a pin 15, which is an analog pin on ESP32.
However, when I add the WiFi.begin(SSID, pass); in the setup function, it stops outputting the data. Is there any work arround?
I have read - I cannot remember where - that this is a known problem. It might have been here:
opened 08:04PM - 15 Dec 16 UTC
closed 02:48PM - 16 Jul 21 UTC
Type: For reference
Is anyone seeing a conflict with analogRead() values when **_#include <WiFi.h>_*… * is included in a sketch? analogRead works great without WiFi.h included; however, if WiFi.h is included then the analogRead values returned are all maxed out (4096 values). Note I've tested on pins 12, 14, 26 & 27.
We generally do not recommend the ESP 32 for analogue processing, see these comments that relate particularly to noise and linearity problems.:
opened 09:19PM - 14 Dec 16 UTC
Type: Bug
Hi,
I'm testing the ESP32's ADC on the SparkFun ESP32 Thing.
Currently my me… asure seems very noisy, it constantly varies on the 5 first bits, and the zero value is around 90mV.
Is there a way to achieve better accuracy?
My test code :
```
adc1_config_width(ADC_WIDTH_12Bit);
adc1_config_channel_atten(ADC1_CHANNEL_7, ADC_ATTEN_0db);
while (true) {
vTaskDelay(300 / portTICK_PERIOD_MS);
printf("ADC value : %x\n", adc1_get_voltage(ADC1_CHANNEL_7));
}
```
Thank you in advance for your help.
opened 08:04PM - 15 Dec 16 UTC
closed 02:48PM - 16 Jul 21 UTC
Type: For reference
Is anyone seeing a conflict with analogRead() values when **_#include <WiFi.h>_*… * is included in a sketch? analogRead works great without WiFi.h included; however, if WiFi.h is included then the analogRead values returned are all maxed out (4096 values). Note I've tested on pins 12, 14, 26 & 27.
It says a lot.
I tried a few workarounds but not any progress.