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.
Hi, James.

For the record, let me clarify that I did 1/2 dB between attenuation steps, I did not claim any tracking between channels number and I won't until I've actually measured it.

I am very confident in the accuracy of the control mechanism; right now I'm focused on getting the code to where I can control in a fully functional virtual potentiometer. The devil is still in the programming details . . .
 
I would imagine that with such a tight control on the 0.5dB steps that any accumulated 'drift' between channel attenuation values would only require a cross channel comparison maybe every 10dB - not sure if this is possible with your current program, or even actually necessary - like a X channel self test maybe - just a random thought.

I remember that we just used a couple of reference attenuation points for component testing regarding 'drift' and interchannel tolerances - it showed up problems well before they became obvious in the operation of the 'pads/pots' but with your device, I think your requirements are much tighter.

Good stuff - a real journey ....
 
I remember udailey talking about matching LDRs in a temperature-controlled environment and that was necessary because the LDRs changed resistance values at different temperatures. I've found that this is true and the shift gets more measurable as you go up in resistance value and lower in current.

In my method, the LDRs on any given board are calibrated simultaneously after they are on the board and so are always calibrated when they are at the same temperature. I'm assuming that if the individual LDR curves are in the same ballpark (similar but not matched) they will respond to temperature in similar ways and so will shift together when exposed to a different temperature. If that is the case, the channels on my board should stay matched even when the board is placed in different temperature zones because while the curve might shift, it will shift as a set, not in separate directions. Which is a long-way round way to say that I don't think that cross channel calibration will be necessary because my original calibration is not against a relative standard, it is against an absolute standard, and current level is measured and reproduced in a very precise way.
 
Today I have my prototype board running a full stereo set of four LDRs. These LDRs were not "selected" -- rather, at 50 ohms they vary between 10 ma and 5ma current draw which means they are all significantly different in response curve. However, when I check my calculated values against the feedback values as the board runs, they appear to be correct in all cases. Still using the brute-force method which I will eschew when I get the elegant solution working properly.
 
Having spent the last three months almost exclusively on software, today I revisited the hardware side and was pleased with my results. Here is what I found at three high resistance points (since Merlin wants a 100K pot):

Holding 53.9K~54.8K at 9.3~9.4 uA (1K variation)

Holding 103.5~104.5K at 6.6~6.7 uA (1K variation)

Holding 338K~342K at 3.7~3.8uA (4K variation)

I am pleased that my hardware/software combination can hold current steady within 1/10 of one microampere. That's .0000001 ampere. :)

I achieved these values with a hardware configuration I had abandoned quite a while ago because resistances wandered too much. Now, with the same hardware configuration, they don't wander. The lesson I get is -- the secret is in the software; the software makes all of the difference in the world!
 
Last edited:
If those ~50K and ~300k values were used in an attenuator
338k:54k8 then the attenuation is -17.11dB
If the resistances changed to the other end of the tested range then the worst case difference in attenuation for 342k:53.9K is -17.32 - (-17.11) = 0.21dB
That is mighty good for those high values of LDR resistance.

If one were looking at 100r +-0r2 for the lower leg in combination with the 338k to 342k
the change in attenuation is 0.14dB (-70.56dB to -70.70dB)

I'm inclined to suggest the only way to better these differences is to adopt a switched attenuator with 0.2% resistors !
 
Today I went back and experimented some more because I had an idea regarding hardware that could have explained why my results were so good yesterday. It turns out that I was wrong, it's not the hardware -- it really is the improved software I developed over the winter.

Today, I was holding an LDR at 2.4 megaohms on 1.7 micro amps of current using an ultra simple circuit and not many components. The prototype board size is 2.5 inches x 3.8 inches, and it has a precision LM317 power supply and two channels of audio (4 LDR channels) and nevertheless there is a lot of unused board space.

I haven't ordered a new prototype board in more than two years, but I'm going ahead with a prototype using this hardware and software, and I think I'm just about there.
 
A lower shunt value would be great, but it would be -- sonically -- a tradeoff. People who have experimented with non-LDR elements in the shunt leg have stated categorically that the sound suffers.

In my design I will eventually have the capability to have two LDRs in parallel to enable an aggregate shunt resistance of somewhere between 20~25 ohms. I've decided in the first round to keep it simple -- only one LDR in series and one in shunt. The shunt LDR minimum requirement is 50 ohms at 13 milliamps, but many LDRs will deliver 50 ohms down to 4.5 milliamps, and will go well below 50 ohms when driven at 13 milliamps. Thus, my pot is designed to handle shunt values down to 20 ohms (with two devices in parallel).
 
I've looked at a lot of these designs (Lightspeed, Warpspeed, Tortuga etc.) and was curious if a MOSFET would give better performance. I tested an IRLM1902 MOSFET and was able to vary the resistance between .01 Ohm and ~100K with a control voltage of ~1.5VDC to 2.3VDC. I made a spreadsheet which computed the values of the series and shunt (upper and lower) resistances needed for a 10K or 100K pot to produce 0-120dB of attenuation in 1dB steps. What I noticed was the series (upper) resistive element mimicked the "sweet spot" of the operating range of an LDR and the shunt (lower) element mimicked the MOSFET. It seemed like a natural to combine the two.

As far as sonic quality, I didn't try it, but in researching LDR's, it occurred to me that they operate very similar to MOSFETS: The resistive element of an LDR is a semi-conductor material, usually doped silicon, same as a MOSFET. The control voltage in a MOSFET is electrically isolated from the signal path (same as an LDR). I'm wondering if anyone has every tried this combination?

It would certainly solve a couple of the problems with these types of attenuators: maintaining a constant resistance while creating a much higher attenuation level.
 

Attachments

  • Ratios.txt
    3 KB · Views: 61
I've just ordered a set of PCBs to try out, it's time to check my software against a mature hardware board. Up to now, I've been working with an earlier design that was OK but very different from my final design. Oh, and the board size has shrunk to 2.5" x 3.3" -- very small considering the capability, and it includes a full LM317 precision power supply.

The board is deceptively simple -- 45 total components including the connectors, the LDRs, everything. Each LDR control channel consists of control by the PIC through two resistors, one capacitor and a mosfet, and the entire board requires only two ICs (including the LM317 regulator), one diode, and five mosfets. Everything is through-hole.

The software is almost complete, and it will all fit inside the memory so a variety of good things are possible. The first iteration will have almost all the features I wanted, including

- the end user will be able to recalibrate the board without special instruments

- the board will operate as a dual mono or as a stereo system -- either two volume pots or a volume pot and a balance pot. Choice is user-selectable by jumper. If someone wants to build a control console with fifty matching channels, it could be done with each board operating as two independent mono controls.

- the board can be set to emulate a potentiometer of any value between 5K and at least 50K and maybe 100K, with very good accuracy. Also, for special needs, the R1 and R2 values can be independently selected.

- the pot response will conform very closely to the log curve and will be continuous -- no dB steps.

I should have my new board and components in about ten days, and I'll be finishing up the software while I wait for it arrive.

Getting very close. :)
 
Very interesting wapo, i have a LDR kit from Chris Daly already, with matched LDRs, that i plan to convert to MCU control using a TI LM4F120XL board. Biggest reason is i want to use a stepped attenuator over a pot for control, and also simplify remote control.

I want to try a variable constant current source, but not sure on how to get the resolution right, preferably using as few pricy external ICs as possible. The Chris Daly kit i have(3-input one) i liked because it allows me to handle input selection without mechanical relays, but there might be a way to handle input selection with solid state relays, freeing up several matched LDRs for use in attenuation.

My problem right now is it doesnt go low enough in volume for my needs, and it doesnt lend itself to remote control very easily.

Any plans to share how you control your LDRs with your MCU?

Regards,
Kris
 
Any plans to share how you control your LDRs
I did a similar thing some years ago, see http://www.diyaudio.com/forums/analog-line-level/182294-sylonex-arduino-preamp.html.
It works great, still today. But last week, I did a recalibration of the LDRs, and I discovered that the shunt resistors have moved quite far from their initial measurements. Their resistance moved up by more then 20%. At low resistance it even doubled. Now I finally understand is why the lowest volume is double from the one 3 years ago and why the first 20% of the volume makes no difference.
Good thing is that the 2 shunts moved the same, keeping balance equal. The series LDRs have changed only some percents.
I'll post some graphs later, I still need to put the scales right.
I guess the reason for the move is that the shunt LDRs are quite often running at low resistance with high current. Even with the current always in spec, they seem to age fast.
It means that a digital controlled unit needs to take into account the moving minimum and maximum resistance during calibration. And the calibration is needed from time to time. Waiting for 3 years is too long.
 
I did check that thread briefly, will read it more thoroughly.

Interesting, and Uriah and possibly George as well mentions this.

This tells me that if at all possible one should probably double or even triple up on the shunt LDRs, that way each LDR is only requred to burn half(or one third) as bright for a given shunt resistance(should last longer).
 
I'm not sure what kinds of maximum current are set on the various versions of the LDR control that are out there and that will have a major effect on the longevity of calibration.

I know the published max current is 20ma; for my design I have settled on 13ma maximum. I select LDRs in two categories -- one category is 50 ohms or less at 10ma, the second category is lowest possible current at 50 ohms. In my current prototype, the series LDRs deliver 50 ohms at 10ma, and the shunt resistors deliver 50 ohms at 4~5 milliamps. This makes the 10ma shunt resistance down around 40 ohms. I also have provision to parallel the shunt LDRs which will cut the minum resistance in half at the same current. My program is designed to take advantage of shunt resistance as low as 20 ohms. Further, the series resistance can be programmed independently of the shunt resistance, so you could have a series resistance of 25K and a shunt of 10K if you needed more attenuation. It's all experimental at the moment and subject to change.

The new Tortuga Audio board seems to recalibrate every ten minutes (if I read their literature correctly) and that seems excessive to me; My board will self calibrate but at least at first only when action is taken to calibrate. I'm counting on the lower current limit and another trick or two to keep the LDRs in good calibration for a very long time.
 
If your system has a 'well designed gain structure' (called system synergy, in the article on this site) there isn't much need to use anywhere near the minimum volume settings of either series or shunt LDRs, except for maybe some of these new HD releases (24b/192k) that seem to have a much lower recorded level than usual.

However, many people do use minimum/max levels and do leave the device on 24/7, so it might be worth looking at a 'standby/mute' switch that connects a low load on the output of the attenuator and at the same time, resets the volume control at the mid volume point so the LDRs are receiving much lower currents and will do the 'sag' at a much reduced rate, if at all.

George, and others, say over and over to leave the volume pot in a middle volume position but some people always turn it to minimum volume, thru habit, I guess.
 
leave the volume pot in a middle volume position
You're right. This is the case in the ideal world, it's also the case when I'm alone at home (and that's a pure coincidence :).
When my wife or kids are there, volume is lower, a lot. But when I'm really listening it can go up to full scale. So the synergy is not that bad. This real issue is that low volume is not that low with maximum current limited to 6mA in my case.
If I would do it again, I would add a parallel shunt and play with series resistor as wapo proposes.
Adding 1 relais to switch between a "low volume setting" and a "high volume setting" also seems OK. I will look if I can modify my system to do this, shouldn't be a big deal. Probably I just need to put a series resistor in the path of the mute-relais which is already there. The mute-function can be taken over by disabling all input-relais. It's all software except the resistor.

Calibration every 10 minutes? Seems crazy, as long as all LDRs are kept at identical temperature. I also think it should be only on request, and with a manual analysis of the results to be sure to avoid "strange" things.
 
This real issue is that low volume is not that low with maximum current limited to 6mA in my case.

What is the reason for the very low maximum current? I can find LDRs that delivery 50 ohms at 6ma, but they are unusual. If you could raise that to 10 or 11 ma you'd have much better attenuation without coming close to the 20ma limit.
 
Last edited:
Presumably since at 6mA, the derating happens even slower, and probably by an order of magnitude or so slower than at 12mA. At such a low current there should barely be a need for recalibration. But oenboek, are you saying your shunt LDR's drifted that much over 3 years with 6mA current max? Or were you running them hotter and have now decided on the lower I to make them last longer?
 
Last edited:
Status
This old topic is closed. If you want to reopen this topic, contact a moderator using the "Report Post" button.