logo elektroda
logo elektroda
X
logo elektroda

Custom Zigbee Gateway on ESP32/8266 and ksIotFramework (framework for iot)

cziter15 3174 2

TL;DR

  • A custom Zigbee gateway for ESP32/8266 uses ksIotFramework/xIotFramework, a composition-based IoT framework built from reusable components like WiFiConnector, MqttConnector, and Led.
  • Zigbee runs on an EBYTE-E180 module with EZSP firmware, exposing UART over a socket as a Serial-to-Ethernet bridge instead of implementing Zigbee logic on the ESP.
  • The gateway also acts as an audio notifier using the MAX98357A I2S DAC, ESPAudio-I2S MP3 decoding, MQTT playback commands, and a speaker of up to 3 W.
  • The finished unit is meant for a central room, combining Zigbee bridging with sound and LED notifications instead of being only a USB Zigbee stick.
Generated by the language model.
ADVERTISEMENT
Treść została przetłumaczona polish » english Zobacz oryginalną wersję tematu
📢 Listen (AI):
  • Welcome,

    I've been building projects based on ESP32/8266 microcontrollers for a couple of years now. I played around with atmegas / Arduino at first, but once the aforementioned modules fell into my hands, I stayed with them. I base my projects on xIotFramework - my own IoT framework, which is based on Arduino ports under ESP. I wrote it mainly so that I don't have to clone the firmware pattern every time, but separate the shared components into a separate library.

    I wrote the library based on what I learned from programming games professionally - a composition-based architecture where each category of functionality is embedded in a separate component. Examples of components include WiFiConnector, MqttConnector and Led. Each component resembles a separate Arduino program. They all execute in sequence and are encapsulated in an Application object.

    But back to the project - Zigbee Gateway .

    The Zigbee protocol is a solution present in home automation. Thanks to off-the-shelf modules such as the EBYTE-E180, its implementation in the device is simple. All you need to do is run the EZSP firmware on it, which exposes the entire interface via the UART. What's more, there are many ready-made programs to support this protocol, including there are plug-ins for Home Assistants. It turned out that I don't need to implement all the logic on the ESP, but only expose the UART to the socket - i.e. de facto make a sort of Serial To Ethernet bridge. This is how I handled Zigbee in the project.

    Zigbee Gateway module with visible electronic components. .

    However, I wanted the Zigbee gateway to be more than just a simple gateway, as such can be purchased as a USB stick. The device was to be mounted in a central room and also serve as an electronic notification assistant. This functionality was realised with the MAX98357A chip, which is an I2S DAC converter. A speaker of up to 3 W can be connected virtually directly to it. Decoding of MP3 streams is carried out with the help of the ESPAudio-I2S library. Requests to play specific sounds arrive with the help of MQTT. Alerts are also signalled via an LED.

    Zigbee Gateway with blue lighting on a wooden shelf next to a festive box. .

    Interestingly, the ESP32S3 has hardware USB. This gives the possibility for debugging and software updates.

    Both the chassis and PCB were designed at EasyEDA. I outsourced the manufacturing of the laminates and the case to an external company. Soldering the 0603 components is not difficult, I did this using a hotplate, good flux and paste.

    Updates and worklogs can also be found on Hackaday:
    https://hackaday.io/project/194721-ks-zigbee-gateway .

    Cool? Ranking DIY
    About Author
    cziter15
    Level 11  
    Offline 
    cziter15 wrote 34 posts with rating 21, helped 2 times. Live in city Bydgoszcz. Been with us since 2013 year.
  • ADVERTISEMENT
  • #2 21418336
    gulson
    System Administrator
    Posts: 29234
    Help: 148
    Rate: 5984
    Thank you for your presentations. There is a lot going on here, and a relatively short description. We even have a new framework. Do you have any plans for development? I see you are making everything available on github, maybe some sort of community will build up?
    If you drop me a Paczkomat on Private Message, I'll send a small gift.
  • #3 21418493
    cziter15
    Level 11  
    Posts: 34
    Help: 2
    Rate: 21
     gulson wrote:
    Lots going on here, and a relatively short description. We even have a new framework.
    .
    Typical problem of post writing by the author. The framework has been a few years in the making, I have put several devices on it. I started with simple circuits on ESP8266 where in basically every device I suddenly had to copy WiFiManager and its entire setup. Currently, I have come to a place where I have my own device portal written in Vue as a Single Page Application. This page is served as a compressed 'blob' and uses Cache mechanisms. Further communication flies over Websocket. This gives a very responsive interface both for configuring the WiFi target from within the AP, and during normal operation - as a debugging interface for the device.

    Screenshot of the device portal showing technical details of the ESP32 device. .

    Screenshot of a device showing a terminal with application logs and a command input field.

    The effect of the device can best be seen from the HomeAssistant frontend:
    Smart home management system user interface showing a room overview. .

    We can control lighting, switches and also monitor parameters such as humidity, light intensity or temperature.
    Basically, everything depends on which actuators and sensors we connect to the Zigbee network.

    gulson wrote:
    Do you have any development plans?
    .
    Nothing concrete, I would like to build a drone in some time - also based on the framework. Everything at the moment is as a hobby project.

    gulson wrote:
    I see you are making everything available on github, maybe some sort of community will build up?
    .
    It would be nice to build such a community around the framework, as it significantly speeds up the design of small IoT devices especially for hobbyists. I'll honestly admit that here I'm a bit unsure how to reach people with this project.
📢 Listen (AI):

FAQ

TL;DR: Built for ESP32/8266 hobbyists, this custom Zigbee gateway combines 1 Zigbee bridge with audio alerts and a status LED; as the author puts it, "only expose the UART to the socket." It solves a common problem: turning an ESP32S3 into a Home Assistant-ready Zigbee hub plus notification node, not just another USB dongle. [#21417811]

Why it matters: It shows how one ESP32S3 device can replace repeated firmware boilerplate, centralize Zigbee access, and add speaker-based home alerts in a single custom build.

Option Zigbee role Extra functions Physical form
Custom ESP32S3 gateway UART-to-socket bridge for Zigbee MP3 audio, LED alerts, device portal, USB debugging Wall/room-mounted custom PCB and enclosure
Simple USB Zigbee stick Basic Zigbee interface None mentioned USB dongle

Key insight: The project avoids reimplementing Zigbee on the ESP. Instead, it exposes the Zigbee module over UART and socket, then uses the ESP32S3 for integration, audio notifications, and device management. [#21417811]

Quick Facts

  • The notification section uses a MAX98357A I2S DAC and can drive a speaker at up to 3 W, with MP3 playback handled by the ESPAudio-I2S library. [#21417811]
  • The PCB and enclosure were designed in EasyEDA, while assembly used a hotplate, flux, and paste for 0603 components. [#21417811]
  • The framework has been developed for a few years and already powers several devices, including earlier ESP8266 builds. [#21418493]
  • The device portal is a Vue Single Page Application served from the device as a compressed blob, with live communication over WebSocket. [#21418493]
  • The Zigbee gateway can expose Home Assistant entities for lighting, switches, humidity, light intensity, and temperature, depending on connected Zigbee nodes. [#21418493]

What is ksIotFramework and how does its composition-based architecture work on ESP32 and ESP8266?

ksIotFramework is an IoT framework for ESP32 and ESP8266 that groups functions into reusable components instead of cloning firmware per device. The author says it was built over a few years after repeated WiFiManager reuse became painful. Components such as WiFiConnector, MqttConnector, and Led run sequentially and are encapsulated inside one Application object. That composition model mirrors patterns learned from professional game programming. [#21418493]

How do you build a custom Zigbee gateway on ESP32S3 using an EBYTE-E180 module and EZSP firmware?

You build it by pairing an ESP32S3 with an EBYTE-E180 Zigbee module flashed with EZSP firmware and then bridging its UART outward. 1. Run EZSP firmware on the EBYTE-E180. 2. Connect the module to the ESP over UART. 3. Expose that UART as a socket so external software can handle Zigbee logic. The finished board can also add a speaker, LED, and custom enclosure for room-mounted use. [#21417811]

Why expose the Zigbee UART as a socket on ESP instead of implementing the whole Zigbee logic directly on the microcontroller?

Exposing UART as a socket keeps the ESP firmware simpler and lets existing Zigbee software handle the protocol stack. The author states there are ready-made Zigbee programs and Home Assistant plug-ins, so the ESP only needs to act as a Serial-to-Ethernet bridge. That design leaves ESP32S3 resources available for alerts, LEDs, the web portal, and debugging. [#21417811]

What is EZSP firmware and how does it let a Zigbee module communicate over UART?

"EZSP firmware" is firmware that exposes a Zigbee module interface over UART, letting an external controller access protocol functions without implementing the full stack locally. In this project, running EZSP on the EBYTE-E180 makes the module usable from the ESP through a serial link, which the ESP then forwards to a socket. That is the core of the gateway design. [#21417811]

How does a custom ESP32 Zigbee gateway compare with a simple USB Zigbee stick for Home Assistant use?

A custom ESP32 gateway does more than a USB Zigbee stick because it combines Zigbee bridging with local notification features. The author explicitly says a simple gateway can be bought as a USB stick, but this device also adds MQTT-triggered sound playback, LED alerts, a custom enclosure, and central-room mounting. For Home Assistant, it still exposes Zigbee devices while adding speaker-based status feedback. [#21417811]

Which components of ksIotFramework handle WiFi, MQTT, LEDs, and the main application flow?

WiFiConnector handles WiFi, MqttConnector handles MQTT, Led handles LED behavior, and the Application object coordinates execution. The thread describes each component as resembling a separate Arduino program. They run in sequence inside the application, which is the framework’s main orchestration layer on ESP32 and ESP8266. [#21417811]

How can MQTT be used to trigger MP3 sound playback and LED alerts on an ESP32-based notification gateway?

MQTT can send requests that tell the ESP32 gateway to play a specific sound and flash or update an LED alert. In this design, MP3 streams are decoded through the ESPAudio-I2S library, while alert requests arrive through MQTT. The same device therefore acts as a Zigbee gateway and a room notification assistant with audio plus visual signaling. [#21417811]

What is the MAX98357A and how do you connect it to an ESP32S3 as an I2S DAC for a 3 W speaker?

"MAX98357A" is an I2S DAC converter that turns digital audio from the ESP32S3 into speaker output, with support in this project for a speaker of up to 3 W. The author used it as the audio stage of the gateway’s notification system. The connection model is simple: the ESP32S3 sends I2S audio, and the MAX98357A drives the speaker directly enough for this build. [#21417811]

How does the ESPAudio-I2S library decode MP3 streams on ESP32, and what setup is needed?

The ESPAudio-I2S library decodes MP3 streams on the ESP32 and feeds audio to the project’s I2S DAC path. In this setup, the required pieces are an ESP32-class board, the library, an I2S output stage using MAX98357A, and MQTT messages that request playback. The thread does not list pin mapping, so wrong wiring remains the main practical setup risk. [#21417811]

What are the advantages of hardware USB on the ESP32S3 for debugging and firmware updates?

Hardware USB on the ESP32S3 gives the board direct support for debugging and software updates. The author highlights this as a useful feature of the chosen MCU, not just a convenience. In a custom enclosure, that matters because one USB connection can simplify both development access and later firmware maintenance. [#21417811]

How do you create a device configuration portal in Vue as a Single Page Application served from an ESP device with WebSocket communication?

You create it by serving a Vue Single Page Application from the device as a compressed blob and then using WebSocket for live communication. The author says this approach supports WiFi target configuration in AP mode and also gives a responsive debugging interface during normal operation. Cache mechanisms improve loading behavior, so the interface feels fast despite running from an embedded device. [#21418493]

What does the Home Assistant frontend look like for a Zigbee gateway built on ksIotFramework, and which sensors or actuators can it expose?

The Home Assistant frontend presents controllable Zigbee entities and live measurements from the network. The author says it can expose lighting and switches, plus humidity, light intensity, and temperature. The exact entity set changes with the Zigbee actuators and sensors you join, so the gateway’s visible features expand with the network. [#21418493]

What development plans make the most sense for ksIotFramework beyond a Zigbee gateway, such as a drone or other hobby IoT devices?

The clearest next step is broader hobby use, because the framework already powers several devices and aims to speed small IoT builds. The author mentions a drone as one desired future project, but no concrete roadmap or release plan. A practical direction is to keep reusing the framework where WiFi, MQTT, UI, and debugging repeat across devices. [#21418493]

What is the best way to design and assemble a custom PCB and enclosure in EasyEDA for an ESP32 project with 0603 components?

A practical method is to design both the PCB and enclosure in EasyEDA, outsource fabrication, and assemble the board with a hotplate, good flux, and solder paste. The author reports that soldering 0603 parts is not difficult with that workflow. This keeps one-off ESP32 hardware manageable for hobby production while still allowing a custom room-mounted form factor. [#21417811]

How can an open-source ESP32 IoT framework on GitHub attract a community of hobbyists and contributors?

It can attract a community by proving reuse across several real devices and by lowering the setup burden for hobbyists. The author says the framework significantly speeds small IoT device design and is already published on GitHub, but also admits uncertainty about outreach. The strongest community hook is concrete demos: Zigbee integration, a Vue portal, MQTT alerts, and Home Assistant visibility. [#21418493]
Generated by the language model.
ADVERTISEMENT