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

 



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

MOSFET Regulator & ESP32 Power:

Fuse and Pull Switch:


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 Pin ESP32 Pin (GPIO) Board Pin (P) Description
DC+ Input 12V Power Supply — Connect to the positive terminal of the power supply
DC- Input GND — Connect to the ground terminal of the power supply
DC+ Output To LED Strip (+) — Positive terminal to the LED strip
DC- Output To LED Strip (-) — Negative terminal to the LED strip
GND GND GND Ground connection for the control circuit
PWM Input Signal GPIO13 P13 PWM 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:
    1. Connect the 12V power supply to the DC+ Input and DC- Input pins.
    2. 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:

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 Pin ESP32 Pin (GPIO) Board Pin (P) Description
SW GPIO33 P33 Switch pin (button press)
GND GND GND Ground connection
Out A (CLK) GPIO27 P27 Clock signal from encoder
Out B (DT) GPIO12 P12 Data signal from encoder
GND GND GND Ground 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
    1. MoonMod: ESP32 (4MB Flash, M: Audioreactive, Usermods incl: Temp, AutoSave, 4-L Display, Rotary encoder)
    2. LINK: https://wled-install.github.io/
  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:


Step 5: Add Safety with a Panel Mount Fuse

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

Fuse Rating:

Fuse Installation:

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:
    1. 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:
    1. Navigate to Settings > GPIO settings.
    2. For Rotary Encoder setup, you’ll need to configure the following pins:
      1. Encoder CLK Pin: This is the pin connected to the CLK pin on the rotary encoder.
      2. Encoder DT Pin: This is the pin connected to the DT pin.
      3. If the rotation is reversed, then swich pins between CLK and DT.
      4. 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:

  1. Enable Rotary Encoder Functionality:
    1. After assigning the pins, scroll down to Rotary Encoder settings.
    2. Enable the Rotary Encoder feature by checking the box for Enable Rotary Encoder.
    3. You can configure whether the encoder controls the brightness or other settings like effects.
  2. Test the Rotary Encoder:
    1. Once you’ve configured it, go to the WLED web interface or app and test turning the encoder.
    2. The rotary encoder should now control the brightness or the selected parameter.

WLED Settings for Rotary Encoder Control:

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:

Printables Project Box

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

Share on:

← Back Home