Electronics
NeoPixel Strip over MQTT with a NodeMCU
A NodeMCU that sets on, brightness, hue and saturation of a 16-pixel NeoPixel strip over MQTT.
- NodeMCU
- MQTT
- Archived
- 1 min read
Archived project
The GitHub repository for this project is archived: it is read-only and no longer updated. What follows describes the project as it was, so check for a newer alternative before you build it.
A NeoPixel strip that you control over MQTT: on and off, brightness, hue and saturation. The strip is the kind that this site uses in many projects, driven from a NodeMCU.
Homebridge is a program that runs on a computer such as a Raspberry Pi, and makes devices that do not support HomeKit show up in the Apple Home app. This project dates from the Homebridge years, before the native HomeKit firmware of this site. For how the site builds HomeKit devices today, see HomeKit or Matter for your ESP32.
MQTT is a light messaging protocol: devices publish messages on a topic, and other devices that subscribe to that topic receive them, through a broker.

The hardware
| Part | Details |
|---|---|
| NodeMCU (ESP8266) | The controller. The data line of the strip is on pin D2 |
| NeoPixel strip | 16 pixels in the sketch, GRB order at 800 kHz |
| Supply | 5 V, 2 A, as marked in the diagram |
| Capacitor | On the supply of the strip |
The topics
The sketch subscribes to everything under the host name of the module. The message says what to change:
| Topic | What it sets |
|---|---|
<host> | On or off |
<host>/brightness | The brightness |
<host>/hue | The hue |
<host>/saturation | The saturation |
When it connects, the module publishes a greeting with its name on outTopic.
Good to know
- The sketch is version 5.0.3 and uses the Adafruit NeoPixel and PubSubClient libraries.
- The repository is under the MIT licence.
- Apple, HomeKit and Homebridge are trademarks of their owners. This project is not made or approved by them.
The project is in the HomeBridge-MQTT-NeoPixel repository on GitHub.
More projects
Keep building.
Electronics, 3D printing and CNC builds, documented from the first idea to the last screw.
All projects

