I’m facing issues with the TLC5973 LED driver when paired with the WT32-ETH01 microcontroller. In my project, I use the TLC5973 to control LEDs. When I try dimming just one color, everything works perfectly. However, as soon as I dim two or three colors, flickering starts to occur.
I have a stable power supply and adding a capacitor didn’t make a difference. After some debugging and using an oscilloscope, I noticed that some of the PWM pulses from the TLC appear shorter than they should be. This might explain the flickering.
I’ve attempted several things but turning off the WiFi and Bluetooth on the WT32-ETH01 with WiFi.mode(WIFI_OFF); and btStop(); commands seemed to help a lot, but the flickering is still not entirely gone. Therefore I assume it could be an Issue with the timing or Interrupts which occur.
Has anyone had experience with this hardware combination or can offer tips on optimizing the timing? Is it feasible to rewrite the library to be better suited for the TLC5973 and the WT32-ETH01?
I am using the project from:
This project is written for Arduino so it might be some issues while using and ESP (WT32-ETH01)…
Any help or recommendations would be greatly appreciated!
Weird, the libary already disabled the interrupts so that it can bitbang the bus with the proper timing.
If you still find interfernce from WiFi interrupts or other things, you might see a benefit from running the LED driver library code (i.e. TLC5973::show()) from Core 1 instead of Core 0. See here and here.
But still when I try to activate WIFI the LEDs flicker, because I think that the WIFI interrupts my main loop in which the led fades from 0-100%.
Here is my main function with the LED fade:
#include <TLC5973.h>
#include <WiFi.h>
#include "esp_bt.h"
byte LED = 4;
uint16_t N = 1; // One LED on each output
TLC5973 strip = TLC5973(N, LED);
int fadeValue = 0; // Start with LED off
bool increasing = true; // Direction of fade
const long intervalFade = 1; // interval for fading (milliseconds)
unsigned long previousMillis = 0;
unsigned long lastShowMillis = 0;
void setup() {
//WiFi.mode(WIFI_OFF); //To turn Wifi off
//btStop(); // To turn BT off
Serial.begin(9600);
strip.begin();
strip.setPixelColor(0, 0, 0, 0);
strip.show();
}
void loop() {
unsigned long currentMillis = millis();
// Check if it's time to update the fade value
if (currentMillis - previousMillis >= intervalFade) {
if (increasing) {
fadeValue++;
if (fadeValue >= 4095) {
increasing = false;
}
} else {
fadeValue--;
if (fadeValue <= 0) {
increasing = true;
}
}
// Update the pixel color in the buffer
strip.setPixelColor(0, fadeValue, fadeValue, fadeValue);
// Only update the LED display at a fixed interval (consistent refresh rate)
// e.g., every 10ms (or choose another value if more appropriate)
if (currentMillis - lastShowMillis >= 5) {
strip.show();
lastShowMillis = currentMillis;
}
previousMillis = currentMillis;
}
}