Translate

Monitor Arus dan Tegangan 3 Fasa IOT BLYNK GRAFIK REALTIME

Monitor Arus dan Tegangan 3 Fasa IOT BLYNK GRAFIK REALTIME


         Pada kesempatan kali ini saya akan menjelaskan mengenai bagaimana cara membuat sebuah alat yang digunakan untuk monitor arus dan tegangan 3 fasa dengan menggunakan IOT Blynk sehingga bisa dilakukan monitor secara jarak jauh menggunakan web atau handphone. untuk lebih jelasnya berikut adalah koding dan komponennya.



a. Komponen




b. Program Arduino Mega

#include <Wire.h>  // i2C Conection Library
#include <LiquidCrystal_I2C.h>
#include <SPI.h>
#include <PZEM004Tv30.h>
#include <SoftwareSerial.h>
LiquidCrystal_I2C lcd(0x27,16,2); 
PZEM004Tv30 pzem1(A12, A13);
PZEM004Tv30 pzem2(A8, A9);
PZEM004Tv30 pzem3(A10, A11);
int voltage1, voltage2, voltage3;
float arusR, arusS, arusT;

void setup() {
  lcd.begin();   
  lcd.noCursor();
  lcd.clear();
  Serial.begin(9600);    
}

void loop() {
  
voltage1 = pzem1.voltage();
voltage2 = pzem2.voltage();
voltage3 = pzem3.voltage();
arusR = pzem1.current();
arusS = pzem2.current();
arusT = pzem3.current();

lcd.setCursor(0, 0);
lcd.print(voltage1);
lcd.print("/");
lcd.print(voltage2);
lcd.print("/");
lcd.print(voltage3);
lcd.print(" ");

lcd.setCursor(0, 1);
lcd.print(arusR);
lcd.print("/");
lcd.print(arusS);
lcd.print("/");
lcd.print(arusT);
lcd.print(" ");

Serial.print("*");
Serial.print(arusR * 100.0);
Serial.print(",");
Serial.print(arusS * 100.0);
Serial.print(",");
Serial.print(arusT * 100.0);
Serial.println("#");  

delay(200);
}



c. Program NodeMCU ESP8266

#define BLYNK_TEMPLATE_ID "TMPL6lXvbTxXX"
#define BLYNK_TEMPLATE_NAME "MONITOR ARUS"
#define BLYNK_AUTH_TOKEN "6WRDw9uHuqd0543E7fG2wccvWWxxxxxx"

#define BLYNK_PRINT Serial    

#include <SPI.h>
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>

int temp;
int x = 5;
int y;

int value1;
int value2;

float tegangan1 = 0;
float tegangan2 = 0;
float tegangan3 = 0;
float arusR = 0;
float arusS = 0;
float arusT = 0;

float datain1;
float datain2;
float datain3;
float datain4;
float datain5;
float datain6;

String dataIn;
String dt[10];
int i;
boolean parsing=false;

// Your WiFi credentials.
// Set password to "" for open networks.
char ssid[] = "4G MIFI-6499";
char pass[] = "1234567891";

BlynkTimer timer;


void sendSensor()
{

 Blynk.virtualWrite(V5, arusR);
 Blynk.virtualWrite(V6, arusS);
 Blynk.virtualWrite(V7, arusT);
 delay(1000);

}

void setup()
{
  
  dataIn=""; 
  // Debug console
  Serial.begin(9600);
  Blynk.begin(BLYNK_AUTH_TOKEN, ssid, pass);
  timer.setInterval(1000L, sendSensor);
  
}

void loop()
{

while(Serial.available()>0) {
//   dataIn="";
    char inChar = (char)Serial.read();
    dataIn += inChar;
    if (inChar == '\n') {
    parsing = true;
  }
}

if(parsing){
  parsingData();
    
  Blynk.run();
  timer.run();
}

}

void parsingData(){
int j=0;

//kirim data yang telah diterima sebelumnya
//Serial.print("data masuk : ");
//Serial.print(dataIn);
//Serial.print("\n");

//inisialisasi variabel, (reset isi variabel)
dt[j]="";
//proses parsing data
for(i=1;i<dataIn.length();i++){
//pengecekan tiap karakter dengan karakter (#) dan (,)
if ((dataIn[i] == '#') || (dataIn[i] == ','))
{
//increment variabel j, digunakan untuk merubah index array penampung
j++;
dt[j]="";       //inisialisasi variabel array dt[j]
}
else
{
//proses tampung data saat pengecekan karakter selesai.
dt[j] = dt[j] + dataIn[i];
}
}

datain1 = dt[0].toInt();
datain2 = dt[1].toInt();
datain3 = dt[2].toInt();

/*
//kirim data hasil parsing
Serial.print("data 1 : ");
Serial.print(datain1);
Serial.print("\n");
Serial.print("data 2 : ");
Serial.print(datain2);
Serial.print("\n");
Serial.print("data 3 : ");
Serial.print(datain3);
Serial.print("\n");
Serial.print("data 4 : ");
Serial.print(datain4);
Serial.print("\n");
Serial.print("data 5 : ");
Serial.print(datain5);
Serial.print("\n");
Serial.print("data 6 : ");
Serial.print(datain6);
Serial.print("\n");
*/

 arusR = datain1 / 100.0;
 arusS = datain2 / 100.0;
 arusT = datain3 / 100.0;

}



d, VIDEO HASILNYA



No comments:

Post a Comment