SlideShare a Scribd company logo
1 of 4
Currentsensorbase project
1.AC cureentmeasure bycurrentsensormodiul
Links>>>>>>>>>>http://circuits4you.com/2016/05/13/ac-current-measurement-acs712/
Circuit>>>>>>>>>>>>
Program>>>>>>>
/*
Measuring AC Current Using ACS712
www.circuits4you.com
*/
const int sensorIn = A0;
int mVperAmp = 185; // use 100 for 20A Module and 66 for 30A Module
double Voltage = 0;
double VRMS = 0;
double AmpsRMS = 0;
void setup(){
Serial.begin(9600);
}
void loop(){
Voltage = getVPP();
VRMS = (Voltage/2.0) *0.707; //root 2 is 0.707
AmpsRMS = (VRMS * 1000)/mVperAmp;
Serial.print(AmpsRMS);
Serial.println(" Amps RMS");
}
float getVPP()
{
float result;
int readValue; //value read from the sensor
int maxValue = 0; // store max value here
int minValue = 1024; // store min value here
uint32_t start_time = millis();
while((millis()-start_time) < 1000) //sample for 1 Sec
{
readValue = analogRead(sensorIn);
// see if you have a new maxValue
if (readValue > maxValue)
{
/*record the maximum sensor value*/
maxValue = readValue;
}
if (readValue < minValue)
{
/*record the minimum sensor value*/
minValue = readValue;
}
}
// Subtract min from max
result = ((maxValue - minValue) * 5.0)/1024.0;
return result;
}
DC Current Measurement using ASC712-05A
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
/*
Measuring Current Using ACS712
www.circuits4you.com
*/
const int analogIn = A0;
double mVperAmp = 185; // use 100 for 20A Module and 66 for 30A Module
double RawValue= 0;
double ACSoffset = 2500;
double Voltage = 0;
double Amps = 0;
void setup(){
Serial.begin(9600);
}
void loop(){
RawValue = analogRead(analogIn);
Voltage = (RawValue / 1024.0) * 5000; // Gets you mV
Amps = ((Voltage - ACSoffset) / mVperAmp);
Serial.print("Amps = "); // shows the voltage measured
Serial.println(Amps,2); // the '2' after voltage allows you to display 2 digits after decimal
point
delay(1000);
}

More Related Content

What's hot

What's hot (6)

Corrected1
Corrected1Corrected1
Corrected1
 
40 MVA TX
40 MVA TX40 MVA TX
40 MVA TX
 
SPICE MODEL of RE-260 in SPICE PARK
SPICE MODEL of RE-260 in SPICE PARKSPICE MODEL of RE-260 in SPICE PARK
SPICE MODEL of RE-260 in SPICE PARK
 
PIU PMS Automation
PIU PMS AutomationPIU PMS Automation
PIU PMS Automation
 
Transistion from TVSS to SPD
Transistion from TVSS to SPDTransistion from TVSS to SPD
Transistion from TVSS to SPD
 
LM555
LM555LM555
LM555
 

Similar to Current sensor base project

MaxBotix Code Examples
MaxBotix Code ExamplesMaxBotix Code Examples
MaxBotix Code ExamplesMaxBotix Inc
 
ADCMT DC Voltage Current Source/Monitor 6247C / 6247G denkei
ADCMT DC Voltage Current Source/Monitor 6247C / 6247G denkeiADCMT DC Voltage Current Source/Monitor 6247C / 6247G denkei
ADCMT DC Voltage Current Source/Monitor 6247C / 6247G denkeiNIHON DENKEI SINGAPORE
 
A project report on Remote Monitoring of a Power Station using GSM and Arduino
A project report on Remote Monitoring of a Power Station using GSM and ArduinoA project report on Remote Monitoring of a Power Station using GSM and Arduino
A project report on Remote Monitoring of a Power Station using GSM and ArduinoJawwad Sadiq Ayon
 
IISC CPDM Task 1 Report
IISC CPDM Task 1 ReportIISC CPDM Task 1 Report
IISC CPDM Task 1 ReportPARNIKA GUPTA
 
Arduino Lecture 3 - Interactive Media CS4062 Semester 2 2009
Arduino Lecture 3 - Interactive Media CS4062 Semester 2 2009Arduino Lecture 3 - Interactive Media CS4062 Semester 2 2009
Arduino Lecture 3 - Interactive Media CS4062 Semester 2 2009Eoin Brazil
 
Arduino Lecture 3 - Interactive Media CS4062 Semester 2 2009
Arduino Lecture 3 - Interactive Media CS4062 Semester 2 2009Arduino Lecture 3 - Interactive Media CS4062 Semester 2 2009
Arduino Lecture 3 - Interactive Media CS4062 Semester 2 2009Eoin Brazil
 
What will be quantization step size in numbers and in voltage for th.pdf
What will be quantization step size in numbers and in voltage for th.pdfWhat will be quantization step size in numbers and in voltage for th.pdf
What will be quantization step size in numbers and in voltage for th.pdfSIGMATAX1
 
Operational Amplifier Design
Operational Amplifier DesignOperational Amplifier Design
Operational Amplifier DesignBharat Biyani
 
Exercise 1 – Three-Phase, Variable-Frequency Induction-Motor D.docx
Exercise 1 – Three-Phase, Variable-Frequency Induction-Motor D.docxExercise 1 – Three-Phase, Variable-Frequency Induction-Motor D.docx
Exercise 1 – Three-Phase, Variable-Frequency Induction-Motor D.docxelbanglis
 
Exercise 1 – Three-Phase, Variable-Frequency Induction-Motor D.docx
Exercise 1 – Three-Phase, Variable-Frequency Induction-Motor D.docxExercise 1 – Three-Phase, Variable-Frequency Induction-Motor D.docx
Exercise 1 – Three-Phase, Variable-Frequency Induction-Motor D.docxrhetttrevannion
 
LED電源回路アプリケーションガイド 金沢プレゼン資料
LED電源回路アプリケーションガイド 金沢プレゼン資料LED電源回路アプリケーションガイド 金沢プレゼン資料
LED電源回路アプリケーションガイド 金沢プレゼン資料Tsuyoshi Horigome
 
Design and Control of HESS based PEV
Design and Control of  HESS based PEVDesign and Control of  HESS based PEV
Design and Control of HESS based PEVMalyala Varun
 
Application of AGPU for Matrix Converters
Application of AGPU for Matrix ConvertersApplication of AGPU for Matrix Converters
Application of AGPU for Matrix ConvertersIAES-IJPEDS
 
SPICE活用入門 (02AUG2013)
SPICE活用入門 (02AUG2013)SPICE活用入門 (02AUG2013)
SPICE活用入門 (02AUG2013)Tsuyoshi Horigome
 
Brymen BM157 BM357 User's Manual
Brymen BM157 BM357 User's ManualBrymen BM157 BM357 User's Manual
Brymen BM157 BM357 User's Manualdegarden
 
Design and Implementation of Two Stage Operational Amplifier
Design and Implementation of Two Stage Operational AmplifierDesign and Implementation of Two Stage Operational Amplifier
Design and Implementation of Two Stage Operational AmplifierIRJET Journal
 
Adcmt catalog 6253-e-denkei DC Voltage Current Source Monitor
Adcmt catalog 6253-e-denkei  DC Voltage Current Source MonitorAdcmt catalog 6253-e-denkei  DC Voltage Current Source Monitor
Adcmt catalog 6253-e-denkei DC Voltage Current Source MonitorNIHON DENKEI SINGAPORE
 

Similar to Current sensor base project (20)

MaxBotix Code Examples
MaxBotix Code ExamplesMaxBotix Code Examples
MaxBotix Code Examples
 
ADCMT DC Voltage Current Source/Monitor 6247C / 6247G denkei
ADCMT DC Voltage Current Source/Monitor 6247C / 6247G denkeiADCMT DC Voltage Current Source/Monitor 6247C / 6247G denkei
ADCMT DC Voltage Current Source/Monitor 6247C / 6247G denkei
 
A project report on Remote Monitoring of a Power Station using GSM and Arduino
A project report on Remote Monitoring of a Power Station using GSM and ArduinoA project report on Remote Monitoring of a Power Station using GSM and Arduino
A project report on Remote Monitoring of a Power Station using GSM and Arduino
 
IISC CPDM Task 1 Report
IISC CPDM Task 1 ReportIISC CPDM Task 1 Report
IISC CPDM Task 1 Report
 
Arduino Lecture 3 - Interactive Media CS4062 Semester 2 2009
Arduino Lecture 3 - Interactive Media CS4062 Semester 2 2009Arduino Lecture 3 - Interactive Media CS4062 Semester 2 2009
Arduino Lecture 3 - Interactive Media CS4062 Semester 2 2009
 
Arduino Lecture 3 - Interactive Media CS4062 Semester 2 2009
Arduino Lecture 3 - Interactive Media CS4062 Semester 2 2009Arduino Lecture 3 - Interactive Media CS4062 Semester 2 2009
Arduino Lecture 3 - Interactive Media CS4062 Semester 2 2009
 
Smart Energy Meter
Smart Energy MeterSmart Energy Meter
Smart Energy Meter
 
Pe lab converted
Pe lab convertedPe lab converted
Pe lab converted
 
What will be quantization step size in numbers and in voltage for th.pdf
What will be quantization step size in numbers and in voltage for th.pdfWhat will be quantization step size in numbers and in voltage for th.pdf
What will be quantization step size in numbers and in voltage for th.pdf
 
Operational Amplifier Design
Operational Amplifier DesignOperational Amplifier Design
Operational Amplifier Design
 
Exercise 1 – Three-Phase, Variable-Frequency Induction-Motor D.docx
Exercise 1 – Three-Phase, Variable-Frequency Induction-Motor D.docxExercise 1 – Three-Phase, Variable-Frequency Induction-Motor D.docx
Exercise 1 – Three-Phase, Variable-Frequency Induction-Motor D.docx
 
Exercise 1 – Three-Phase, Variable-Frequency Induction-Motor D.docx
Exercise 1 – Three-Phase, Variable-Frequency Induction-Motor D.docxExercise 1 – Three-Phase, Variable-Frequency Induction-Motor D.docx
Exercise 1 – Three-Phase, Variable-Frequency Induction-Motor D.docx
 
LED電源回路アプリケーションガイド 金沢プレゼン資料
LED電源回路アプリケーションガイド 金沢プレゼン資料LED電源回路アプリケーションガイド 金沢プレゼン資料
LED電源回路アプリケーションガイド 金沢プレゼン資料
 
Design and Control of HESS based PEV
Design and Control of  HESS based PEVDesign and Control of  HESS based PEV
Design and Control of HESS based PEV
 
Lm555
Lm555Lm555
Lm555
 
Application of AGPU for Matrix Converters
Application of AGPU for Matrix ConvertersApplication of AGPU for Matrix Converters
Application of AGPU for Matrix Converters
 
SPICE活用入門 (02AUG2013)
SPICE活用入門 (02AUG2013)SPICE活用入門 (02AUG2013)
SPICE活用入門 (02AUG2013)
 
Brymen BM157 BM357 User's Manual
Brymen BM157 BM357 User's ManualBrymen BM157 BM357 User's Manual
Brymen BM157 BM357 User's Manual
 
Design and Implementation of Two Stage Operational Amplifier
Design and Implementation of Two Stage Operational AmplifierDesign and Implementation of Two Stage Operational Amplifier
Design and Implementation of Two Stage Operational Amplifier
 
Adcmt catalog 6253-e-denkei DC Voltage Current Source Monitor
Adcmt catalog 6253-e-denkei  DC Voltage Current Source MonitorAdcmt catalog 6253-e-denkei  DC Voltage Current Source Monitor
Adcmt catalog 6253-e-denkei DC Voltage Current Source Monitor
 

More from Mahmud Hossain

More from Mahmud Hossain (10)

Introduction PLC
Introduction  PLCIntroduction  PLC
Introduction PLC
 
Input-output system
Input-output systemInput-output system
Input-output system
 
Introduction Timer 2
Introduction  Timer 2Introduction  Timer 2
Introduction Timer 2
 
Introduction Timer
Introduction  TimerIntroduction  Timer
Introduction Timer
 
Introduction Sensor
Introduction  Sensor Introduction  Sensor
Introduction Sensor
 
Introduction Automation
Introduction AutomationIntroduction Automation
Introduction Automation
 
Power system
Power systemPower system
Power system
 
Machine
MachineMachine
Machine
 
password for wondershare
password for wondersharepassword for wondershare
password for wondershare
 
Viva q and ans
Viva q and ansViva q and ans
Viva q and ans
 

Recently uploaded

main PPT.pptx of girls hostel security using rfid
main PPT.pptx of girls hostel security using rfidmain PPT.pptx of girls hostel security using rfid
main PPT.pptx of girls hostel security using rfidNikhilNagaraju
 
Oxy acetylene welding presentation note.
Oxy acetylene welding presentation note.Oxy acetylene welding presentation note.
Oxy acetylene welding presentation note.eptoze12
 
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube ExchangerStudy on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube ExchangerAnamika Sarkar
 
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...srsj9000
 
SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )Tsuyoshi Horigome
 
Artificial-Intelligence-in-Electronics (K).pptx
Artificial-Intelligence-in-Electronics (K).pptxArtificial-Intelligence-in-Electronics (K).pptx
Artificial-Intelligence-in-Electronics (K).pptxbritheesh05
 
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...Soham Mondal
 
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdfCCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdfAsst.prof M.Gokilavani
 
Call Girls Narol 7397865700 Independent Call Girls
Call Girls Narol 7397865700 Independent Call GirlsCall Girls Narol 7397865700 Independent Call Girls
Call Girls Narol 7397865700 Independent Call Girlsssuser7cb4ff
 
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdfCCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdfAsst.prof M.Gokilavani
 
power system scada applications and uses
power system scada applications and usespower system scada applications and uses
power system scada applications and usesDevarapalliHaritha
 
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptxDecoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptxJoão Esperancinha
 
Introduction to Microprocesso programming and interfacing.pptx
Introduction to Microprocesso programming and interfacing.pptxIntroduction to Microprocesso programming and interfacing.pptx
Introduction to Microprocesso programming and interfacing.pptxvipinkmenon1
 
Call Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile serviceCall Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile servicerehmti665
 
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escortsranjana rawat
 
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort serviceGurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort servicejennyeacort
 
HARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IVHARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IVRajaP95
 
HARMONY IN THE HUMAN BEING - Unit-II UHV-2
HARMONY IN THE HUMAN BEING - Unit-II UHV-2HARMONY IN THE HUMAN BEING - Unit-II UHV-2
HARMONY IN THE HUMAN BEING - Unit-II UHV-2RajaP95
 
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...ranjana rawat
 

Recently uploaded (20)

main PPT.pptx of girls hostel security using rfid
main PPT.pptx of girls hostel security using rfidmain PPT.pptx of girls hostel security using rfid
main PPT.pptx of girls hostel security using rfid
 
Oxy acetylene welding presentation note.
Oxy acetylene welding presentation note.Oxy acetylene welding presentation note.
Oxy acetylene welding presentation note.
 
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube ExchangerStudy on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
 
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
 
SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )
 
Artificial-Intelligence-in-Electronics (K).pptx
Artificial-Intelligence-in-Electronics (K).pptxArtificial-Intelligence-in-Electronics (K).pptx
Artificial-Intelligence-in-Electronics (K).pptx
 
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
 
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdfCCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
 
Call Girls Narol 7397865700 Independent Call Girls
Call Girls Narol 7397865700 Independent Call GirlsCall Girls Narol 7397865700 Independent Call Girls
Call Girls Narol 7397865700 Independent Call Girls
 
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdfCCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
 
power system scada applications and uses
power system scada applications and usespower system scada applications and uses
power system scada applications and uses
 
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptxDecoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
 
Introduction to Microprocesso programming and interfacing.pptx
Introduction to Microprocesso programming and interfacing.pptxIntroduction to Microprocesso programming and interfacing.pptx
Introduction to Microprocesso programming and interfacing.pptx
 
Call Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile serviceCall Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile service
 
Call Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCR
Call Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCRCall Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCR
Call Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCR
 
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
 
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort serviceGurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
 
HARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IVHARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IV
 
HARMONY IN THE HUMAN BEING - Unit-II UHV-2
HARMONY IN THE HUMAN BEING - Unit-II UHV-2HARMONY IN THE HUMAN BEING - Unit-II UHV-2
HARMONY IN THE HUMAN BEING - Unit-II UHV-2
 
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
 

Current sensor base project

  • 1. Currentsensorbase project 1.AC cureentmeasure bycurrentsensormodiul Links>>>>>>>>>>http://circuits4you.com/2016/05/13/ac-current-measurement-acs712/ Circuit>>>>>>>>>>>> Program>>>>>>> /* Measuring AC Current Using ACS712 www.circuits4you.com */ const int sensorIn = A0; int mVperAmp = 185; // use 100 for 20A Module and 66 for 30A Module double Voltage = 0; double VRMS = 0; double AmpsRMS = 0; void setup(){ Serial.begin(9600);
  • 2. } void loop(){ Voltage = getVPP(); VRMS = (Voltage/2.0) *0.707; //root 2 is 0.707 AmpsRMS = (VRMS * 1000)/mVperAmp; Serial.print(AmpsRMS); Serial.println(" Amps RMS"); } float getVPP() { float result; int readValue; //value read from the sensor int maxValue = 0; // store max value here int minValue = 1024; // store min value here uint32_t start_time = millis(); while((millis()-start_time) < 1000) //sample for 1 Sec { readValue = analogRead(sensorIn); // see if you have a new maxValue if (readValue > maxValue) { /*record the maximum sensor value*/ maxValue = readValue; } if (readValue < minValue) { /*record the minimum sensor value*/ minValue = readValue; } } // Subtract min from max result = ((maxValue - minValue) * 5.0)/1024.0; return result; } DC Current Measurement using ASC712-05A
  • 3. 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 /* Measuring Current Using ACS712 www.circuits4you.com */ const int analogIn = A0; double mVperAmp = 185; // use 100 for 20A Module and 66 for 30A Module double RawValue= 0; double ACSoffset = 2500; double Voltage = 0; double Amps = 0; void setup(){ Serial.begin(9600); } void loop(){ RawValue = analogRead(analogIn); Voltage = (RawValue / 1024.0) * 5000; // Gets you mV Amps = ((Voltage - ACSoffset) / mVperAmp); Serial.print("Amps = "); // shows the voltage measured Serial.println(Amps,2); // the '2' after voltage allows you to display 2 digits after decimal