درود . این ماژول برای ولتاژ AC و DC قابل استفاده است . تفاوتی در اتصال ماژول وجود ندارد . تنها در برنامه آردوینو باید تغییراتی صورت پذیرد .
برای اتصال ماژول به این طریق عمل کنید .
برای دیدن سایز بزرگ روی عکس کلیک کنید

نام: ACS758-Arduino-Tutorial-Connections.jpg
مشاهده: 335
حجم: 22.7 کیلو بایت
در صورتی که سیم ها جابجا متصل شوند عدد خروجی منفی خواهد بود .
کد برنامه آردوینو برای ولتاژ DC شامل تنظیماتی هست که طبق جدول زیر باید عمل شود .
برای دیدن سایز بزرگ روی عکس کلیک کنید

نام: 111.JPG
مشاهده: 267
حجم: 41.7 کیلو بایت

و در نهایت کد برنامه
کد:
const int analogIn = A0;

// Set your scale factor
int mVperAmp = 40; // See Scale Factors Below

/* Scale Factors
50A bi-directional = 40
50A uni-directional = 60
100A bi-directional = 20
100A uni-directional = 40
150A bi-directional = 13.3
150A uni-directioal = 26.7
200A bi-directional = 10
200A uni-directional = 20
*/

// Set you Offset
int ACSoffset = 2500; // See offsets below

/* Offsets
If bi-directional = 2500
If uni- directional = 600
*/

int RawValue= 0;
double Voltage = 0;
double Amps = 0;

void setup(){ 
 Serial.begin(9600);
}

void loop(){
 
 RawValue = analogRead(analogIn);
 Voltage = (RawValue / 1023.0) * 5000; // Gets you mV
 Amps = ((Voltage - ACSoffset) / mVperAmp);
 
 Serial.print("Raw Value = " ); // shows pre-scaled value 
 Serial.print(RawValue); 
 Serial.print("\t mV = "); // shows the voltage measured 
 Serial.print(Voltage,3); // the '3' after voltage allows you to display 3 digits after decimal point
 Serial.print("\t Amps = "); // shows the voltage measured 
 Serial.println(Amps,3); // the '3' after voltage allows you to display 3 digits after decimal point
 delay(2500); 
 
}