Dimming non-addressable 12V led lights

I want to use ESP8266 or ESP32 to dim these non-addressable 12V led lights. can I do it with WLED or ESPhome?

You can do it with either of them.

1 Like

My only experience with WLED is a 30 led WS2818B 5V strip running directly off the ESP8266 chip.
what components do I need to setup?

I think you’ll need to do some soldering, since the ESP8266 IO pins cannot deliver the power necessary to drive your LED string.

For my RGB LED strips I do something like this on each channel. The single LED represents the whole string of LEDs. There’s a current limiting resistor to prevent a current surge while switching the MOSFET, and a pull-down resistor to hold the gate low unless you drive it high with the ESP8266.

2 Likes

I do have an ESP32 running Esphome to connect the Xiamoi Bluetooth thermometer to the home assistant.
Can you post actual images of the device?

I googled around and found this video

which of these ESP32 board I should buy

or WROOM ESP32 Wifi Based Microcontroller Development Board Nodemcu
and this 15A 400W D4184 MOSFET Trigger Switch Drive Module In Pakistan will work or not?

The 4-pin socket header is for testing with a single RGB LED that can be driven by the ESP8266; the LED strings are driven via the screw terminals.

I am stuck here
image

Clicking on adopt doesn’t do anything. I can access the esp32 on its page 192.xx.xx.xx

some progress but this error

line 27 error

edited the code but when I tried to install it wirelessly
got this error

INFO Reading configuration /config/esphome/esp-web-tools-example-11db18.yaml...
INFO Generating C++ source...
INFO Compiling app...
Processing esp-web-tools-esp32-e94da0 (board: esp32dev; framework: arduino; platform: espressif32 @ 3.3.2)
--------------------------------------------------------------------------------
HARDWARE: ESP32 240MHz, 320KB RAM, 4MB Flash

warning: Calling missing SConscript without error is deprecated.
Transition by adding must_exist=False to SConscript calls.
Missing SConscript '/data/cache/platformio/packages/framework-arduinoespressif32/tools/platformio-build.py'
File "/data/cache/platformio/platforms/espressif32/builder/frameworks/arduino.py", line 41, in <module>
Library Manager: Installing FS
Warning! Could not find the package with 'FS' requirements for your system 'linux_armv7l'
Library Manager: Installing Update
Warning! Could not find the package with 'Update' requirements for your system 'linux_armv7l'
Library Manager: Installing ESPmDNS
Warning! Could not find the package with 'ESPmDNS' requirements for your system 'linux_armv7l'
Dependency Graph
|-- <AsyncTCP-esphome> 1.2.2
|-- <WiFi> 1.2.7
|-- <ESPAsyncWebServer-esphome> 2.0.0
|   |-- <AsyncTCP-esphome> 1.2.2
|-- <DNSServer> 1.1.0
Compiling /data/esp-web-tools-esp32-e94da0/.pioenvs/esp-web-tools-esp32-e94da0/src/esphome/components/api/api_connection.cpp.o
Compiling /data/esp-web-tools-esp32-e94da0/.pioenvs/esp-web-tools-esp32-e94da0/src/esphome/components/api/api_frame_helper.cpp.o
Compiling /data/esp-web-tools-esp32-e94da0/.pioenvs/esp-web-tools-esp32-e94da0/src/esphome/components/api/api_pb2.cpp.o
Compiling /data/esp-web-tools-esp32-e94da0/.pioenvs/esp-web-tools-esp32-e94da0/src/esphome/components/api/api_pb2_service.cpp.o
In file included from /data/cache/platformio/packages/toolchain-xtensa32/xtensa-esp32-elf/include/c++/5.2.0/cstdint:35:0,
                 from src/esphome/components/api/api_frame_helper.h:2,
                 from src/esphome/components/api/api_frame_helper.cpp:1:
/data/cache/platformio/packages/toolchain-xtensa32/xtensa-esp32-elf/include/c++/5.2.0/bits/c++0x_warning.h:32:2: error: #error This file requires compiler and library support for the ISO C++ 2011 standard. This support is currently experimental, and must be enabled with the -std=c++11 or -std=gnu++11 compiler options.
 #error This file requires compiler and library support for the \
  ^
In file included from /data/cache/platformio/packages/toolchain-xtensa32/xtensa-esp32-elf/include/c++/5.2.0/cstdint:35:0,
                 from src/esphome/core/preferences.h:4,
                 from src/esphome/core/application.h:6,
                 from src/esphome/components/api/api_connection.h:4,
                 from src/esphome/components/api/api_connection.cpp:1:
/data/cache/platformio/packages/toolchain-xtensa32/xtensa-esp32-elf/include/c++/5.2.0/bits/c++0x_warning.h:32:2: error: #error This file requires compiler and library support for the ISO C++ 2011 standard. This support is currently experimental, and must be enabled with the -std=c++11 or -std=gnu++11 compiler options.
 #error This file requires compiler and library support for the \
  ^
In file included from src/esphome/components/api/proto.h:4:0,
                 from src/esphome/components/api/api_pb2.h:5,
                 from src/esphome/components/api/api_pb2.cpp:3:
src/esphome/core/log.h:15:21: fatal error: esp_err.h: No such file or directory

*****************************************************************
* Looking for esp_err.h dependency? Check our library registry!
*
* CLI  > platformio lib search "header:esp_err.h"
* Web  > https://platformio.org/lib/search?query=header:esp_err.h
*
*****************************************************************

compilation terminated.
In file included from src/esphome/core/application.h:8:0,
                 from src/esphome/components/api/api_connection.h:4,
                 from src/esphome/components/api/api_connection.cpp:1:
src/esphome/core/helpers.h:10:29: fatal error: esp32-hal-psram.h: No such file or directory

*************************************************************************
* Looking for esp32-hal-psram.h dependency? Check our library registry!
*
* CLI  > platformio lib search "header:esp32-hal-psram.h"
* Web  > https://platformio.org/lib/search?query=header:esp32-hal-psram.h
*
*************************************************************************

compilation terminated.
*** [/data/esp-web-tools-esp32-e94da0/.pioenvs/esp-web-tools-esp32-e94da0/src/esphome/components/api/api_pb2.cpp.o] Error 1
*** [/data/esp-web-tools-esp32-e94da0/.pioenvs/esp-web-tools-esp32-e94da0/src/esphome/components/api/api_connection.cpp.o] Error 1
In file included from src/esphome/components/api/proto.h:4:0,
                 from src/esphome/components/api/api_pb2.h:5,
                 from src/esphome/components/api/api_pb2_service.h:5,
                 from src/esphome/components/api/api_pb2_service.cpp:3:
src/esphome/core/log.h:15:21: fatal error: esp_err.h: No such file or directory

*****************************************************************
* Looking for esp_err.h dependency? Check our library registry!
*
* CLI  > platformio lib search "header:esp_err.h"
* Web  > https://platformio.org/lib/search?query=header:esp_err.h
*
*****************************************************************

compilation terminated.
*** [/data/esp-web-tools-esp32-e94da0/.pioenvs/esp-web-tools-esp32-e94da0/src/esphome/components/api/api_pb2_service.cpp.o] Error 1
In file included from src/esphome/components/socket/socket.h:5:0,
                 from src/esphome/components/api/api_frame_helper.h:13,
                 from src/esphome/components/api/api_frame_helper.cpp:1:
src/esphome/components/socket/headers.h:116:23: fatal error: sys/ioctl.h: No such file or directory
compilation terminated.
*** [/data/esp-web-tools-esp32-e94da0/.pioenvs/esp-web-tools-esp32-e94da0/src/esphome/components/api/api_frame_helper.cpp.o] Error 1
========================= [FAILED] Took 33.25 seconds =========================


Progress so far,
LED does turn on, if I connect the D19 pin on ESP32 to PWM/trigger pin on power mosfet. It doesn’t matter which firmware I have on esp32, tried to flash esphome onto esp32 and ended up with above error (previous post) and then I flashed wled which was flashed without any issue, but I can’t change the brightness from wled app/ web-interface.

this is driving me crazy.

no replies?

I think you also need to connect the ground wire to the mosfet board.

When I connect to ground(esp32) to ground(mosfet board), the LED turns off. it isn’t being controlled by a WLED brightness slider.
I am unable to properly install esphome on ESP32, it gets installed through esp webtool but when I try to upload any sketch the following error happens

INFO Reading configuration /config/esphome/esp-web-tools-example-11db18.yaml...
INFO Generating C++ source...
INFO Compiling app...
Processing esp-web-tools-esp32-e94da0 (board: esp32dev; framework: arduino; platform: espressif32 @ 3.3.2)
--------------------------------------------------------------------------------
HARDWARE: ESP32 240MHz, 320KB RAM, 4MB Flash

warning: Calling missing SConscript without error is deprecated.
Transition by adding must_exist=False to SConscript calls.
Missing SConscript '/data/cache/platformio/packages/framework-arduinoespressif32/tools/platformio-build.py'
File "/data/cache/platformio/platforms/espressif32/builder/frameworks/arduino.py", line 41, in <module>
Library Manager: Installing FS
Warning! Could not find the package with 'FS' requirements for your system 'linux_armv7l'
Library Manager: Installing Update
Warning! Could not find the package with 'Update' requirements for your system 'linux_armv7l'
Library Manager: Installing ESPmDNS
Warning! Could not find the package with 'ESPmDNS' requirements for your system 'linux_armv7l'
Dependency Graph
|-- <AsyncTCP-esphome> 1.2.2
|-- <WiFi> 1.2.7
|-- <ESPAsyncWebServer-esphome> 2.0.0
|   |-- <AsyncTCP-esphome> 1.2.2
|-- <DNSServer> 1.1.0
Compiling /data/esp-web-tools-esp32-e94da0/.pioenvs/esp-web-tools-esp32-e94da0/src/esphome/components/api/api_connection.cpp.o
Compiling /data/esp-web-tools-esp32-e94da0/.pioenvs/esp-web-tools-esp32-e94da0/src/esphome/components/api/api_frame_helper.cpp.o
Compiling /data/esp-web-tools-esp32-e94da0/.pioenvs/esp-web-tools-esp32-e94da0/src/esphome/components/api/api_pb2.cpp.o
Compiling /data/esp-web-tools-esp32-e94da0/.pioenvs/esp-web-tools-esp32-e94da0/src/esphome/components/api/api_pb2_service.cpp.o
In file included from /data/cache/platformio/packages/toolchain-xtensa32/xtensa-esp32-elf/include/c++/5.2.0/cstdint:35:0,
                 from src/esphome/components/api/api_frame_helper.h:2,
                 from src/esphome/components/api/api_frame_helper.cpp:1:
/data/cache/platformio/packages/toolchain-xtensa32/xtensa-esp32-elf/include/c++/5.2.0/bits/c++0x_warning.h:32:2: error: #error This file requires compiler and library support for the ISO C++ 2011 standard. This support is currently experimental, and must be enabled with the -std=c++11 or -std=gnu++11 compiler options.
 #error This file requires compiler and library support for the \
  ^
In file included from /data/cache/platformio/packages/toolchain-xtensa32/xtensa-esp32-elf/include/c++/5.2.0/cstdint:35:0,
                 from src/esphome/core/preferences.h:4,
                 from src/esphome/core/application.h:6,
                 from src/esphome/components/api/api_connection.h:4,
                 from src/esphome/components/api/api_connection.cpp:1:
/data/cache/platformio/packages/toolchain-xtensa32/xtensa-esp32-elf/include/c++/5.2.0/bits/c++0x_warning.h:32:2: error: #error This file requires compiler and library support for the ISO C++ 2011 standard. This support is currently experimental, and must be enabled with the -std=c++11 or -std=gnu++11 compiler options.
 #error This file requires compiler and library support for the \
  ^
In file included from src/esphome/components/api/proto.h:4:0,
                 from src/esphome/components/api/api_pb2.h:5,
                 from src/esphome/components/api/api_pb2.cpp:3:
src/esphome/core/log.h:15:21: fatal error: esp_err.h: No such file or directory

*****************************************************************
* Looking for esp_err.h dependency? Check our library registry!
*
* CLI  > platformio lib search "header:esp_err.h"
* Web  > https://platformio.org/lib/search?query=header:esp_err.h
*
*****************************************************************

compilation terminated.
In file included from src/esphome/core/application.h:8:0,
                 from src/esphome/components/api/api_connection.h:4,
                 from src/esphome/components/api/api_connection.cpp:1:
src/esphome/core/helpers.h:10:29: fatal error: esp32-hal-psram.h: No such file or directory

*************************************************************************
* Looking for esp32-hal-psram.h dependency? Check our library registry!
*
* CLI  > platformio lib search "header:esp32-hal-psram.h"
* Web  > https://platformio.org/lib/search?query=header:esp32-hal-psram.h
*
*************************************************************************

compilation terminated.
*** [/data/esp-web-tools-esp32-e94da0/.pioenvs/esp-web-tools-esp32-e94da0/src/esphome/components/api/api_pb2.cpp.o] Error 1
*** [/data/esp-web-tools-esp32-e94da0/.pioenvs/esp-web-tools-esp32-e94da0/src/esphome/components/api/api_connection.cpp.o] Error 1
In file included from src/esphome/components/api/proto.h:4:0,
                 from src/esphome/components/api/api_pb2.h:5,
                 from src/esphome/components/api/api_pb2_service.h:5,
                 from src/esphome/components/api/api_pb2_service.cpp:3:
src/esphome/core/log.h:15:21: fatal error: esp_err.h: No such file or directory

*****************************************************************
* Looking for esp_err.h dependency? Check our library registry!
*
* CLI  > platformio lib search "header:esp_err.h"
* Web  > https://platformio.org/lib/search?query=header:esp_err.h
*
*****************************************************************

compilation terminated.
*** [/data/esp-web-tools-esp32-e94da0/.pioenvs/esp-web-tools-esp32-e94da0/src/esphome/components/api/api_pb2_service.cpp.o] Error 1
In file included from src/esphome/components/socket/socket.h:5:0,
                 from src/esphome/components/api/api_frame_helper.h:13,
                 from src/esphome/components/api/api_frame_helper.cpp:1:
src/esphome/components/socket/headers.h:116:23: fatal error: sys/ioctl.h: No such file or directory
compilation terminated.
*** [/data/esp-web-tools-esp32-e94da0/.pioenvs/esp-web-tools-esp32-e94da0/src/esphome/components/api/api_frame_helper.cpp.o] Error 1
========================= [FAILED] Took 33.25 seconds =========================

here is the log from esp2 device page

Finally got it to work. For details check video description

1 Like

After doing it with WLED, I have installed esphome on the second esp32 with the following code which includes other sensors too.

esphome:
  name: esp-web-tools-esp32-xxxxx
  platform: ESP32
  board: esp32dev

# Enable logging
logger:

# Enable Home Assistant API
api:

ota:
  password: "xxxxxxxxxxxxxxxxxxxxxxx"

esp32_ble_tracker:

wifi:
  ssid: "ABC"
  password: "xxxxxxxxxxxxxxxxx"

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Esp-Br-Node Fallback Hotspot"
    password: "xxxxxxxxxxxxxxxx"

captive_portal:

sensor:
  - platform: xiaomi_lywsd03mmc
    mac_address: "xx:xx:xx:xx:xx"
    bindkey: "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
    temperature:
      name: "Room Temperature"
    humidity:
      name: "room Humidity"
    battery_level:
      name: "room Battery Level"
  - platform: esp32_hall
    name: "ESP32 Hall Sensor"
    update_interval: 5s          
# Example configuration entry
light:
  - platform: status_led
    name: "Switch state"
    pin: GPIO2

Now I want to do what I did with wled,

  • Turn on the light at sunrise
  • Increase brightness gradually until midday
  • Decrease brightness gradually until sunset
  • Turn off the light at Sunset.
    How should I do it?

Edit:
What should mention in brightness

I went through light integration but it I am more confused. Light - Home Assistant

complete circuit explained

1 Like