Pada kesempatan kali ini saya akan membahas mengenai bagaimana cara membuat sebuah alat yang memadukan antara sumber dari aki dan sumber dari genset, prinsip kerja alat ini yaitu terdapat solat panel atau PV (photovoltaic) yang akan mengisi battery aki, tegangan DC aki kemudian dikonversikan ke AC menggunakan inverter untuk menghidupkan lampu AC dan lainnya, jika aki sudah habis maka akan switch otomatis ke genset, jadi genset akan menyala dengan sendirinya tanpa bantuan petugas jaga, sehingga akan lebih cepat dan efisien. yang perlu diperhatikan yaitu mekanisme dalam menghidupkan genset, karena akan ada step CHOOKE dan RUN saat Knob Stater On. Untuk lebih jelasnya berikut adalah skema dan programnya.
a. Arduino Mega
b. Sensor Arus ACS712
c. Sensor Tegangan AC ZMPT101b
d. Mekanisme Genset
e. Program Arduino IDE
#include "Wire.h"
#include <LiquidCrystal.h>
LiquidCrystal lcd(2, 3, 4, 5, 6, 7);
int vin = 0;
int iin = 0;
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 = 1;
int switchmr = 17;
int switchck = 16;
int switchmrx = 0;
int switchckx = 0;
int mark = 0;
void setup() {
pinMode(switchmr,INPUT);
pinMode(switchck,INPUT);
pinMode(13,OUTPUT);
pinMode(22,OUTPUT);
pinMode(24,OUTPUT);
pinMode(46,OUTPUT);
pinMode(48,OUTPUT);
pinMode(50,OUTPUT);
pinMode(52,OUTPUT);
digitalWrite(16,HIGH);
digitalWrite(17,HIGH);
lcd.begin(16, 2);
lcd.clear();
lcd.noCursor();
pinMode(14,OUTPUT);
pinMode(15,OUTPUT);
// 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
}
void loop() {
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 vin = 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();
}
float v1 = z * (5.0/1023.0);
float iin = (v1-2.5)/0.1 ;
if (iin < 0) {
iin = 0;
}
z = 0;
//INVEERTER NYALA
if((vin >= 700)&&(mark == 0)){
//MATIKAN SAKLAR GENSET
digitalWrite(22,LOW);
digitalWrite(24,LOW);
delay(2000);
//PUTAR KE CHOOKE
//kiri
//mtrkanan
digitalWrite(46,LOW);
digitalWrite(48,HIGH);
delay(200);
digitalWrite(46,LOW);
digitalWrite(48,LOW);
lcd.clear();
cuke();
delay(5000);
//HIDUPKAN RELAY INVERTER
digitalWrite(14,HIGH);
digitalWrite(15,HIGH);
delay(1000);
/*
//PUTAR KE RUN
//kanan
//mtrkiri
digitalWrite(50,HIGH);
digitalWrite(52,LOW);
delay(200);
digitalWrite(50,LOW);
digitalWrite(52,LOW);
lcd.clear();
run();
*/
mark = 1;
}
// KONDISI INVERTER OFF
if((vin < 700)&&(mark == 1)){
//RELAY INVERTER OFF
digitalWrite(14,LOW);
digitalWrite(15,LOW);
delay(3000);
//HIDUPKAN SAKLAR GENSET
digitalWrite(22,HIGH);
digitalWrite(24,LOW);
delay(3000);
/*
//PUTAR KE CHOOKE
//kiri
//mtrkanan
digitalWrite(46,LOW);
digitalWrite(48,HIGH);
delay(200);
digitalWrite(46,LOW);
digitalWrite(48,LOW);
lcd.clear();
cuke();
delay(5000);
*/
//PUTAR KE RUN
//kanan
//mtrkiri
digitalWrite(50,HIGH);
digitalWrite(52,LOW);
delay(200);
digitalWrite(50,LOW);
digitalWrite(52,LOW);
lcd.clear();
run();
delay(2000);
//MATIKAN SAKLAR GENSET
digitalWrite(22,LOW);
digitalWrite(24,LOW);
delay(10000);
digitalWrite(24,HIGH);
mark = 0;
}
lcd.clear();
delay(1000);
if(vin > 700){
vin = 220;
}else if(vin < 700){
vin = 0;
}
lcd.setCursor(0, 0);
lcd.print("v= ");
lcd.print(vin);
lcd.setCursor(0, 1);
lcd.print("I= ");
lcd.print(iin);
delay(2000);
lcd.clear();
}
void run(){
lcd.setCursor(0, 0);
lcd.print("RUN");
//kanan
//mtrkanan
digitalWrite(46,HIGH);
digitalWrite(48,LOW);
switchmrx = digitalRead(17);
if(switchmrx == 0){
digitalWrite(46,LOW);
digitalWrite(48,LOW);
return;
}
run();
}
void cuke(){
lcd.setCursor(0, 0);
lcd.print("choke");
//kiri
//mrtkiri
digitalWrite(50,LOW);
digitalWrite(52,HIGH);
switchckx = digitalRead(16);
if(switchckx == 0){
digitalWrite(50,LOW);
digitalWrite(52,LOW);
mark = 0;
return;
}
cuke();
}
f. VIDEO HASILNYA
#include <LiquidCrystal.h>
LiquidCrystal lcd(2, 3, 4, 5, 6, 7);
int vin = 0;
int iin = 0;
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 = 1;
int switchmr = 17;
int switchck = 16;
int switchmrx = 0;
int switchckx = 0;
int mark = 0;
void setup() {
pinMode(switchmr,INPUT);
pinMode(switchck,INPUT);
pinMode(13,OUTPUT);
pinMode(22,OUTPUT);
pinMode(24,OUTPUT);
pinMode(46,OUTPUT);
pinMode(48,OUTPUT);
pinMode(50,OUTPUT);
pinMode(52,OUTPUT);
digitalWrite(16,HIGH);
digitalWrite(17,HIGH);
lcd.begin(16, 2);
lcd.clear();
lcd.noCursor();
pinMode(14,OUTPUT);
pinMode(15,OUTPUT);
// 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
}
void loop() {
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 vin = 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();
}
float v1 = z * (5.0/1023.0);
float iin = (v1-2.5)/0.1 ;
if (iin < 0) {
iin = 0;
}
z = 0;
//INVEERTER NYALA
if((vin >= 700)&&(mark == 0)){
//MATIKAN SAKLAR GENSET
digitalWrite(22,LOW);
digitalWrite(24,LOW);
delay(2000);
//PUTAR KE CHOOKE
//kiri
//mtrkanan
digitalWrite(46,LOW);
digitalWrite(48,HIGH);
delay(200);
digitalWrite(46,LOW);
digitalWrite(48,LOW);
lcd.clear();
cuke();
delay(5000);
//HIDUPKAN RELAY INVERTER
digitalWrite(14,HIGH);
digitalWrite(15,HIGH);
delay(1000);
/*
//PUTAR KE RUN
//kanan
//mtrkiri
digitalWrite(50,HIGH);
digitalWrite(52,LOW);
delay(200);
digitalWrite(50,LOW);
digitalWrite(52,LOW);
lcd.clear();
run();
*/
mark = 1;
}
// KONDISI INVERTER OFF
if((vin < 700)&&(mark == 1)){
//RELAY INVERTER OFF
digitalWrite(14,LOW);
digitalWrite(15,LOW);
delay(3000);
//HIDUPKAN SAKLAR GENSET
digitalWrite(22,HIGH);
digitalWrite(24,LOW);
delay(3000);
/*
//PUTAR KE CHOOKE
//kiri
//mtrkanan
digitalWrite(46,LOW);
digitalWrite(48,HIGH);
delay(200);
digitalWrite(46,LOW);
digitalWrite(48,LOW);
lcd.clear();
cuke();
delay(5000);
*/
//PUTAR KE RUN
//kanan
//mtrkiri
digitalWrite(50,HIGH);
digitalWrite(52,LOW);
delay(200);
digitalWrite(50,LOW);
digitalWrite(52,LOW);
lcd.clear();
run();
delay(2000);
//MATIKAN SAKLAR GENSET
digitalWrite(22,LOW);
digitalWrite(24,LOW);
delay(10000);
digitalWrite(24,HIGH);
mark = 0;
}
lcd.clear();
delay(1000);
if(vin > 700){
vin = 220;
}else if(vin < 700){
vin = 0;
}
lcd.setCursor(0, 0);
lcd.print("v= ");
lcd.print(vin);
lcd.setCursor(0, 1);
lcd.print("I= ");
lcd.print(iin);
delay(2000);
lcd.clear();
}
void run(){
lcd.setCursor(0, 0);
lcd.print("RUN");
//kanan
//mtrkanan
digitalWrite(46,HIGH);
digitalWrite(48,LOW);
switchmrx = digitalRead(17);
if(switchmrx == 0){
digitalWrite(46,LOW);
digitalWrite(48,LOW);
return;
}
run();
}
void cuke(){
lcd.setCursor(0, 0);
lcd.print("choke");
//kiri
//mrtkiri
digitalWrite(50,LOW);
digitalWrite(52,HIGH);
switchckx = digitalRead(16);
if(switchckx == 0){
digitalWrite(50,LOW);
digitalWrite(52,LOW);
mark = 0;
return;
}
cuke();
}
f. VIDEO HASILNYA
No comments:
Post a Comment