Analog Brightness Control - Disabling Auto-Off with 3.3V on A0

I am running 0.13.0-b4 on an esp8266, and I have a pot on A0 for global brightness control. I love that turning the pot all the way down turns the lights off, but I am confused about why turning it all the way up causes the same behavior. I have found what I believe to be the relevant section of code, but I can’t see why it’s happening with 3.3V on A0.

  static uint8_t oldRead[WLED_MAX_BUTTONS];
  #ifdef ESP8266
  uint16_t aRead = analogRead(A0) >> 2; // convert 10bit read to 8bit
  uint16_t aRead = analogRead(btnPin[b]) >> 4; // convert 12bit read to 8bit

  if (buttonType[b] == BTN_TYPE_ANALOG_INVERTED) aRead = 255 - aRead;

  // remove noise & reduce frequency of UI updates
  aRead &= 0xFC;

  if (oldRead[b] == aRead) return;  // no change in reading
  oldRead[b] = aRead;

  // if no macro for "short press" and "long press" is defined use brightness control
  if (!macroButton[b] && !macroLongPress[b]) {
    // if "double press" macro defines which option to change
    if (macroDoublePress[b] >= 250) {
      // global brightness
      if (aRead == 0) {
        briLast = bri;
        bri = 0;
      } else{
        bri = aRead;

So it seems to me that aRead==0 when I have 3.3V on A0, but I do not understand why. It is unclear to me what “aRead &=0xFC” is doing, but I think it’s just ignoring the 2 least significant bits. I had surmised that I could comment out the everything past “//brightness control” except for “bri=aRead;” but the behavior does not change. Any advice on how to proceed? Am I misunderstanding the role of aRead &=0xFC? Does the esp not like having A0 held high?


I myself do see a slight difference in behavior.

  • initially both “ends” turn everything (including onboard LED) off
  • however, turning max towards the 3.3V pole the board starts flashing on-off, including the onboard LED

I still need to try with a permanent resistor in series with that 3.3v pole, maybe this fixes the flashing.
I can’t explain this via code (I’m a code-n00b of the highest order)

For reference sake: esp8266, WEMOS D1 mini (clone), 10k pot.meter, WLED 0.13.0b4

I now see also the max towards the GND pole is not working as desired. After 10 minutes the board turns on by itself. And then becomes pretty unstable.
Well, I was going to install a on-off switch anyway, because that way I can completely turn off the ESP board,

add a small (3% of pot value) resistor between 3.3V and pot terminal.

Yeah, That’s probably how I’ll proceed. I was trying to handle it via software to keep the real maximum brightness as the maximum pot adjustment. At this point, it’s probably time to accept the fact that 97% bright is already overkill for my wearable, and I don’t really need 100% anyway :sweat_smile:

I have moved forward with installing a resistor in series with the pot. I adjusted to the maximum sustainable brightness, measured the drop between 3.3V and A0, and used the voltage divider equation to find the desired resistance. For a 10K pot I found 577Ω, and I installed a 620Ω. Now, there are certain patterns in my playlist that still turn off at max brightness, but not all of them! It’s as though the threshold for “off” is different for each pattern. I am going to replace with a slightly higher value resistor and try again, but I would really love to get some more information on whether this is operating as intended, and if there’s any convenient way to disable it in the software.

EDIT: Swapped my 620Ω for a 750Ω and it’s nice and stable at the max adjustment! Still eager to hear anyone’s input on software solutions!


Woehaa, what is your power source? Are you certain you are supplying enough current for higher brightness? Are you using the Auto-brightness limit, and if so, is it correctly configured to match your supply? Flashing at higher brightness sounds, to me, like not enough current.

If you will I would kindly ask to update knowledge base with your findings.


Hey man I’d be happy to, would you help me by pointing me to the specific page you think it best belongs in? I have gone through the doc but can’t seem to find the page that describes analog buttons.

Looks like a new “opportunity”!

Under the (older) wiki Macros page:Wiki-Macros there was some info.
Under the (new) documention page much of the button info didn’t seem to make the transition.

Looks like a great time to get things updated with some good new info.

Unfortunately, it will take much wiser folks than me to tell you exactly how you can get that done :face_with_raised_eyebrow:

Great! Thanks for the update. I am working on finishing a new project where this will be implemented also.