Hi,
I'm going to make a sensor board with 12 ACS712-5A modules and 3 PCF8591T modules. I want to use I2C communication to connect them to one bus. So, I will connect 4 ACS712-5A to each of one PCF8591T module.
But I can not be sure I am using correct code in Arduino.
This is my code.
#include<Wire.h>
#define PCF8591 (0x90 >> 1)
#define AIn0 0x00
byte Value0;
float Volt=0;
float Amps=0;
void setup() {
Wire.begin();
Serial.begin(9600);
}
void loop() {
Wire.beginTransmission(PCF8591);
Wire.write(AIn0);
Wire.endTransmission();
Wire.requestFrom(PCF8591, 1);
Value0=Wire.read();
Volt=(Value0/1024.0)*5.0;
Amps=(Volt-2.5)/0.185);
Serial.print("ADC1 Value=");
Serial.println(Amps);
delay(1000);
}