measurement of AC current and voltage and DC current and voltage

Hello every body,

I have starter my first bigger project with arduino to measure AC and DC current and voltage. I am using this modules to measure AC current ACS712, AC Voltage FZ1440, DC current ACS758 and DC voltage over voltage divider.

And my problem is all this modules are connected to analog ports and if I run them separately they work fine and every module is connected to a different port (specified in code), but when I connect them all together I have really not usably informations, then the information I get are changing every second. what could I do... thanks

post schematics,screenshot of serial monitor and photos of your circuit.

Ok, ok I will when I get home... Thank you for now

schematics…
and Links to all the info about modules and code that I used

http://henrysbench.capnfatz.com/henrys-bench/acs712-arduino-ac-current-tutorial/

http://henrysbench.capnfatz.com/henrys-bench/acs758-arduino-current-sensor-tutorial/

Avtomatizacija_prikolice AC_DC.pdf (269 KB)

This is my code for it: it is not all in english but still I hope you will understand

// Merjenje AC toka z modulom ACS712
const int sensorInAC = A0;
int mVperAmpAC = 185; // use 100 for 20A Module and 66 for 30A Module
double VoltageAC = 0;
double VRMS_AC = 0;
double AmpsRMS_AC = 0;

float getVPP_AC()
{
float resultAC;
int readValueAC; //value read from the sensor
int maxValueAC = 0; // store max value here
int minValueAC = 1024; // store min value here
uint32_t start_time = millis();
while((millis()-start_time) < 100) //sample for 1 Sec
{
readValueAC = analogRead(sensorInAC);
// see if you have a new maxValue
if (readValueAC > maxValueAC)
{
/record the maximum sensor value/
maxValueAC = readValueAC;
}
if (readValueAC < minValueAC)
{
/record the maximum sensor value/
minValueAC = readValueAC;
}
}

// Subtract min from max
resultAC = ((maxValueAC - minValueAC) * 5.0)/1024.0;

return resultAC;
}

// merjenje AC napetosti z modulom
const int sensorInAC_U = A1;
double sensorValueAC=0;
double sensorValue1AC=0;
int crosscountAC=0;
int climbhillAC=0;
double VmaxD_AC=0;
double VeffD_AC;
double VeffAC;

// merjenje DC toka
const int analogInI_DC = A2;
int mVperAmpI_DC = 13.3; // See Scale Factors Below
int ACSoffsetI_DC = 2500; // See offsets below
int RawValueI_DC = 0;
double VoltageI_DC = 0;
double AmpsI_DC = 0;

// Voltmeter DC setup
int analogInputDC_U = A3;
float voutDC_U = 0.0;
float vinDC_U = 0.0;
float R1_DC_U = 100000.0; // resistance of R1 (100K) -see text!
float R2_DC_U = 10000.0; // resistance of R2 (10K) - see text!
int valueDC_U = 0;

void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
}

void loop() {
// put your main code here, to run repeatedly:
merjenjeAC_I();
merjenjeAC_U();
merjenjeDC_I();
merjenjeDC_U();
Serial.print ("AC I: ");
Serial.println (AmpsRMS_AC);
// Serial.println (vinDC);
Serial.print ("AC U: ");
Serial.println (VeffAC);
Serial.print ("DC I: ");
Serial.println (AmpsI_DC);
Serial.print ("DC U: “);
Serial.println (vinDC_U);
Serial.println (” ");
delay(1500);
}

void merjenjeAC_I(){
// merjenje AC toka
VoltageAC = getVPP_AC();
VRMS_AC = (VoltageAC/2.0) *0.707;
AmpsRMS_AC = (VRMS_AC * 1000)/mVperAmpAC;
}

float merjenjeAC_U(){
// merjenje AC napetosti
sensorValue1AC=sensorValueAC;
delay(100);
sensorValueAC = analogRead(sensorInAC_U);
if (sensorValueAC>sensorValue1AC && sensorValueAC>511){
climbhillAC=1;
VmaxD_AC=sensorValueAC;
}
if (sensorValueAC<sensorValue1AC && climbhillAC==1){
climbhillAC=0;
VmaxD_AC=sensorValue1AC;
VeffD_AC=VmaxD_AC/sqrt(2);
VeffAC=(((VeffD_AC-420.76)/-90.24)*-210.2)+210.2;
// Serial.println(VeffAC);
VmaxD_AC=0;
}
}

void merjenjeDC_I(){
//merjenje DC toka
RawValueI_DC = analogRead(analogInI_DC);
VoltageI_DC = (RawValueI_DC / 1024.0) * 5000; // Gets you mV
AmpsI_DC =(0 + ((VoltageI_DC - ACSoffsetI_DC) / mVperAmpI_DC));
// AmpsI_DC = AmpsI_DC - 18.78;
//if (AmpsI_DC<0.0) {
// AmpsI_DC=0.0;
// }
}

void merjenjeDC_U(){
// Merjenje DC napetosti
valueDC_U = analogRead(analogInputDC_U);
voutDC_U = (valueDC_U * 5.0) / 1024.0; // see text
vinDC_U = (voutDC_U / (R2_DC_U/(R1_DC_U+R2_DC_U))+1);
if (vinDC_U<0.09) {
vinDC_U=0.0;//statement to quash undesired reading !
}
}

and screenshot of serial

nobody?!? :o

What are you doing to reduce noise?

Did you know that it is a wise idea to take a few readings and ignoring the first few, to allow a particular analog input to settle?

I see your program looks for and saves only the highest and lowest values. What are you doing to ensure you aren't just reading noise peaks?

for the output signal of this FZ1440 see attachment

Hi Try to ground the arduino properly means sepratly. Then your analog inputs not get raw values or mixed up. Thanks.