Hello there! I followed the tips in the first post (Thanks @KablammoNick) and managed to make my LED strip light up.
But I noticed that it kept “flickering” a lot. I did some setup assembly tests (I’ll add pictures below) and in some cases it improved, in others it got worse.
First: Along with the LED control functions, I tried to implement a Bluetooth Proxy. I noticed that with it, the LEDs flickered more, so I removed it from my ESPHome programming and it improved a little. (But it could also be a placebo).
Since I was initially powering the LEDs with the 5V from my development board, I thought it could be a lack of power or something like that, so I connected it to an external power supply. Then things got even worse. The LEDs kept blinking and now they’re very weak.
Below I’ll illustrate with pictures, please ignore the colors of the wires, as this is a temporary assembly.
Here, the LEDs and power supply are connected directly by the development board.
The purple and white wires are pinA and pinB that go to the L298N control board. The green wire is 5V and the blue wire is GND.
(I had to remove the image because new users can only post one image per post. Why?! )
Here is the L298N board, receiving 5V in the 12V input, GND from GND and the wires from the ESP pins (yes, the colors are different because the cables were spliced)
(I had to remove the image because new users can only post one image per post. Why?! )
In this connection case, I have this result on the LED strip. Notice how bright the lights are.
(I had to remove the image because new users can only post one image per post. Why?! )
Now, I changed the power supply of the L298N board to an external power supply, connected directly to a powerful USB source (which even delivered more voltage than the ESP board). Notice how the LEDs are off, weak, brigthless.
(I had to remove the image because new users can only post one image per post. Why?! )
When I went to disconnect the external source again, I noticed that when I touched the heat sink, creating a grounding, the LEDs lit up brighter.
(I had to remove the image because new users can only post one image per post. Why?! )
But not as bright as if they were connected directly to the development board.
(I had to remove the image because new users can only post one image per post. Why?! )
So I reconnected the power supply to the ESP32 development board, and here is a short video of the LEDs flickering.
I just noticed, after completely rereading the topic, that the noble colleague made a connection from the ESP32 GND to the L298N board GND even when using separate sources. This would possibly improve the case of weak LEDs. But would it also solve the flashing LEDs?
PS: The LED strip I bought was originally connected to USB, with a manual on/off control and some effects, but without Wi-Fi, without Bluetooth, very simple. That’s why I’m connecting it directly with USB power.
This is my ESPHome code
esphome:
name: luzinhas
friendly_name: Luzinhas
project:
name: "jrmania.fairylights"
version: "1.0.0"
esp32:
board: esp32dev
framework:
type: arduino
# Enable logging
logger:
# Enable Home Assistant API
api:
encryption:
key: "****"
ota:
- platform: esphome
password: "****"
wifi:
networks:
- ssid: !secret wifi_ssid
password: !secret wifi_password
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "Safe Fallback"
password: !secret router_password
captive_portal:
web_server:
port: 80
version: 3
ota: true
auth:
username: !secret router_user
password: !secret router_password
#EXTRA SENSORS
sensor:
- platform: internal_temperature # Reports the interna temperature of the board
name: "Temperatura interna"
- platform: wifi_signal # Reports the WiFi signal strength/RSSI in dB
name: "Sinal WiFi (dB)"
id: wifi_signal_db
update_interval: 60s
entity_category: "diagnostic"
- platform: copy # Reports the WiFi signal strength in %
source_id: wifi_signal_db
name: "Sinal WiFi (%)"
filters:
- lambda: return min(max(2 * (x + 100.0), 0.0), 100.0);
unit_of_measurement: "%"
entity_category: "diagnostic"
text_sensor:
- platform: version
name: "ESPHome Version"
- platform: wifi_info
ip_address:
name: ESP IP Address
ssid:
name: ESP Connected SSID
mac_address:
name: ESP Mac Wifi Address
dns_address:
name: ESP DNS Address
#Lights control
output:
- platform: ledc
id: pinA
pin: GPIO26
- platform: ledc
id: pinB
pin: GPIO14
light:
- platform: hbridge
id: ledstrings
name: "Luzinhas"
pin_a: pinA
pin_b: pinB
restore_mode: ALWAYS_OFF
effects:
- strobe:
name: "Flash A-B 500ms"
colors:
- state: true
color_temperature: 2000 K
duration: 500ms
- state: true
color_temperature: 6534 K
duration: 500ms
- strobe:
name: "Flash A-AB-B 500ms"
colors:
- state: true
color_temperature: 2000 K
duration: 500ms
- state: true
color_temperature: 3500 K
duration: 500ms
- state: true
color_temperature: 6534 K
duration: 500ms
- state: true
color_temperature: 3500 K
duration: 500ms
- lambda:
name: "Fade A-AB-B 10s"
update_interval: 10s
lambda: |-
static int state = 0;
auto call = id(ledstrings).make_call();
call.set_transition_length(10000);
if (state == 0) {
call.set_warm_white(1.0);
call.set_cold_white(0.0);
} else if (state ==1) {
call.set_warm_white(0.0);
call.set_cold_white(1.0);
}
call.perform();
state += 1;
if (state == 2)
state = 0;
- lambda:
name: "Slow-Glo | Fade A-AB-B 2s 0.2"
update_interval: 2s
lambda: |-
static int state = 0;
auto call = id(ledstrings).make_call();
call.set_transition_length(2000);
if (state == 0) {
call.set_warm_white(1.0);
call.set_cold_white(0.2);
} else if (state ==1) {
call.set_warm_white(0.2);
call.set_cold_white(1.0);
}
call.perform();
state ++;
if (state == 2)
state = 0;