newbie want to use pot to dimm led

Hi all,

I am newbie on eleclronic. I want to use a pot to dim 3 LED. Could I do that as the following pic? I try it work but the pot just turn about 10 degree and those LED is off. how can i make the pot less sensitive? Thanks.

5

Use a much lower value pot, maybe 470 Ohms or 1k.

Thanks
PerryBebbington

Connect each LED (with resistor) to a ‘PWM’ pin on an Arduino UNO.

Make a ‘voltage divider’ out of a resistor and your potentiometer.

Feed this voltage divider to analog input A0.

Use the reading from A0 to adjust the duty cycle of the PWM pin.

Hi Lamal - nice diagram!

As larryD says the output from the arduino pins should be controlling the LED brightness via Pulse Width Modulation (PWM. )

If you use a potential divider cvircuit to control the brightness you may find a log taper pot gives best results.

larryd:
Connect each LED (with resistor) to a ‘PWM’ pin on an Arduino UNO.

Make a ‘voltage divider’ out of a resistor and your potentiometer.

Feed this voltage divider to analog input A0.

Use the reading from A0 to adjust the duty cycle of the PWM pin.

Thanks, I have tried this way and read few exmaple about the code, but not sucess.

johnerrington:
Hi Lamal - nice diagram!

As larryD says the output from the arduino pins should be controlling the LED brightness via Pulse Width Modulation (PWM. )

If you use a potential divider cvircuit to control the brightness you may find a log taper pot gives best results.

Thanks for the explaination! Apperciated

“ I have tried this way and read few exmaple about the code, but not sucess. ”

Please show us what you tried.

Show us a good schematic of your circuit. Show us a good image of your ‘actual’ wiring. Give links to components. Posting images: Simple guide for inserting images in a post - Website and Forum - Arduino Forum

Use CTRL T to format your code. Attach your ‘complete’ sketch between code tags [code]Paste your sketch here[/code]

lamal:
Hi all,

I am newbie on eleclronic. I want to use a pot to dim 3 LED. Could I do that as the following pic? I try it work but the pot just turn about 10 degree and those LED is off. how can i make the pot less sensitive? Thanks.

5

This a circuit with two issues:

  1. The pot should be reverse logarithmic taper for a good brightness curve. Such pots are hard
    to find. Perceived brightness of an LED is a logarithmic function of current, and only a rev. log.
    pot can give a reasonably intuitive response.

  2. When the pot value is high, the 100 ohm current-sharing resistors have very little voltage drop,
    so they stop compensating for differences in the LED forward voltage, and they will fade at different
    rates unless very well matched (for instance being from the same manufacturing batch)

If the LEDs can be in series you get current sharing for free (although this may require a higher
voltage supply)

Using PWM like the rest of the world is the way to go if there's a microcontroller around. For good
brightness curve you use an exponential function in the code to map brightness to duty cycle.

I think if you are going to post on the forum for advice, you should follow it.

As stated, the proper way to do this is
Connect leds to PWM pins.
use the pot as an analog input on an analog pin (connect one end to +5V,
connect the other end to GND, connect WIPER to A0.
Read the value with analogRead(), write the desired value with analogWrite().
End of story.

void loop(){
potLevel = analogRead (A0) >> 4; // read pot, 0 to 1023, divide by 4, so 0 to 255
analogWrite (pwmPin, potLevel); // 3,5,6,9,10,11 are the PWM pin choices
}

Keep the current limit resistors. The output to the LED is a 0/5V pulse of varying width, how wide the pulse determines how bright your eye sees the color.