SMART AMBIENT LIGHTING

KAFES OMEGA — SMART AMBIENT LIGHTING

Status: Hardware Prototyping — In Progress

An autonomous IoT lighting subsystem of the KAFES ecosystem. Designed to track real-time environmental lux levels (like sunsets) and adjust 24V/5A power electronics seamlessly using a dual-core FreeRTOS architecture. Protected by a Zero-Trust MQTT network design.

TECHNOLOGIES & PLATFORMS

ESP32 (Dual-Core) FreeRTOS IRLZ44N MOSFET BH1750 I2C Sensor C++ (PlatformIO) MQTT (Mosquitto) React (Master Dashboard) KiCad Fusion360

The KAFES OMEGA Zero-Trust Architecture: More than just "turn on the lights from a phone". The system is strictly autonomous via PID loops based on physical light sensors. Any manual override requires authorization through the Master Dashboard via an [ACTION REQUIRED] prompt to dispatch encrypted MQTT packets, preventing single-click unauthorized access.

SYSTEM ARCHITECTURE

[1] SENSING (BH1750)
  → I2C digital read for exact Lux levels
  → Replaces noisy analog LDRs
         ↓
[2] LOGIC & PROCESSING (ESP32 FreeRTOS)
  → Core 0: Wi-Fi polling and MQTT network subscriptions
  → Core 1: Hardware PWM generation (LEDC) & PID Controller
         ↓
[3] POWER ELECTRONICS (IRLZ44N)
  → 3.3V logic signal rapidly switches the massive 24V/5A load
  → PWM prevents the N-Channel MOSFET from overheating
         ↓
[4] MANUAL OVERRIDE (ZERO-TRUST)
  → Master Dashboard requests confirmation before dispatch
  → Fallback to Local AP Mode if the main router drops

ENGINEERING FOCUS

MOSFET Power Switching

Since the microcontroller cannot drive heavy loads directly, an IRLZ44N logic-level MOSFET acts as a rapid switch, safely isolating the 3.3V logic circuit from the 24V power circuit.

🌡

Thermal Management via PWM

By switching the circuit on and off rapidly (PWM) instead of lowering voltage linearly, the system minimizes power dissipation and prevents the MOSFET from burning up under load.

📶

Dual-Core FreeRTOS

The ESP32 runs Wi-Fi/MQTT blocking functions on Core 0 and the mission-critical hardware PWM fading on Core 1, ensuring the lights never freeze or stutter during network reconnects.

HARDWARE BOM RATIONALE

ComponentSelectionEngineering Justification
MicrocontrollerESP32Dual-Core architecture allows splitting network tasks from hardware PWM tasks, crucial for stability.
Switching MOSFETIRLZ44N (N-Channel)Logic-level threshold (turns on at lower voltages). Can comfortably handle the 5 Amps of current without extreme resistance.
Light SensorBH1750 (I2C)Provides highly precise 16-bit digital Lux values directly over the I2C bus, immune to the voltage drop noise of analog sensors.
Voltage RegulatorLM2596 Step-DownDrops the main 24V power supply down to a clean 5V to safely power the ESP32 logic board.

R&D AND TECHNICAL CHALLENGES

Logic-Level 3.3V Trap

Even logic-level MOSFETs like the IRLZ44N perform best at 5V. Driving them directly with the ESP32's 3.3V can leave them in a semi-open resistive state, generating excessive heat.

→ Solution: Strict calculation of Gate resistance, pull-down safety resistors (10kΩ), and potentially integrating an optocoupler or level shifter.

Shadow Hysteresis (Flickering)

If a person walks past the BH1750 sensor, the sudden drop in Lux causes the autonomous loop to rapidly spike the room's brightness, creating a disco-effect.

→ Solution: Software-based Moving Average filter combined with a delayed PID loop to ignore sudden, short-term environmental spikes.

Wi-Fi Blocking Deadlock

Standard Arduino code freezes all operations while attempting to reconnect to a dropped Wi-Fi network, causing the PWM lights to freeze entirely.

→ Solution: FreeRTOS task delegation (Core 0 for Wi-Fi) and Local AP Fallback Mode to ensure continuous local control.

EXECUTION ROADMAP

The project follows a strict "Virtual to Physical" engineering pipeline to eliminate hardware risks before soldering.

01
In Progress

Phase 1 — Code & Simulation (Wokwi)

Proving the logic purely in the browser. Testing FreeRTOS core delegation, LEDC hardware PWM fading, I2C BH1750 sensor reading, and Wi-Fi/Web Server routing before touching physical hardware.

02
Next

Phase 2 — Breadboard & Smoke Test

Wiring the IRLZ44N and ESP32 with a small test load. Validating heat dissipation, PWM frequency hum, and MQTT latency over the local network.

03
Future

Phase 3 — KiCad PCB Design

Designing the industrial schematic. Tracing ultra-thick paths for the high-current power lines and routing the logic layer. Producing the GERBER files for manufacturing.

04
Future

Phase 4 — Fusion360 Enclosure

Designing a 3D-printable housing based on the exact PCB dimensions, incorporating ventilation grilles for thermal exhaust and a dedicated mount for the BH1750 sensor.

GALLERY & DEVLOG

Gallery Image
Gallery Image
Gallery Image