Translate

Membuat Alat Pengukur Tegangan dan Arus AC serta Frequency 50 Hz

Membuat Alat Pengukur Tegangan dan Arus AC serta Frequency 50 Hz


       Pada kesempatan kali ini saya akan menjelaskan mengenai bagaimana cara membuat sebuah alat yang digunakan untuk mengukur tegangan dan arus AC serta frequency 50 Hz, alat ini menggunakan sensor tegangan AC satu fasa zmpt101b dan sensor arus WCS1700, untuk sensor Frequency menggunakan Trafo step down dan voltage divider agar output menjadi 5v AC. untuk lebih jelasnya berikut adalah program dan skemanya. 




a. Arduino Mega





b. Sensor Tegangan AC ZMPT101B





c. Sensor Arus WCS1700





d. Sensor Frequency






e. Program Arduino IDE

#include "Wire.h"
#include <LiquidCrystal.h>
LiquidCrystal lcd(19, 18, 17, 16, 15, 14);

int input=5;        //pin yang digunakan adalah pin digital 5
//untuk di arduino mega disediakan khusus pin 5 & 6
int high_time;
int low_time;
float time_period;
float frequency;
float teta = 8.10961446;

unsigned long start_times[300];
unsigned long stop_times[300];
unsigned long values[300];

// Define various ADC prescaler
const unsigned char PS_16 = (1 << ADPS2);
const unsigned char PS_32 = (1 << ADPS2) | (1 << ADPS0);
const unsigned char PS_64 = (1 << ADPS2) | (1 << ADPS1);
const unsigned char PS_128 = (1 << ADPS2) | (1 << ADPS1) | (1 << ADPS0);

int a = 0;
int zero = 0;

void setup()
{
 
  // set up the ADC
  ADCSRA &= ~PS_128;  // remove bits set by Arduino library

  // you can choose a prescaler from above.
  // PS_16, PS_32, PS_64 or PS_128
  ADCSRA |= PS_128;    // set our own prescaler to 64

 lcd.begin(16, 2);
 lcd.clear();
 lcd.noCursor();

 Serial.begin(9600);
 pinMode(input,INPUT);

}

void loop()
{
   
  //tegangan AC =============================
  unsigned int i;
  unsigned int z;
  z = 0;
  
  // capture the values to memory
  for(i=0;i<300;i++) {
    start_times[i] = micros();
    values[i] = analogRead(A0);            

  if (values[i] >= z) {
  z = values[i];
  }
    stop_times[i] = micros();
  }

  int teg = z;
  z = 0;
  
  // capture the values to memory
  for(i=0;i<300;i++) {
    start_times[i] = micros();
    values[i] = analogRead(A1);            

  if (values[i] >= z) {
  z = values[i];
  }
    stop_times[i] = micros();
  }

 int arus = z;
 z = 0;

high_time=pulseIn(input,HIGH);
low_time=pulseIn(input,LOW);
time_period=high_time+low_time;
time_period=time_period/1000;
frequency=1000/time_period;
//////=============////////

 float arusx = (arus - 524.0) / 33.33;
 float tegx = (teg - 525.0) / 0.882;

if(arusx < 0){
arusx = 0.0;
}

if(tegx < 0){
tegx = 0.0;
}

float cosphi = 4 / (tegx * arusx);

float p = arusx * tegx * cosphi;
float a = p / (2 * 3.14 * frequency * tegx * tegx);
float b = tan(teta) * p / (2 * 3.14 * frequency * tegx * tegx);
float tetal = acos(cosphi);
float c = a * tan(tetal) - b;

  lcd.setCursor(0, 0);
  lcd.print("V= ");
  lcd.print(tegx);
  lcd.print(" ");
  lcd.setCursor(0, 1);
  lcd.print("I= ");
  lcd.print(arusx);
  lcd.setCursor(8, 0);
  lcd.print("F= ");
  lcd.print(frequency);
  lcd.setCursor(8, 1);
  lcd.print("C= ");
  lcd.print(cosphi);

delay(200);
delay(5000);

  lcd.clear();
 
  lcd.setCursor(0, 0);
  lcd.print("P= ");
  lcd.print(p);
  lcd.print(" ");
  lcd.setCursor(0, 1);
  lcd.print("a= ");
  lcd.print(a);
  lcd.setCursor(8, 0);
  lcd.print("b= ");
  lcd.print(b);
  lcd.setCursor(8, 1);
  lcd.print("T= ");
  lcd.print(tetal);

  delay(5000);

  lcd.clear();
  lcd.setCursor(0, 0);
  lcd.print("C= ");
  lcd.print(c);
 
  delay(5000);
  lcd.clear();
 
}
 
 


f. VIDEO HASILNYA















1 comment: