0% found this document useful (0 votes)
309 views6 pages

Tugas Scada Haiwell-Modbus - 2315374032

This document describes the design of a SCADA system based on Haiwell and ESP8266 Modbus. The system measures temperature and humidity using a DHT sensor connected to an ESP8266, measures light intensity using an LDR sensor, and controls LEDs using Modbus registers. The ESP8266 connects to WiFi and runs code to read the sensors, write the sensor values to Modbus registers, and control the LEDs based on the values of Modbus coils. The Haiwell SCADA software can then monitor and control the system by accessing the Modbus registers over the network.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
309 views6 pages

Tugas Scada Haiwell-Modbus - 2315374032

This document describes the design of a SCADA system based on Haiwell and ESP8266 Modbus. The system measures temperature and humidity using a DHT sensor connected to an ESP8266, measures light intensity using an LDR sensor, and controls LEDs using Modbus registers. The ESP8266 connects to WiFi and runs code to read the sensors, write the sensor values to Modbus registers, and control the LEDs based on the values of Modbus coils. The Haiwell SCADA software can then monitor and control the system by accessing the Modbus registers over the network.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

TUGAS

PERANCANGAN SCADA BERBASIS HAIWELL DAN ESP8266 MODBUS

POLITEKNIK NEGERI BALI

PRAMUDYA WARDHANA
NIM : 2315374032

PROGRAM STUDI D4 TEKNIK OTOMASI


JURUSAN TEKNIK ELEKTRO
POLITEKNIK NEGERI BALI
2023
RANGKAIAN

DHT
Pin + dihubungkan dengan pin 3V3 pada ESP8266
Pin Out dihubungkan dengan pin D5 pada ESP8266
Pin – dihubungkan dengan pin GND pada ESP8266
LDR
Pin VCC dihubungkan dengan pin 3V3 pada ESP8266
Pin GND dihubungkan dengan pin GND pada ESP8266
Pin A0 (Analog) dihubungkan dengan pin A0 pada ESP8266

CODING ARDUINO ESP8266

#include <ESP8266WiFi.h>
#include "DHT.h" // including the library of DHT11 temperature and
humidity sensor
#define DHTTYPE DHT22
#include <ModbusIP_ESP8266.h>

#define dht_dpin D5
DHT dht(dht_dpin, DHTTYPE);

int pinLED1 = D2;


int pinLED2 = D3;

int pinLDR = A0;

ModbusIP mb;
const int register1 = 0;
const int register2 = 1;
const int register3 = 2;

//Modbus Registers Offsets


const int LED1_COIL = 11;//ADDRESS COIL REGISTER = 0
const int LED2_COIL = 12;

char ssid[] = "Indihome";//disesuaikan dengan SSID hotspot masing-masing yang


terhubung dengan laptop
char pass[] = "plnbali123";//password dari SSID yang digunakan

void setup () {
Serial.begin(9600);
dht.begin();

WiFi.begin(ssid, pass);
while (WiFi.status() != WL_CONNECTED) {
delay(500);
Serial.print(".");
}
Serial.println("");
Serial.println("WiFi connected");
Serial.print("IP address: ");
Serial.println(WiFi.localIP());

mb.server();

mb.addHreg(register1);
mb.addHreg(register2);
mb.addHreg(register3);
mb.addCoil(LED1_COIL); //qq
mb.addCoil(LED2_COIL);
}
void loop () {

if (WiFi.status() != WL_CONNECTED) {
Serial.print("Connecting Wifi: ");
Serial.println(ssid);
WiFi.mode(WIFI_STA);
WiFi.begin(ssid, pass);
while (WiFi.status() != WL_CONNECTED) {
Serial.print(".");
delay(500);
}
Serial.println("");
Serial.println("WiFi connected");
Serial.print("IP address: ");
Serial.println(WiFi.localIP());
}
delay(500);
int sensorValue = analogRead(pinLDR);
Serial.println("nilai LDR = " + String(sensorValue) );

float h = dht.readHumidity();
float t = dht.readTemperature();
Serial.print("Current humidity = ");
Serial.print(h);
Serial.print("% ");
Serial.print("temperature = ");
Serial.print(t);
Serial.println("C ");

mb.task();
mb.Hreg(register1, t);
mb.Hreg(register2, h);
mb.Hreg(register3, sensorValue);
digitalWrite(pinLED1, mb.Coil(LED1_COIL));
digitalWrite(pinLED2, mb.Coil(LED2_COIL));
delay(300);

Tampilan Serial Monitor

TAMPILAN HAIWELL

Halaman pertama
Halaman Menu Temperature

Halaman Menu Humidity


Halaman Menu LDR

You might also like