Skip to main content

Site Navigation

Your Account

Choose Language

Anything programming related to the Hexbright

34 Questions View all

How low can the light go?

Lowest brightness setting seems to be 20...

case MODE_LOW:

Serial.println("Mode = low");


digitalWrite(DPIN_PWR, HIGH);

digitalWrite(DPIN_DRV_MODE, LOW);

analogWrite(DPIN_DRV_EN, 20);


Is there a way to get less light out of the LED, without hacking the hardware :-)

Answered! View the answer I have this problem too

Is this a good question?

Score 0


Thanks David.

You already know this, but you're right :-)

I've also looked at your library... very nice!!


Add a comment

2 Answers

Chosen Solution

Yes. Switch the 20 for a 4.

4 is the lowest you'll see anything.

If you want easy access to perceptually linear light output, take a look here.

The library scales from 0-1000, with 0 being on but no power, 1 being the lowest, 500 being max low, and 1000 being max high.

Was this answer helpful?

Score 1
Add a comment

I found 4 to be lowest with the factory PWM. I set the PWM to mode 2, and had the lowest at 27. For some reason, PWM modes just shut down when I put the divider at 1 (min bright is about 212, to full at 255).

TCCR1B = (TCCR1B & 0xF8) | 2;

I found the factory PWM quite flashy... seems more like 60Hz than the expected 480Hz. I don't see the flashing at timer divider mode 2, but it seems like that mode is still in the 100's of HZ area. I should try to measure...

Was this answer helpful?

Score 0


Can we see the code that does this?


The line of code above... TCCR1B=... goes in your void setup(). This changes the PWM timer frequency. The lowest 3 bits of this register are a code that tells the AVR how many clock cycles/timer counter increase. One PWM period is the time it takes for the timer counter to complete it's count. Each of the 3 timers on the 168 are slightly different, and I don't recall all the details for timer1, which controls PWM on pins 9 and 10. I think it is something like... mode 1 tries 1 timer count/clock count, mode 2 is like 8 clock counts/timer count. mode 3 might be 32 clock counts/timer count... Mode 2 was the lowest mode I could get to work, with a minimum visible brightness at PWM level 27 (out of 255). This did get rid of the visible flashing on PWM levels less than 255 (analogWrite(DPIN_DRV_EN, X), where X is < 255). You can still see the PWM flashing if you look at the LED and shake the light, but it is at a higher frequency than for the default arduino setting.


Add a comment

Add your answer

Kevin Hoyt will be eternally grateful.
View Statistics:

Past 24 Hours: 0

Past 7 Days: 0

Past 30 Days: 0

All Time: 474