Smooth LED dimming from fully bright to off w/ 10turn potentiometer

General project help for Adafruit customers

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
drc3p0
 
Posts: 2
Joined: Sun Jun 24, 2012 4:09 pm

Smooth LED dimming from fully bright to off w/ 10turn potentiometer

Post by drc3p0 »

Hey there. I am trying to light up/dim about 2 superbright LED's with a 9v battery and a 100k 10 turn potentiometer. I need for it to be a smooth transition and not to be jumpy in brightness. I am trying to use this available 100k 10 turn potentiometer (since a new one is going to be over 10 bucks) and I know that they don't offer this in a 30K.

after doing the math, I know it needs about a 120 ohm resistor, and it states that it will be fully dim right around 27K. So i'm wondering if there's a way to make this large value 100k potentiometer smoothly dim the LED so it is fully on at 0k and fully dim at 100k.
I know how to make a transistor perform a larger action, but how could that be essentially done in reverse?

thanks for your input.

User avatar
john444
 
Posts: 443
Joined: Sun Mar 04, 2012 2:42 pm

Re: Smooth LED dimming from fully bright to off w/ 10turn potentiometer

Post by john444 »

Hi DrC3P0,
You can get approximately 27k by paralleling a 36K with one terminal on the pot and the wiper.
The brightness change of the LEDs will not be linear but it should operate smoothly.

In addition, we will presume that your resistor values are correct and the pot can handle the current!

The way you want the knob on the pot to turn (for dimmest, for example)
depends on which of the two end terminals you connect the parallel resistor.
Sometimes it is easiest to just pick one end terminal and if it is not right,
change the resistor to the other.

Good Luck. I hope this does what you want.
John

User avatar
lyndon
 
Posts: 281
Joined: Tue Mar 29, 2011 5:28 pm

Re: Smooth LED dimming from fully bright to off w/ 10turn potentiometer

Post by lyndon »

Sorry to tell you this, but you'll probably be buying another pot unless you got lucky.
Vision is very nonlinear. A linear pot directly (or through a transistor) controlling an LED will seem to have a small span near the bottom where brightness changes rapidly, and then larger movements near the other end will have little change on brightness.

You can try using a logarithmic taper pot, but even then I'm not sure how smooth that will be. I have tried to make a "sunrise" controller using a log slope, and even then I had to flatten it out near the bottom because our vision is so sensitive to tiny changes at low light levels.

User avatar
john444
 
Posts: 443
Joined: Sun Mar 04, 2012 2:42 pm

Re: Smooth LED dimming from fully bright to off w/ 10turn potentiometer

Post by john444 »

Lyndon has some good points.
Paralleling a 36k with the 100k pot only makes the non-linearity worse.
(You did series the 120-ohm resistor with the LEDs didn't you?)
For example: (we will assume a 6-v drop across the 2 LEDs in series)
At maximum resistance (about 27k, 0.11-mA) minimum brightness
after 5-turns the resistance drops to about 21k (0.14-mA). still very dim
6-turns, about 19k (0.16-mA), still very dim
7-turns, about 16k (0.18-mA), still very dim
8-turns, about 13k (0.23-mA), still very dim
9-turns, about 8k (0.38-mA), a little brighter
9½-turns, about 4.5k (0.66-mA), still pretty dim
9¾-turns, about 2.5k (1.22-mA), about twice a bright as it was before
10-turns, 120-ohm (25-mA), maximum brightness.

95% of your brightness change is in the last ½-turn of your 10-turn pot.
This type of circuit may not be what you are wanting.
John

User avatar
john444
 
Posts: 443
Joined: Sun Mar 04, 2012 2:42 pm

Re: Smooth LED dimming from fully bright to off w/ 10turn potentiometer

Post by john444 »

Drc3p0,

In order use a variable resistance to linearly change the LEDs brightness,
you need to use the resistor to linearly change the average current through them.
BTW, this does not address Lyndon's point about the eye being non-linear.

This can be done using:
. . A op-amp in a constant-current circuit (http://www.ladyada.net/images/bikelite/ ... ematic.jpg)
. . An Arduino driving the LEDs using pulse-width modulation (PWM)
. . A 555 circuit to PWM the LEDs

I do not know how experienced you are but you can Google what looks good to you.
If you have questions you may send me a private message.
John

User avatar
adafruit_support_mike
 
Posts: 67485
Joined: Thu Feb 11, 2010 2:51 pm

Re: Smooth LED dimming from fully bright to off w/ 10turn potentiometer

Post by adafruit_support_mike »

Putting a standard resistor in parallel with the pot's wiper (the output) is actually a good idea for lighting and audio purposes. The nonlinearity you get from the parallel resistances is roughly logarithmic, which matches the way the human eye and ear process signals.

This page:

http://sound.westhost.com/pots.htm

has a good discussion of how to fake a log pot by putting a linear one in parallel with a resistor.

If you end up deciding to use PWM to fade LEDs some time in the future, the logarithmic thing still holds.. stepping the duty cycle down in even amounts will give you very little change for the top half of your PWM range and a very fast dropoff in the lower range.

The good news is that human perception makes it easy to get away with controlling light/sound output digitally. We're built to notice large changes, not small ones, so for both light and sound there's a concept of the "smallest noticable change". In my experience, people don't notice changes in light smaller than a factor of e (2.718..., about 4.4db), and I round that to 2.5 for practical purposes.

Duty cycles of 100%, 40%, 16%, 6.4%, 1.28%, etc should give you a nice, smooth fade despite the huge linear change in output.

User avatar
philba
 
Posts: 387
Joined: Mon Dec 19, 2011 6:59 pm

Re: Smooth LED dimming from fully bright to off w/ 10turn potentiometer

Post by philba »

Audio taper (log) pots aren't that expensive though low resistance ones are. I did see one 500 ohm audio taper on mouser for $1.20. That 100K pot's effectiveness will be limited to a very small range no matter what resistor you put in parallel. You can find lots of linear pots at 500 or 1K ohms for a buck or less. No point pounding a square peg in a round hole.

I didn't get the sense that any kind of microcontroller was involved but if so you can also do linear/log mapping with PWM by using a 256 element array that uses the array index as the linear value and the contents of the associated cell as the log value. Basically it takes an 8 bit linear value and gives you an 8 bit log value suitable for using with a simple PWM system (like on the arduino).

User avatar
drc3p0
 
Posts: 2
Joined: Sun Jun 24, 2012 4:09 pm

Re: Smooth LED dimming from fully bright to off w/ 10turn potentiometer

Post by drc3p0 »

Thank you so much for all the informative responses! It seems like john444 has broken down the best options pretty well. I'll definitely read through the link posted by [email protected] and utilize that mocked log process with whatever schematic I come up with.

I could figure out how to use the arduino to map the potentiometer to a PWM output. I might try looking through my Forrest Mims books to see if i can find a 555 LED dimmer schematic. The Op-amp schematic seems like a nice concept, but i'd look for one that had a more common lightsource and battery.

I really appreciate your detailed responses explaining what would/would not work and why.

Locked
Please be positive and constructive with your questions and comments.

Return to “General Project help”