Smart Bulb

Ursescu Ionut - AAC2


The idea behind this project is to implement a smart lighting system. Basically a web interface that can be exposed over ethernet everywhere in world that is allowing the user to control placed bulbs and led strips. For the purpose of this project I've chosen to implement in two ways. First implementation is a standalone one, meaning that it's only based on ESP32 hardware and a very simple web interface to demonstrate the project capabilities. The second implementation is based on a very popular system for home automation called “Home Assistant”. I didn't want to implement the system as a standalone one because it is very hard to integrate with other solution present on the market. So that being said, in the following document I'll expose the used hardware, software libraries used some block diagrams explaining the application flow. After that I will explain how this project was ported to Home Automation and some pictures with the web application.


For this project, I used 2 ESP32 modules:

  • WS2811 Led Strip
  • Relay Module
  • Normal LED Bulb
  • Normal Wall Socket

This project contains 2 ESP32 modules, because as I said in the description this project was implemented in two ways and I wanted to present both of them:

  1. The first system is based on a simple ESP32 Board connected the led strip and demonstrates how the user can control the LED strip color from web interface. The LED strip is a 3-wire one, which has 5V, GND and CTRL connections. CTRL pin is connected to GPIO14.
  2. The second system uses yet another ESP32 Board module that controls the the Relay which is basically the ON/OFF controller for the LED Bulb and Wall Socket. Also this board is able to connect to LED Strip. This system is controlled over Home Assistant interface.

The hardware schema system 1:

The hardware schema system 2 (note that system 2 is also capable of using LED STRIP)


When it comes to software, I used ESP-IDF and the following libraries:

  • First system
    • ESP-IDF Wireless component - to connect to the internet
    • ESP-IDF HTTP Server component - to send HTTP requests over the Wifi Connection from browser
    • FastLed - library to control the Led Strip
    • FreeRTOS tasks, queues, event groups, part of ESP-IDF SDK.
    • Standard HTML for testing web interface
  • Second system
    • Fully featured Home Assistant virtual machine running in bridge mode
    • ESP-Home to port the application to Home Assistant

The code flow can be described as a simple state machine:

Final result

Managed to create a working system that can be used in real life scenarios. Being integrated with Home Automation, it is very easy to add new functionality and to improve the control over a lot of lighting systems. Also it can also be extended to other systems, controlling the power for devices as shown in the photos.

To test this project, I used a very simple hardware configuration mounted on a wood plank:

And the Home Assistant user interface:


The demo will be a live demo controlling the bulb over network.


iothings/proiecte/2021/smartbulb.txt · Last modified: 2022/01/28 10:22 by ionut.ursescu
CC Attribution-Share Alike 3.0 Unported Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0