Jumat, 21 April 2017

arduino dan sensor tegangan

Share tutorial rangkai sensor tegangan AC 220

komponen yang digunakan antara lain:
trafo step down 220 to 6v
capasitor 10uf
dioda 1A
resistor 10K
kabel jumper
arduino uno
breadboard
lcd 2004 i2c

// EmonLibrary examples openenergymonitor.org, Licence GNU GPL V3
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x3F,20,4);
#include "EmonLib.h"             // Include Emon Library
EnergyMonitor emon1;             // Create an instance

void setup()

  Serial.begin(9600);
   lcd.init();
  lcd.backlight();
 lcd.setCursor (0,0);
 lcd.print ("Welcome to");
 lcd.setCursor (1,1);
 lcd.print ("My Experiment");

  emon1.voltage(2, 4900.0, 1.7);  // Voltage: input pin, calibration, phase_shift
  emon1.current(1, 111.1);       // Current: input pin, calibration.
 
  delay (10000);
}

void loop()
{
          // Calculate all. No.of half wavelengths (crossings), time-out
  //emon1.serialprint();           // Print out all variables (realpower, apparent power, Vrms, Irms, power factor)
 
  emon1.calcVI(20,2000);
  float supplyVoltage   = emon1.Vrms;             //extract Vrms into Variable
 
  float teg = analogRead(A2)*1;
 lcd.clear();
 lcd.setCursor (0,0);
 lcd.print ("Puaks.blogspot.com");
 lcd.setCursor (1,1);
 lcd.print ("FUAD HASAN");
 lcd.setCursor (0,2);
  lcd.print ("Tegangan");
  lcd.setCursor (0,10);
  lcd.print (supplyVoltage);
  Serial.print("tegangan ");
  Serial.println(supplyVoltage);
 
}

check hasil di video

saat kali program berjalan nggak sesuai tunggu 10 detik.. nnti hasilnya akan stabil

8 komentar:

Cara membuat datalogger blynk di spreadsheet / googlesheet menggunakan akun versi Free

  silahkan video di atas. semoga bermanfaat. jika masih kurang jelas bisa kontak saya