You are on page 1of 12

LAMPIRAN 2A.

DATA SHEET MMBT3904


LAMPIRAN 2B. DATA SHEET MOC3021
LAMPIRAN 2C. DATA SHEET BTA12
LAMPIRAN 3. GAMBAR RANGKAIAN

Gambar skema rangkaian ESP8266 dan Driver Led

Gambar Rangkaian
LAMPIRAN 4. KODE PROGRAM

A. PEMROGRAMAN APLIKASI SMARTPHONE ANDROID PADA APP


INVENTOR

Tampilan design screen 1 aplikasi Smart Home Controler

Tampilan Code block screen 1 aplikasi Smart Home Controler


Tampilan design screen 2 aplikasi Smart Home Controler

Code Block Setting Koneksi dan inialisasi


Code Block menu tombol
Code Block Umpan Balik
B. PEMBUATAN PROGRAM WEB SERVER ESP8266 DENGAN IDE ESPlorer

Tampilan penulisan program pada IDE ESPlorer

--ESP_STATION--
wifi.sta.setip({ip="192.168.1.101",netmask="255.255.255.0",gateway="
192.168.1.1"})
wifi.setmode(wifi.STATION)
wifi.sta.config("Tenda","12345678")
wifi.sta.autoconnect(1)

--Setting I/O esp_07--


gpio12_state=1; --6
gpio13_state=1; --7
gpio14_state=1; --5
gpio.mode(5, gpio.OUTPUT,gpio.PULLUP)
gpio.mode(6, gpio.OUTPUT,gpio.PULLUP)
gpio.mode(7, gpio.OUTPUT,gpio.PULLUP)
gpio.write(5, gpio.LOW);
gpio.write(6, gpio.LOW);
gpio.write(7, gpio.LOW);

txt="";
x1="0,";
x2="0,";
x3="0,";
x4="0,";
--Menunggu Data Masuk--
responseHeader = function(code, type)
return "HTTP/1.1 " .. code .. "\r\nConnection: close\r\nServer:
nunu-Luaweb\r\nContent-Type: " .. type .. "\r\n\r\n";
end

--Header Web Server--


srv=net.createServer(net.TCP)
srv:listen(80,function(conn)
conn:on("receive", function(client,request)
client:send(responseHeader("200 OK","text/html"));
local _, _, method, path, vars = string.find(request, "([A-
Z]+) (.+)?(.+) HTTP");
if(method == nil)then
_, _, method, path = string.find(request, "([A-Z]+) (.+)
HTTP");
end

--Inisialisasi dan pengambilan Variable--


local _GET = {}
if (vars ~= nil)then
for k, v in string.gmatch(vars, "(%w+)=(%w+)&*") do
_GET[k] = v
end
end

--Penggunaan Variable Untuk Mematikan dan Menghidupkan Lampu Led


220vAC sesuai nomer urutan--
local _on,_off = "","";
if(_GET.OFF == "1")then
gpio.write(6, gpio.LOW);
x1="0,";
elseif(_GET.OFF == "2")then
gpio.write(7, gpio.LOW);
x2="0,";
elseif(_GET.OFF == "3")then
gpio.write(5, gpio.LOW);
x3="0,";
elseif(_GET.OFF == "4")then
gpio.write(5, gpio.LOW);
gpio.write(6, gpio.LOW);
gpio.write(7, gpio.LOW);
x1="0,";
x2="0,";
x3="0,";
elseif(_GET.ON == "1")then
gpio.write(6, gpio.HIGH);
x1="1,";
elseif(_GET.ON == "2")then
gpio.write(7, gpio.HIGH);
x2="1,";
elseif(_GET.ON == "3")then
gpio.write(5, gpio.HIGH);
x3="1,";
elseif(_GET.ON == "4")then
gpio.write(5, gpio.HIGH);
gpio.write(6, gpio.HIGH);
gpio.write(7, gpio.HIGH);
x1="1,";
x2="1,";
x3="1,";
end
client:send(x1..x2..x3);
client:close();
collectgarbage();
end)
end)
LAMPIRAN 5. FOTO ALAT

Gambar Rancang Bangun Alat dengan Google Sketchup

Gambar Realisasi Alat

You might also like