DIY Shop Smart Lighting: ESP32, 12V LED Strips, and WLED

Repair and Smart Shop Lighting: Build a Customizable System with ESP32, 12 V LED Strips, and WLED

My Noma Shop lights (from Canadian Tire) lasted about 2 years then they stopped illuminating. I decided to repair them by replacing and adding components to the lighting chassis.

Are you looking to upgrade your shop lighting with a smart, energy-efficient system? This guide will show you how to use an ESP32 microcontroller, BTF LED strips, and WLED firmware to create a customizable and intelligent lighting solution. By the end of this tutorial, you’ll have a lighting system that you can control from your smartphone or adjust manually using a rotary encoder.

Core Components

Before we dive into the wiring and setup, here’s a list of the key components you’ll need for this project:


Step 1: Wiring the Power System

The power system setup is the backbone of this project. Here’s how to wire the 12V power supply, MOSFET regulator, and buck converter:

Connect the 12V Power Supply Output:

  1. Positive terminal to the buck converter and MOSFET regulator.
  2. Negative terminal to the common ground (GND) of all components.

Current Calculation for a 1-Meter LED Strip

  • Power Draw: 14W/m
  • Current: Power (W) / Voltage (V) = 14W / 12V = 1.2A
  • Ensure the power supply can handle the LED strip’s current draw with a safe margin (2A is sufficient for this project).

MOSFET Regulator & ESP32 Power:

  • The MOSFET Regulator will handle the current required for the LED strip.
  • The ESP32 requires 5V, supplied by the buck converter stepping down the 12V input.
  • Connect the buck converter’s 5V output to the ESP32 VIN pin, ensuring it’s well-regulated.

Fuse and Pull Switch:

  • Add a panel mount fuse (3A–6A slow-blow) on the positive 12V line between the power supply and MOSFET input.
  • Retain the JX42B pull switch after the fuse for manual power control.

Step 2: LED Strip Control

The MOSFET Regulator controls the power to the LED strip. Here’s how to wire this part of the system:


MOSFET Board

MOSFET PinESP32 Pin (GPIO)Board Pin (P)Description
DC+ Input12V Power SupplyConnect to the positive terminal of the power supply
DC- InputGNDConnect to the ground terminal of the power supply
DC+ OutputTo LED Strip (+)Positive terminal to the LED strip
DC- OutputTo LED Strip (-)Negative terminal to the LED strip
GNDGNDGNDGround connection for the control circuit
PWM Input SignalGPIO13P13PWM signal to control brightness from the ESP32

Additional Notes

  1. Preinstalled Resistors: The MOSFET board includes built-in resistors for stable operation. External resistors are unnecessary.
  2. Power Supply and LED Strip Connections:
    • Connect the 12V power supply to the DC+ Input and DC- Input pins.
    • The LED strip’s positive terminal connects to DC+ Output, and the negative terminal connects to DC- Output.
  3. The PWM Input Signal pin receives a pulse-width modulation signal from the ESP32, allowing brightness control.

Step 3: Manual Control with Rotary Encoder

To manually adjust the brightness, you’ll integrate a rotary encoder into the system:

Connect the Rotary Encoder:

  • GND to ESP32 GND.
  • CLK and DT pins to ESP32 GPIO pins (e.g., GPIO12 and GPIO27).
  • SW (push button) to another GPIO pin (e.g., GPIO33).

The rotary encoder will allow you to adjust brightness levels, adding flexibility in case smartphone control isn’t convenient.

Typical Connections

Here’s how you can connect the rotary encoder to the ESP32:

Component Pin Connections

Rotary Encoder

Encoder PinESP32 Pin (GPIO)Board Pin (P)Description
SWGPIO33P33Switch pin (button press)
GNDGNDGNDGround connection
Out A (CLK)GPIO27P27Clock signal from encoder
Out B (DT)GPIO12P12Data signal from encoder
GNDGNDGNDGround connection (shared with SW)

Step 4: Configure WLED Firmware for Smart Control

Once your hardware is set up, it’s time to install and configure the WLED firmware on the ESP32. This step enables smart lighting control via your smartphone or web interface.

  1. Flash WLED Firmware onto the ESP32 using the WLED installation guide. Recommended Firmware is MoonMod
  2. Open your browser and go to the IP address of your ESP32 (you’ll find this in your router’s connected devices list or using a network scanning tool), or use a WiFi device to connect to the access point WLED-AP using the default password wled1234.
  3. In the WLED settings, configure the GPIO pin (e.g., GPIO13) to control the LED strip with PWM White.
  4. Set the strip type to PWM White (as you’re using a single color LED strip, not RGB).
  5. Set the state when power returns if lost, to run 250, as this is the saved last state.

Key Features Using WLED:

  • Smartphone Control: Control brightness and effects from the WLED app or web interface.
  • Manual Overrides: Use the rotary encoder for dimming when app control isn’t practical.
  • Presets: Program lighting scenes, such as full brightness for work and dimmed for ambiance.
  • Expandability: WLED supports integration with smart home platforms like Home Assistant, Alexa, or Google Home.

Step 5: Add Safety with a Panel Mount Fuse

For added protection, install a Panel Mount Fuse in your circuit:

Fuse Rating:

  • The 1-meter LED strip draws 1.17A at 12V, so we recommend using a 3A to 6A slow-blow fuse. This will handle inrush currents when powering up without tripping immediately.

Fuse Installation:

  • Place the fuse on the positive 12V line between the power supply and the MOSFET input. This ensures the fuse will blow if the system exceeds the rated current, preventing damage to your components.

Step 6: Configure the Rotary Encoder in WLED

  1. Flash WLED on the ESP32: If you haven’t already, follow the steps in Step 4 to install the WLED firmware onto your ESP32.
  2. Access the WLED Web Interface:
    • Open your browser and go to the IP address of your ESP32 (you’ll find this in your router’s connected devices list or using a network scanning tool), or use a WiFi device to connect to the access point WLED-AP using the default password wled1234.
  3. Configure GPIO Pins for the Rotary Encoder:
    • Navigate to Settings > GPIO settings.
    • For Rotary Encoder setup, you’ll need to configure the following pins:
      • Encoder CLK Pin: This is the pin connected to the CLK pin on the rotary encoder.
      • Encoder DT Pin: This is the pin connected to the DT pin.
      • If the rotation is reversed, then swich pins between CLK and DT.
      • Encoder Button Pin (optional): This is the pin connected to the SW (push button) on the encoder, if you want to use it for switching modes or toggling brightness.

Example GPIO assignments:

  • CLK pin: GPIO 12
  • DT pin: GPIO 27
  • SW pin: GPIO 33 can alternatively be set in LED Preferences > Button 0 GPI0 to 33
  1. Enable Rotary Encoder Functionality:
    • After assigning the pins, scroll down to Rotary Encoder settings.
    • Enable the Rotary Encoder feature by checking the box for Enable Rotary Encoder.
    • You can configure whether the encoder controls the brightness or other settings like effects.
  2. Test the Rotary Encoder:
    • Once you’ve configured it, go to the WLED web interface or app and test turning the encoder.
    • The rotary encoder should now control the brightness or the selected parameter.

WLED Settings for Rotary Encoder Control:

  • Brightness Control: By default, the rotary encoder can be set to control the brightness. This is often the most common setting.
  • Fast Control: Some versions of WLED allow you to adjust how fast the encoder changes settings. You can fine-tune this in the settings if needed.

Safety Considerations

Ensure all connections are insulated to avoid short circuits.

Use a panel mount fuse (3A slow-blow recommended) in the positive 12V line between the power supply and the MOSFET.

Retain the JX42B pull switch for manual power control, placing it directly after the fuse.

Step 7: Project Box

I have designed a project box and posted it on Printables. Here is the Link for this project:

Final Thoughts

By following this guide, you can easily upgrade your shop lighting with a customizable, smart system. The ESP32 and WLED firmware give you full control over your lighting, while the MOSFET Regulator and rotary encoder offer seamless manual control. Whether you’re looking for energy efficiency or advanced features like remote control, this system has it all. With the retained JX42B pull switch and the added safety of a panel mount

Scroll to Top