A precision LED/LDR-based Attenuator

Status
This old topic is closed. If you want to reopen this topic, contact a moderator using the "Report Post" button.
Here's an early (and incomplete) drawing of the setup of my board, this is about as small as it's gonna get at two-sided 2.5"x4.0". I haven't finalized pin assignment on the PIC yet, so those lines aren't shown. I figure I'll have one pin left on the PIC when this is done, and resolution might be limited by memory size of the PIC to 1 dB steps, though I hope for 1/2 dB steps down to -55 dB. Each channel will use four opto devices in a T configuration mounted on a 24 pin header, and the board can operate as stereo with balance or dual mono with two volume controls. Controls will be linear, but board will output as audio taper.

Power is a standard LM317T with protective diodes, capacitive smoothing on the control pin, and a load resistor to insure good regulation. Pot will control from 4.85~5.15 volts, and must be set precisely to 5.00V to insure accurate operation.

All control is DC voltage -- including potentiometers, and opto control. There is NO digital signal running around this board, except within the PIC itself.

Audio is all at one end of the board, completely separate from power and PIC. In testing the concept I found that control could be very precise, though at this point I'm not sure how precise the LDRs are going to be so can't predict how accurate overall it will turn out. All circuitry, aside from the PIC itself, is entirely linear, no digital. Only mosfets operating in their linear range actually touch the optos so no digital contamination. In steady state (controls not being moved), the control signals from the PIC to the mosfets are infrequent and so small you can hardly see it happening on a 'scope at maximum resolution so it should be very quiet.

I'm getting ahead of myself doing the hardware before the software, but I have more fun with hardware so it always gets done first.

I'm just throwing this image up for the fun of it, it's not final, it's not even tested, so I'm not going to talk details.
 

Attachments

  • ScreenShot004.jpg
    ScreenShot004.jpg
    113.6 KB · Views: 7,314
Board finished. :)
Now I need to number the components so I can run a netlist check against the schematic for errors. I hate that part of it, so tedious.

I packed the control lines vertically so there's room available for an Omron relay and controls so I could add a "total mute" position that will not only put the series optos in the megaohm range, but also put a dead short in the vertical part of the T for total mute. Not sure if it's necessary, though, if the optos are all turned off and the two series optos are sitting in the megaohm range, the R2 value shouldn't matter that much. Opinions, anyone?

Also wound up with two unused pins on the PIC. I'm thinking I could use one to make the choice of linear pot or log pot for the volume control a user-selectable option. That might be useful, but that still leaves one still available. Can anyone think of a good further use for a jumper or switch option for any other purpose?
 

Attachments

  • ScreenShot006.jpg
    ScreenShot006.jpg
    145.1 KB · Views: 6,947
I got interested in the Silonex NSL32SR2 optocoupler device through reading about GeorgeHiFi's "Lightspeed" LDR attenuator. It seemed a nifty approach to creating a totally passive preamplifier with absolutely no switches, relays, or potentiometers in the signal path.

On the other hand, I was not excited by the necessity of hand-matching multiple LDR devices in order to build properly balanced and tracking stereo systems, and there seems to be no practical way to build any kind of consistent system involving three or more channels due to the requirement to hand-match so many LDR pairs. I thought I'd look for a better way, and I think I've found it.

My approach is opposite to that of the Lightspeed crowd -- I do not intend to match LDR devices beyond a basic "does it meet the specifications" check. Instead, I propose to use a PIC to first test and memorize the specific characteristics of each LDR device used in a system, then use that information to apply the correct control voltage to each LDR to achieve accurate performance. If the method works, it should be possible to build multiple, matched, LDR-based passive attenuators or potentiometers, as well as LDR-based input switching systems.

I've made considerable progress in making this happen. The attached circuit card is my first cut at a practical two-channel 55dB stepped attenuator. I have previously verified that the control system works, using a simpler PIC and a single LDR. My proposed two-channel full attenuator uses four devices per channel in a "T" attenuator format with two devices creating the two sides of the top, and two devices wired in modified parallel forming the trunk. Each set of four will be installed in a 24 pin DIP header and will constitute one T attenuator.

Tinitus has kindly agreed to move some posts of mine from another thread, and those posts will contain more detail. I'll post more info when this new thread is established and my posts have been moved over and I know what's already here.
 

Attachments

  • ScreenShot007.jpg
    ScreenShot007.jpg
    230.2 KB · Views: 6,557
Last edited:
I am looking forward to your actual tests of this circuit.

The next step (after thoroughly rechecking the board) is to build a few using ZIF sockets for the PIC and one LDR header and, leaving the other header socket empty in order to use those control and read lines from the empty side to make a test & calibration capability.

That will allow me to create sets of 1 PIC and two headers that will form the basis for a fully calibrated stereo/dual mono board. As long as the two headers and the customized program in the PIC stay together as a set, all other components will not have an impact on system accuracy (as long as the power supply voltage is maintained accurately.
 
Cool!! Good work!

I have pspice models of the LDRs, that I have used in LTspice, if you are into spice and would like to have them. You can check out my posts in the lightspeed thread and in the other LDR attenuator thread. I did some work on keeping the input and output impedances from varying so much, as they do with the Lightspeed, and on making them what you want (by adding simple passive resistances in the right places, covered to some extent in my old posts).

Also, I wonder if there might be any payoff to using actual near-real-time feedback of the average input and output levels, instead of, or maybe in addition to, memorizing each LDR's characteristics.

CHeers,

Tom Gootee
 
Thank you for the offer, I have never used Spice at all, I've never actually done much with designing circuits. What I'm trying to do here is really simple, hardware-wise.

Interesting that you'd mention using resistors in the right places to better control LDRs in the Lightspeed configuration. I, too, felt that circuit could benefit a lot from some simple optimizing, but I never saw your posts. I went through those 3000+ posts pretty fast, I confess. I could not see that the circuits, as published in the Lightspeed thread, did anything to limit the operating resistance range of the LDRs to a "useful" range.

With regard to 'near real time feedback' how would you even achieve it without touching the audio circuit somehow? I know that PerkinElmer produces units with dual LDRs built in, but the basic specs for those units make them unattractive for audio, I think.

I went back and reread other threads that addressed LDRs and was surprised by how many attempts there have been to make the concept practical both commercially and for the diy-er. It appears that my approach is entirely different -- for a start I'm working toward a T attenuator which has constant input and output impedance. In spreadsheeting the values, it appears that a wide range of impedances is possible from a few kilo ohms up to maybe 10K, so a pair (or set of many) could be made for specific values.

At one point I got excited when I read that you can design a T attenuator with high input Z and lo output Z, but when you run the numbers it turns out that some of the resistors have negative values until you get into pretty high attenuation levels. Not practical.
 
You should be able to find most of my posts by searching for "LDR gootee".

Yes, to get feedback you would have to connect to the audio. But if you had an extremely-high-impedance input, for that circuit, there would be no effect on the audio.

But I don't know that it would be a potential improvement. It might just be another way of getting a similar result. And it would certainly add complexity. And it might be difficult to get it to work well. So carry on!

P.S. I also designed a circuit that can completely linearize the normally more like logarithmic resistance vs control current response curve of any LDR. Unfortunately, it requires a second LDR that is an exact match to the one being linearized, in order to precisely linearize it.

Cheers,

Tom
 
Last edited:
P.S. I also designed a circuit that can completely linearize the normally more like logarithmic resistance vs control current response curve of any LDR. Unfortunately, it requires a second LDR that is an exact match to the one being linearized, in order to precisely linearize it.

Cheers,

Tom

If you've already done this, you could provide some very useful information to me: I want to know how close the LDR curve is to a log curve, and if it makes sense to control it from a log control. Just from one hour of testing, it appears to me that the Lightspeed crowd is doubling the curve by using a log taper control to run the already-log NSL32. Am I right, or is a log control necessary to get a log output from the LDR?
 
Hi wapo54001, I'm trying to understand your concept. Are you measuring and applying compensation to the LDR in discreet step e.g using a lookup table?

Regards.

Still trying to work that out, but definitely space constrained. Probably will wind up applying compensation, since for a T attenuator, you have to deal with three resistors per channel, total six for a two channel board. May have to go to a single channel board, or two PICs per stereo board.
 
If you use a linear 100kohm pot to control the leds in my Lightspeed Attenuator circuit the volume comes on too fast for comfort, a log 100kohm is much smoother and progressive and really starts to ramp up the gain around 2o'clock.
Cheers George

George, I finished the first draft of my two channel board and have just finished modifying that "playback" design to individually measure the resistance-vs-LED-current of each of the four devices on each carrier board.

When I measure the first half dozen or more and chart them in Excel I'm hoping I'll have a composite picture of the "average" Silonex device, and from there I'll be in a good position to understand what is going on and why a log pot works to control what appears to be itself a log device. It seems like it should turn into a log-log overall response. Not sure why it doesn't -- either the Silonex is not actually a log device, or else there is something in your implementation that affects the overall response or, one other possibility is that the overall response of the device is logarithmic, but the operationally useful part of the curve (at the low resistance end) is more linear than the entire curve from 20ma to full OFF. I'm guessing that will turn out to be the case.

When I find out, I'll publish the result here. First step is to get a decent full picture of the curve of the Silonex. I don't think anyone has done one yet.
 
It's pretty close to log, I think, if you're looking at R vs I.

I thought (assumed maybe?) that Lightspeed was using linear pots.

But, anyway, the actual OVERALL RESPONSE to the control (or pot) is a whole different animal, because of the way the pot is wired, and because there are two LDRs (series and shunt). For the Lightspeed, the attenuation factor itself starts out sort of level near zero then curves upward and increases its slope, goes through an inflection point in the middle, and then curves back to more level near one.
 
I haven't done any calibrated tests yet, but in testing my control system I find that the Silonex resistor response is very, very flat into the hundreds of ohms (I can control to the 1/10 ohm level) and then turns a very sharp corner near 1000 ohms and sensitivity increases rapidly. Above about 20K ohms it becomes extreme and difficult to manage. At zero current the resistance is on the order of 30 mega ohms on the two samples I've tested so far, and the change in current from 30K ohms to 30M ohms is not much.

I can't believe that this response is logarithmic. Taken in its entirety, it's more like a mirrored "L" shape.

My T attenuator plans call for two attenuation settings (.5 & 1dB) of approximately 150K and 300K. This will be very hard to accomplish.
 
Here is a rather accurate graph of the Silonex LDR response.

Current is divided into 460 equal steps along one axis, and the Silonex resistance is charted in relation to the current delivered. Resistance range shown is 40 ohms to 85K ohms, approximate. Pretty spectacular corner.

Second chart is LOG scale
 

Attachments

  • ScreenShot001.jpg
    ScreenShot001.jpg
    42.5 KB · Views: 2,341
  • ScreenShot002.jpg
    ScreenShot002.jpg
    34.8 KB · Views: 2,291
Last edited:
Status
This old topic is closed. If you want to reopen this topic, contact a moderator using the "Report Post" button.