Translate

Monitoring Arus dan Tegangan 3 Fasa RST ARDUINO

Monitoring Arus dan Tegangan 3 Fasa RST ARDUINO


          Pada kesempatan kali ini saya akan menjelaskan mengenai bagaimana cara membuat sebuah alat yang dapat memonitoring arus dan tegangan 3 fasa RST dengan menggunakan sensor tegangan ZMPT101B dan arus SCT-013. alat ini menggunakan Arduino Mega dan interface LCD 16x2.untuk lebih jelasnya berikut adalah koding dan komponennya.



a. Komponen



b. Program Arduino IDE

#include <Wire.h>
#include <LiquidCrystal_I2C.h>  //i2C LCD Library
LiquidCrystal_I2C lcd(0x27, 16, 2);

// Arrays to save our results in
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);

float tegangan,tegangan2,tegangan3;
float arus,arus2,arus3;
unsigned int i,i2,i3,i4,i5,i6;
unsigned int z,z2,z3,z4,z5,z6;

int vin,vin2,vin3,vin4,vin5,vin6;

    
void setup() {

lcd.begin();
lcd.clear();
lcd.noCursor();

  // 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
 
  Serial.begin(9600);
}


void loop()
{

// zmpt101b tegangan
//==================================
  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();
  }

   vin = z ;

  z = 0;

  tegangan = (vin - 559.9) / 0.413 ;
  tegangan = tegangan + 80.0;
  
  if (tegangan < 0){
  tegangan = 0;
  }

//================================
//==================================
  z2 = 0;
  
  // capture the values to memory
  for(i2=0;i2<300;i2++) {
    start_times[i2] = micros();
    values[i2] = analogRead(A1);            

  if (values[i2] >= z2) {
  z2 = values[i2];
  }
    stop_times[i2] = micros();
  }

   vin2 = z2 ;

  z2 = 0;

  tegangan2 = (vin2 - 559.9) / 0.413 ;
  tegangan2 = tegangan2 + 80.0;
    
  if (tegangan2 < 0){
  tegangan2 = 0;
  }
  
//================================
//==================================
  z3 = 0;
  
  // capture the values to memory
  for(i3=0;i3<300;i3++) {
    start_times[i3] = micros();
    values[i3] = analogRead(A2);            

  if (values[i3] >= z3) {
  z3 = values[i3];
  }
    stop_times[i3] = micros();
  }

   vin3 = z3 ;

  z3 = 0;

  tegangan3 = (vin3 - 559.9) / 0.413 ;
  tegangan3 = tegangan3 + 80.0;
  
  if (tegangan3 < 0){
  tegangan3 = 0;
  }
  
  //================================
  // sct-013 arus
  //=================================
  // capture the values to memory
  for(i4=0;i4<300;i4++) {
    start_times[i4] = micros();
    values[i4] = analogRead(A3);            

  if (values[i4] >= z4) {
  z4 = values[i4];
  }
    stop_times[i4] = micros();
  }

  arus = (z4 - 500.0) / 100.0;

 if (arus < 0) {
 arus = 0;
 }

 z4 = 0;
//==============================
//=================================
// capture the values to memory
  for(i5=0;i5<300;i5++) {
    start_times[i5] = micros();
    values[i5] = analogRead(A4);            

  if (values[i5] >= z5) {
  z5 = values[i5];
  }
    stop_times[i5] = micros();
  }

  arus2 = (z5 - 500.0) / 100.0;

 if (arus2 < 0) {
 arus2 = 0;
 }

 z5 = 0;
//==============================
//=================================
// capture the values to memory
  for(i6=0;i6<300;i6++) {
    start_times[i6] = micros();
    values[i6] = analogRead(A5);            

  if (values[i6] >= z6) {
  z6 = values[i6];
  }
    stop_times[i6] = micros();
  }

  arus3 = (z6 - 500.0) / 100.0;

 if (arus3 < 0) {
 arus3 = 0;
 }

 z6 = 0;
//==============================

  lcd.setCursor(0, 0);
  lcd.print(tegangan,0);
  lcd.print("/");
  lcd.print(tegangan2,0);
  lcd.print("/");
  lcd.print(tegangan3,0);
  lcd.print("      ");
  
  lcd.setCursor(0, 1); 
  lcd.print(arus,1);
  lcd.print("/");
  lcd.print(arus2,1);
  lcd.print("/");
  lcd.print(arus3,1);
  lcd.print("   ");
  
delay(200);
}



c. VIDEO HASILNYA




1 comment:

  1. gan itu sensor sct013-nya saya liat kyk ada pcb kecil yg di video ini. apa itu pcb ampli yg sempat dijelaskan pas video sebelumnya itu kah?
    soalnya saya kurang paham sama blog diagram sensor yg di atas. Makasihh semoga dijawab.
    https://www.youtube.com/watch?v=RbNCwKGaMMU&t=38s

    ReplyDelete