Electronics > Beginners

Correcting LED PWM brightness curve using analog stuffs (no programming)

(1/3) > >>

K3mHtH:
Hey guys,

I have a circuit where I'm using an LED to detect audio clipping. It's just a simple op-amp comparator set for my maximum Vpp level, and when that goes high it powers my clipping LED. So basically, the LED sees a PWM power signal at a frequency of the input that goes from 0% to 50% duty cycle representing no clipping to full-blown clipping.

The circuit "works", but the LED appears pretty much "full on" from about 10% PWM and up. I was really hoping the brightness of the LED would indicate how much clipping is happening and grow brighter accordingly.

If I was controlling this with a microcontroller, I know I could scale the PWM % accordingly to make the brightness appear linear.. but I want to do this just with old school analog stuffs.  I was thinking maybe this problem has been solved a bunch of times already in the last 30 years... anyone have any recommendations?


Ian.M:
You'd probably need to low pass filter the comparator output to get an analog control voltage, then run it through an OPAMP logarithmic anti-log amplifier, then convert back to PWM if you want to drive a high intensity LED, or even simply use an OPAMP voltage controlled current source to drive a relatively low current LED directly.   You may also want to add a pulse stretching circuit to increase the weighting of HF clipping in the LED response.

Although its almost certainly a well-solved problem, cheap MCUs with ADCs and PWM have been around for long enough for the analog domain solutions  to be very obsolete, so if you *MUST* go down the analog road, its probably going to be simplest to design and simulate an implementation from first principles that can actually be constructed from 'jellybean' parts in current production, rather than trying to obtain $$EXPEN$IVE$$ *Genuine* N.O.S. chips to implement some 'textbook' design or appnote from circa forty years ago.

Why anti-logarithmic? Well it approximates the inverse of the response of the human eye over a reasonable brightness range. See Fechner's law at: https://www.telescope-optics.net/eye_intensity_response.htm

Edit: Log amp corrected to antilog amp!

imacgreg:
Forgive me if I am misinterpreting your post, but your description of "the LED sees a PWM power signal at a frequency of the input that goes from 0% to 50% duty cycle representing no clipping to full-blown clipping" is not what your circuit as described is doing.

Your circuit appears to be indicating on a every other waveform-cycle basis (assuming no full-wave rectification) the digital expression of isClipping or notClipping. There is no useful information regarding degree or amount of clipping. it is either above the comparator threshold or it isn't. Since low frequencies can tend to dominate audio amplitude, and perception of the human eye blurs on/off events faster than 20-30Hz, this can appear as if some kind of PWM/brightness modulation is happening.

To get any kind of controlled gradient, you need something more complex than a single comparator. In this case, a handful of comparators setup along a multiple resistor voltage divider string can be used to generate the various trip points for multiple LEDs.

For a single LED to accurately represent this by varying brightness, true PWM is one way to go. To perform this without a MCU is possible. If it were me, I'd full-wave rectify (and filter) the audio to get a DC representation of the level, then feed a traditional comparator with a triangle wave reference (classic PWM method). Here's a very basic description: https://www.quora.com/Why-do-we-use-a-comparator-in-PWM - from there, you can use the PWM (now modulated per peak audio level) to control LED brightness.

The above method ignores the logarithmic nature of audio/human hearing, but it could be sufficient for a clip indicator that gives a bit of a warning before full on clipping.

tszaboo:

Human eye is weirdly wonderful.  And this changes with color.

schmitt trigger:
An acquaintance of mine did something similar to what you are asking with a LM3916.

He clustered the LEDs in the smallest area possible, and placed a pair of light diffusers on top.
The apparent brightness change with sound level was readily noticeable.

Navigation

[0] Message Index

[#] Next page

There was an error while thanking
Thanking...
Go to full version
Powered by SMFPacks Advanced Attachments Uploader Mod