A friend and I are working on an amp, DIY LM3886 Chip Amplifier (Gainclone) Kit this is it. It is 6 channels, and obviously all channels having to have the same value for Rin so I suggested using a similar approach to a lightspeed attenuator except having the LEDs pulsed by the PWM output on the Arduino and having the PWM output smoothed with some caps, has anyone tried smoothing the PWM output and, if possible, have any scope pictures of various duty cycles?
Because the voltage needs to be 100% linear there cannot be any drops in voltage on the LED, I've got a scope coming in the next few days but I was hoping someone might have some handy.
I've searched google and found a thread with some people talking about smoothing the PWM output (not on Arduino) for a motor, which leads me to believe it is very much acheiveable, but I'd like to get some advice from the Gods up here.
What do you mean the voltage needs to be "100% linear"?
Remember that PWM works by being on for some amount of time, and then being off. Depending on your application, you might need a DAC which gives you finer resolution and variability of the output voltage
Sorry I should've been more clear in the OP, what I want to do is use the Arduinos PWM to control the brightness of an LED which in turn will be setting the resistance of an LDR which will set the voltage of that channel, because the PWM isn't a constant voltage, the resistance on the LDR will not be either.
, because the PWM isn't a constant voltage, the resistance on the LDR will not be either.
Wrong, the LDR will not respond fast enough to show the PWM signal.
You can smooth it but it will do you no good with an LED. They stop working when the voltage is below 2.7V and around that point they are very none liner.
Echhh...that sounds unnecessarily complicated (PWM->light->LDR) just to have a single common resistance. Why not use the SPI port to write to a digital potentiometer? (MCP42010?)
The reason I was thinking that the PWM wouldn't be able to provide a linear voltage for the LDR is because when the volume goes from max power to its lowest, there would be huge gaps in the signal, would the LDR still not even be able to see those?
The signals need to all be going through a different path completely, having one componant would lead to the signal becoming mixed.
Hey Aeronotix,
We're both pursuing the same goal, I believe http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1240360457/0
And I have the same concerns as you regarding PWM directly controlling the LED but I like the simplicity of this approach. Have you considered the matching between channels & how you'll achieve this?
I believe the final arbiter will be how it sounds & I guess it's a case of building one channel to see. I have the Silonex LDRs & I'm hoping a barebones arduino may arrive with me in the next week but there has been a hitch so I'm not sure.
If the PWM control proves to be sonically intrusive, my contingency plan would be to control digital potentiometers which controlled the voltage to the LEDs or something similar.
My thoughts are that at low LED (low duty cycle) there would be no visibly noticeable flicker on the LED but there might be enough perturbations in the light given off to cause a unsteady resistance at the LDR. I don't know if anybody here has tried this yet.
From a thread on DIYAudio, it is considered that any noise on the LED PS will bleed through to the LDR but this is a very general blanket statement
Edit: Don't worry, I intend to share any significant progress on this forum
I'd still like to know Mike's thoughts on what would happen without smoothing
Sorry I don't have internet access at the weekends so just seen your comments.
My thoughts are that the LDR would not pick up the pwm component of the signal as the response time of the sensor would be too low. This is based on experiments I did too many years ago to contemplate (I was still at school) where I tried to put music down a modulated light beam into an LDR. The result was that nothing came out at all.
However, until you try it you won't know. If there is a signal transfer then there is an options to increase the PWM frequency above the audio rate.
I was waiting until I got an arduino to do any further investigation into the calibration - this looks like it will be another 3-4 weeks, I think (I wanted to order the large 20*4 LCD & controller from NKCelectronics but they won't be in stock 'til then). So like you, Aero, I'm in information gathering stage at the moment.
The idea is that an LDR is used on each audio channel (2 or more) and it's resistive element takes the place of a potentiometer for vol control. Why? Because these LDRs have very low distortion. The idea is to vary the LED current to vary the vol.
The ideal curve of R versus I is given by the control Law for these NSL-32SR2 devices: R= K1/(I*K2) where K1=2000, K2=1.6 (this is taken from: http://www1.silonex.com/audiohm/constants.html)
The problem is that these devices have wide manufacturing tolerances (even the sorted ones NSL-32SR2) & matching them along the curve is necessary for ensuring the same volume on each channel for a particular vol setting. (AFAIK, multichannel use has been avoided due to the difficulty of the matching between devices)
So I figured to use the Arduino to calibrate each LDR. There are two possibilities for LDR calibration
doing it out of the main vol control operational circuit
doing it in-circuit while temporarily connecting it the calibration circuit
The first would be simpler than the second option & I can't see any downsides to doing it this way at the moment.
Here's where some group thinking could help:
What we want to achieve is that for a particular volume setting each LDR would be giving the same resistance (ie volume). This requires that each LDR's LED will be fed a slightly different current given by the offset stored during the calibration stage.
Two things needed:
a circuit by which the arduino can accurately sense the resistance of the LDR
a program which will cycle through each vol setting(?) and adjust the LED current (PWM?)until the ideal resistance of the LDR is reached.
all current settings stored for all volume settings for all LDRs in an array which would be looked-up & used during operation.
Advantages to all this rigmarole:
a very high quality potentiometer is realised cheaply by using unmatched LDRs (the sorted ones are expensive & still need a batch for matching = expensive)
this will be combined with an arduino preamp that I had intended to do also which will use LDRs for source selesction
possibility to do balanced vol control or multichannel vol control
recalibration at any stage i.e over the lifetime of the equipment
and it's resistive element takes the place of a potentiometer for vol control
Volume control pots normally are just that potential dividers, three terminals, where as an LDR is just a two terminal device that changes resistance. Are you sure you can substitute an LDR for a pot? Even with a fixed top resistor the law will be different between the two devices.
Sorry if you have already considered that but it needs thinking about.
There is some discussion that the second config sounds best & this would be a question that could also be addressed with the uC controlled matching of LDRs.
In the absence of a uC, the series LDRs would need to be matched between channels & the shunt LDRs would also have to be matched between channels but a quad match would not be required just two pairs that matched.
This config is of course much more difficult & expensive to realise without uC control over dynamic matching & rules out any more channels than 2 being used.
I honestly think that a series R and shunt LDR will be much simpler.
There might not be as finer control over the volume but all in all, calibration will be far simpler.
Correct me where I am wrong but a volume pot is a potential divider where either side are unbalanced and one is connected to signal ground, the two separate resistances send different amounts of signal to either ground or the audio signal path, thus giving a change in volume.
If this is correct then I believe having a fixed series and a shunt LDR would be much more simpler than having two sets of LDR's which will need to be calibrated separately and in opposite directions.
This may be complete nonsense but this is what I've manage to suss out and it may be totally wrong. lolz.