Hello everyone,
Before I ask my question, a quick look at what I am currently working on.
I try to do an automatic control of my dust collection in my workshop.
If one machine runs, the CT sensor reads it, the dust extration starts and the blast gate opens using a pneumatic cylinder.
I just started to do the sketch and yet I have a problem. I would like to use the EmonLib to measure the current. If the measured current rises above a certain reading (in my case 1), a pneumatic valve is switched, to open the blast gate. So I don’t care if the readings are exact, I just want to know if the machine is switched on or not.
If I am using only one CT everything works fine but I can’t manage to include a second one to the sketch (in future there will be 8 of them)
The second CT shows a much higher value even if the CT is not attached and doesn’t change if a current is flowing. I checked if it’s a hardware problem, but both CT’s work fine if I run them separately.
It must be a software problem, would you please check my sketch?
Thank you! Greetings, David
#include "EmonLib.h" // Include Emon Library
EnergyMonitor emon1, emon2; // Create an instance
void setup()
{
Serial.begin(9600);
pinMode(30, OUTPUT);
pinMode(31, OUTPUT);
digitalWrite(30, HIGH);
digitalWrite(31, HIGH);
emon1.current(A0, 111.1); // Current: input pin, calibration.
emon2.current(A1, 111.1);
}
void loop(){
double Irms1 = emon1.calcIrms(1480); // Calculate Irms only
Serial.println(Irms1); // Irms
if(Irms1 > 1)
{digitalWrite(30, LOW);}
else
{digitalWrite(30, HIGH);}
double Irms2 = emon2.calcIrms(1480);
Serial.println(Irms2);
if(Irms2 > 1)
{digitalWrite(31, LOW);}
else
{digitalWrite(31, HIGH);}
}