subjective LED dimming

If you have an LED that just illuminates for 30ms or so, would PWMing it still make a perceptible difference in how bright it looks?

I want to have an LED flash just for 30ms, but be dimmable as well.

The PWM uses about 500Hz.

So during that 30ms, there are 15 pwm pulses. It should be possible to dim it.
However I think the pulse is very short, it would be hard to tell the difference.

Anything less than around 50 ms qualifies as "instantaneous" to human perception. If you want to dim it, just shorten the duration of the pulse. There's no need to mess around with PWMing a pulse that short.

The math seems good, but subjectively, does that allow wide dimming?
It seems like it would to me.

With such short pulses, "subjective" is what this is all about. One person might see it different than an other. You would also see it different if you look straight at it, or in the corner of your visual field.

Why not drop the led, and get an OLED display, and write a percentage on that display.
Or what about a flash of 300ms with an RGB led, that would give so much better feedback.
If you want to reduce power, then use a special led. Some leds are quite bright with just 1mA.

I'm really thinking of 64th notes at 120bpm. Duration is 32ms.

With 15 pulses in 30ms , it seems like PWM would work to dim.

Just ran some tests with the pin 13 LED on my Leonardo with the following sketch.

const unsigned char pin = 13;

void setup() {
  // put your setup code here, to run once:
  pinMode( pin, OUTPUT );
}

void loop() {
  // put your main code here, to run repeatedly: 
  analogWrite( pin, 100 );
  delay( 30 );
  digitalWrite( pin, LOW );
  delay( 470 );
  
}

At 30 ms, the LED is just a brief blink, an instantaneous flash. PWMing this does has some effect, as there is a noticeable difference between values like 255 and 50. However, given how brief it is, you aren't going to be able to have fine discrimination of the brightness level with the eye. You might have 2-3 useful brightness levels, 4 tops. Fading is going to be pretty pointless with pulses this brief.

What are you trying to do with pulses like this, and why do they need to be so brief?

There is a better way: Use two output pins, with two different resistors to just one led.

I'm interested in dimming very bright LEDs to various levels, and just wondered how effective PWM was at these very short flashes. Normally it would be much longer on-times.

db2db:
If you have an LED that just illuminates for 30ms or so, would PWMing it still make a perceptible difference in how bright it looks?

Yes.

(if your PWM is fine enough...)