Community project

Android Cihaz Kontrolü

Photo of Android Cihaz Kontrolü
Generated with AI

Mehmet Kemal Fırat General manager

Published November 27, 2026

This project turns an ESP32 microcontroller into a web-based LED controller accessible from any Android device on the same network. By connecting a simple LED and resistor to the ESP32, the device becomes a remote light switch that can be toggled on and off through a clean, responsive web interface served directly from the board.

The guide provides a complete wiring diagram showing how to connect the LED and current-limiting resistor to the ESP32, a full parts list, and the complete firmware code with an embedded web server. Follow the assembly steps to wire the components, upload the firmware, connect to the ESP32's WiFi network, and start controlling your LED from any browser on your phone or tablet.

Wiring diagram

Wiring diagram for Android Cihaz Kontrolü
Loading diagram…

Gather all the parts

QtyComponent
1

LED

Red LED

Standard 3mm/5mm through-hole LED. A current-limiting series resistor is added automatically.

1

Resistor

220 Ω

Through-hole resistor (current-limiting in series with an LED)

Assemble it in 1 step

1. LED ve direnci bağla

USB kablosu takılı değilken GPIO18 pinini 220 Ω dirence, direncin diğer ucunu LED’in uzun bacağına ve LED’in kısa bacağını GND pinine bağla.

Review all connections

1. Connections between "r1" and "ESP32"

Functionr1ESP32
digitalP1GPIO 18

2. Connections between "led1" and "ESP32"

Functionled1ESP32
digitalANODE → Resistor P2EXT
groundGNDGND

Deploy the firmware

#include <Arduino.h>
#include <WiFi.h>
#include <WebServer.h>

constexpr int LED_PIN = 18;
WebServer server(80);
bool lit = false;
const char page[] PROGMEM = R"HTML(<!doctype html><html lang="tr"><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>Işık Kumandası</title><style>
body{margin:0;background:#101827;color:#f1f5f9;font:18px system-ui;display:grid;place-items:center;min-height:100dvh}main{background:#1e293b;padding:28px;border-radius:24px;width:min(75vw,400px)}h1{margin:0}button{padding:15px;border:0;border-radius:12px;font:inherit;font-weight:bold;background:#7dd3fc;color:#102030;margin-right:8px}p{min-height:3em}
</style><main><h1>Işık Kumandası</h1><p id="status" role="status">Bağlanıyor…</p><button data-state="1">Aç</button><button data-state="0">Kapat</button><p id="download"><a style="color:#7dd3fc" href="/index.html" download>HTML dosyasını indir</a></p></main><script>
const statusBox=document.querySelector('#status'), buttons=[...document.querySelectorAll('button')];
const preview=location.protocol==='file:';
if(preview)document.querySelector('#download').hidden=true;
async function update(value){if(preview){statusBox.textContent='Önizleme (cihaza bağlı değil): LED '+(value==='1'?'açık':'kapalı');return;}buttons.forEach(b=>b.disabled=true);try{const response=await fetch(value===undefined?'/state':'/led?v='+value,{method:value===undefined?'GET':'POST',cache:'no-store',signal:AbortSignal.timeout(4000)});if(!response.ok)throw Error();statusBox.textContent=(await response.text())==='1'?'LED açık':'LED kapalı';}catch{statusBox.textContent='Bağlantı yok. Telefonun ESP32 Wi-Fi ağına bağlı olduğunu kontrol et.';}finally{buttons.forEach(b=>b.disabled=false);}}
buttons.forEach(b=>b.onclick=()=>update(b.dataset.state));update();
</script></html>)HTML";
void sendState(){
  server.sendHeader("Cache-Control", "no-store");
  server.send(200,"text/plain",lit?"1":"0");
}
void setup(){
  pinMode(LED_PIN,OUTPUT);
  digitalWrite(LED_PIN,LOW);
  WiFi.mode(WIFI_AP);
  if (!WiFi.softAP("Isik-Kumandasi", "Isik-4827", 1, false, 1)) return;
  server.on("/", HTTP_GET, [](){ server.send_P(200,"text/html; charset=utf-8",page); });
  server.on("/index.html", HTTP_GET, [](){
    server.sendHeader("Content-Disposition", "attachment; filename=index.html");
    server.send_P(200,"text/html; charset=utf-8",page);
  });
  server.on("/state", HTTP_GET, sendState);
  server.on("/led", HTTP_POST, [](){
    String value=server.arg("v");
    if(value!="0" && value!="1"){server.send(400,"text/plain","Invalid state");return;}
    lit=value=="1";
    digitalWrite(LED_PIN,lit?HIGH:LOW);
    sendState();
  });
  server.begin();
}
void loop(){server.handleClient();delay(2);}

Remix this project

Make it yours in one click

Open a full copy of this project in your own Schematik workspace, diagram, code, parts, and assembly steps included. Swap the sensor, add features, or redesign the whole thing with AI. The author's original stays untouched.

Open in Schematik