# Analog button to control brightness?

**URL:** <https://wled.discourse.group/t/analog-button-to-control-brightness/3361>\
**Category:** Hardware\
**Created:** [August 12, 2021, 7:01am UTC](https://wled.discourse.group/t/analog-button-to-control-brightness/3361 "2021-08-12T07:01:47Z")\
**Posts on this page:** 16\
**Page:** 1

<div class="post-metadata">

**Author:** ![Fuzzball](https://avatars.discourse-cdn.com/v4/letter/f/ce7236/32.png) [@Fuzzball](https://wled.discourse.group/u/Fuzzball)\
**Post date:** [August 12, 2021, 7:01am UTC](https://wled.discourse.group/t/analog-button-to-control-brightness/3361/1 "2021-08-12T07:01:47Z")

</div>

I see in the documentation for WLED that I can use a potentiometer as an Analog Button to control brightness.

However I can’t find much in the way of examples or documentation on the topic.

Specifically what I’d like to know is how to wire it up and which pin to connect it to.

I’d think I connect the ends of a potentiometer to 3.3v and ground with the center tap going to the analog pin of the esp. However I don’t know what pin number to fill into wled as the analog pin of a D1 mini is ADC0 at A0 but there is also a G0.

All help is appreciated.

---

<div class="post-metadata">

**Author:** ![tonyno](https://yyz2.discourse-cdn.com/free1/user_avatar/wled.discourse.group/tonyno/32/242_2.png) [@tonyno](https://wled.discourse.group/u/tonyno)\
**Post date:** [August 12, 2021, 1:00pm UTC](https://wled.discourse.group/t/analog-button-to-control-brightness/3361/2 "2021-08-12T13:00:12Z")

</div>

Pot ends to 3.3v and ground, center to an analog input.

All pin numbers in the UI are GPIO.

---

<div class="post-metadata">

**Author:** ![Randios](https://yyz2.discourse-cdn.com/free1/user_avatar/wled.discourse.group/randios/32/2007_2.png) [@Randios](https://wled.discourse.group/u/Randios)\
**Post date:** [September 29, 2021, 7:34pm UTC](https://wled.discourse.group/t/analog-button-to-control-brightness/3361/3 "2021-09-29T19:34:52Z")

</div>

I think I’m having a similar confusion as Fuzzball.

I know how to wire a pot, but I’m not sure how to configure WLED to use the pot for brightness.

I see that in the “LED Preferences” I can set the pin number for the buttons and use the drop-down menu to set it to “Analog”, but what pin number do I set for ADC0 on the ESP8266 (it does not have a GPIO number, it’s just called ADC0)?

 ![image](https://global.discourse-cdn.com/free1/uploads/wled/original/2X/7/73222e5c1b0f830c72466a91f2102378dc206d27.png)

Presumably, once that is set, I can use a macro with “250” in the “double” column to set it to control the brightness, according to [this wiki page](https://github.com/Aircoookie/WLED/wiki/Macros), which seems slightly out of date.

---

<div class="post-metadata">

**Author:** ![huggy-d1](https://yyz2.discourse-cdn.com/free1/user_avatar/wled.discourse.group/huggy-d1/32/51_2.png) [@huggy-d1](https://wled.discourse.group/u/huggy-d1)\
**Post date:** [September 30, 2021, 10:35pm UTC](https://wled.discourse.group/t/analog-button-to-control-brightness/3361/4 "2021-09-30T22:35:56Z")

</div>

There are usermods available that use external hardware to handle specific tasks. Perhaps there is a usermod that handles your needs perfectly, or close enough, or maybe just needs a little customization to work.

---

<div class="post-metadata">

**Author:** ![blazoncek](https://yyz2.discourse-cdn.com/free1/user_avatar/wled.discourse.group/blazoncek/32/1886_2.png) [@blazoncek](https://wled.discourse.group/u/blazoncek)\
**Post date:** [October 1, 2021, 1:16pm UTC](https://wled.discourse.group/t/analog-button-to-control-brightness/3361/5 "2021-10-01T13:16:19Z")

</div>

For ESP8266 assign any unused GPIO. The code will still use A0 (or ADC0) on ESP8266.

---

<div class="post-metadata">

**Author:** ![Randios](https://yyz2.discourse-cdn.com/free1/user_avatar/wled.discourse.group/randios/32/2007_2.png) [@Randios](https://wled.discourse.group/u/Randios)\
**Post date:** [October 1, 2021, 4:14pm UTC](https://wled.discourse.group/t/analog-button-to-control-brightness/3361/6 "2021-10-01T16:14:39Z")

</div>

Thank you! I actually found this out while rummaging in the code after being pointed to usermods by huggy. I had tried configuring it before, but when I applied 3.3V or 0V to the A0 pin, I got the same result (depending on if it was set to `analog` or `analog inverted`). But now that I connected an actual potentiometer, it seems to work (although at one extreme the brightness is 0, then it gets brighter as the pot turns, until it reaches the other extreme, where it turns off the LEDs).

To be honest, while I’ve used WLED for a couple years, it’s always done what I’ve needed, so never dug into it and looked at the source code. It is amazing. I thought it would be huge headache to modify and not mess anything up, but it is also very user friendly!

---

<div class="post-metadata">

**Author:** ![woehaa](https://yyz2.discourse-cdn.com/free1/user_avatar/wled.discourse.group/woehaa/32/2027_2.png) [@woehaa](https://wled.discourse.group/u/woehaa)\
**Post date:** [October 6, 2021, 9:05pm UTC](https://wled.discourse.group/t/analog-button-to-control-brightness/3361/7 "2021-10-06T21:05:13Z")

</div>

Consider me stupid (no really, please do)  
What is the setup exactly. For a n00b like I can;t make heads or tails of these replies

- a potentiometer has 3 pins : which pins do I need to connect?
- to which GPIO pins do these connectors to be connectod to?
- what type of potentiometer is recommended, 1k Ohm, 100k Ohm, more or less?
- how many revolutions from 0 to max Ohm is recommended?
- what command in a preset is to be set precisely? Or do I just enter “250” in the double button action?

Thank you in advance for your understanding and patience.

---

<div class="post-metadata">

**Author:** ![tonyno](https://yyz2.discourse-cdn.com/free1/user_avatar/wled.discourse.group/tonyno/32/242_2.png) [@tonyno](https://wled.discourse.group/u/tonyno)\
**Post date:** [October 6, 2021, 9:13pm UTC](https://wled.discourse.group/t/analog-button-to-control-brightness/3361/8 "2021-10-06T21:13:00Z")

</div>

Numbering your bullets…

1. See [Analog button to control brightness? - #2 by tonyno](https://wled.discourse.group/t/analog-button-to-control-brightness/3361/2)
2. Any of your ESPs analog inputs.
3. Almost anything. I’d use 10k.
4. Doesn’t matter.
5. Correct.

---

<div class="post-metadata">

**Author:** ![woehaa](https://yyz2.discourse-cdn.com/free1/user_avatar/wled.discourse.group/woehaa/32/2027_2.png) [@woehaa](https://wled.discourse.group/u/woehaa)\
**Post date:** [October 15, 2021, 12:02pm UTC](https://wled.discourse.group/t/analog-button-to-control-brightness/3361/9 "2021-10-15T12:02:20Z")

</div>

Apologies for my late reaction. But thanks for the reply and the info, it is very helpfull

---

<div class="post-metadata">

**Author:** ![da85wled](https://avatars.discourse-cdn.com/v4/letter/d/91b2a8/32.png) [@da85wled](https://wled.discourse.group/u/da85wled)\
**Post date:** [December 3, 2021, 9:10pm UTC](https://wled.discourse.group/t/analog-button-to-control-brightness/3361/10 "2021-12-03T21:10:05Z")

</div>

I cannot turn off the strip via console or with api (& T = 2) because the analog button turns on again immediately. in the same way if I use an analog button to control the primary color (value 200) then I will no longer be able to change the color from the computer or app, because the analog button controls the color. Where am I wrong?

---

<div class="post-metadata">

**Author:** ![mjg1088](https://avatars.discourse-cdn.com/v4/letter/m/d2c977/32.png) [@mjg1088](https://wled.discourse.group/u/mjg1088)\
**Post date:** [December 3, 2021, 9:20pm UTC](https://wled.discourse.group/t/analog-button-to-control-brightness/3361/11 "2021-12-03T21:20:44Z")

</div>

> [@da85wled](#):
>
> Where am I wrong?

Nowhere! The analog pot overrules the app control. By default, the brightness potentiometer will turn the lights off if adjusted to either the minimum or maximum adjustment. You _might_ be able to add in a SPST switch to disconnect the pot from ADC0 to restore app control, but I have not tested such a thing.

In theory, you should be able to control both brightness and pattern by using a rotary encoder and a screen, while still maintaining all features of the UI. I believe there are already usermods created to implement this.

---

<div class="post-metadata">

**Author:** ![blazoncek](https://yyz2.discourse-cdn.com/free1/user_avatar/wled.discourse.group/blazoncek/32/1886_2.png) [@blazoncek](https://wled.discourse.group/u/blazoncek)\
**Post date:** [December 3, 2021, 9:46pm UTC](https://wled.discourse.group/t/analog-button-to-control-brightness/3361/12 "2021-12-03T21:46:29Z")

</div>

Analog is ABSOLUTE.

---

<div class="post-metadata">

**Author:** ![da85wled](https://avatars.discourse-cdn.com/v4/letter/d/91b2a8/32.png) [@da85wled](https://wled.discourse.group/u/da85wled)\
**Post date:** [December 3, 2021, 9:51pm UTC](https://wled.discourse.group/t/analog-button-to-control-brightness/3361/13 "2021-12-03T21:51:36Z")

</div>

I think I solved it by removing the resistance that prevented the analog button from turning off at 0v. Now it works fine. the analog value seems to “sleep” until the button is moved

---

<div class="post-metadata">

**Author:** ![blazoncek](https://yyz2.discourse-cdn.com/free1/user_avatar/wled.discourse.group/blazoncek/32/1886_2.png) [@blazoncek](https://wled.discourse.group/u/blazoncek)\
**Post date:** [December 4, 2021, 7:13am UTC](https://wled.discourse.group/t/analog-button-to-control-brightness/3361/14 "2021-12-04T07:13:58Z")

</div>

That is indeed how I programmed it.  
But as soon as analog value changes it wil override whatever else is applied.

---

<div class="post-metadata">

**Author:** ![da85wled](https://avatars.discourse-cdn.com/v4/letter/d/91b2a8/32.png) [@da85wled](https://wled.discourse.group/u/da85wled)\
**Post date:** [December 4, 2021, 7:50am UTC](https://wled.discourse.group/t/analog-button-to-control-brightness/3361/15 "2021-12-04T07:50:11Z")

</div>

Perfect job, congratulations.  
the added resistance between the potentiometer and GND (as suggested on the wiki) cancels the shutdown also from the pc or second button even if the potentiometer is not touched. In practice, the resistance cancels the “sleep” of the potentiometer

---

<div class="post-metadata">

**Author:** ![wanthalf](https://yyz2.discourse-cdn.com/free1/user_avatar/wled.discourse.group/wanthalf/32/10362_2.png) [@wanthalf](https://wled.discourse.group/u/wanthalf)\
**Post date:** [March 27, 2026, 11:14pm UTC](https://wled.discourse.group/t/analog-button-to-control-brightness/3361/16 "2026-03-27T23:14:31Z")

</div>

Whatever I do, my WLED just randomly turns on when I configure an analog button (potentiometer) for brightness control (not to speak about turning on every time it’s powered up). I tried various resistors and capacitors to no avail.
