for an optical audio volume step switch: Does anyone have any ideas on the best way to adjust 6 voltages (5V, x mA) individually for each of z volume positions? So:
If z=1 then V1=..., V2=..., ..., V6=...,
if z=2 then ...
PWM + low pass filter is a very viable option. Works well with properly chosen RC values for the filter, but for any significant current you will have to buffer it through an OpAmp.
If you ramp up the PWM frequency (a 16 MHz Arduino can do 62.5 kHz with 8-bit resolution or even higher with lower resolution) you get faster response and can use smaller RC values for very stable analog output.
My problem is how I do this six times parallel at the same time and need 6 different values and, in addition, when I switch the level, I can set these 6 values again.
I understand how to head for a circle, as can be seen in my example link.
It seems like you will need 6 of whatever digital to analog conversion technique you choose.
The UNO can do 6 PWM outputs at once, I think. Just googled it, never tried. So probably you could do that.
Or you could get some external D/A converters, I have some that are two channels each on an 8 DIP package, they use I2C or SPI, forget which but 3 would run on just two pins if I2C or 5 pins SPI.
Or. I am not understanding your project. In any case tell us all a bit more, whatcha up to over there?
Yes, the Uno has 6 PWM outputs, all of which produce an output independently.
The catch though is that two of them are the outputs of Timer0, so increasing the PWM frequency of those two messes up the millis() timer and related functions. Something to keep in mind when designing your circuit.
I would like to try to describe my project again in more detail. Imagine a voltage divider (2 resistors) for a mono audio channel, so 4 resistors for the stereo application. In my case it is 2x3=6, because the whole thing should be balanced. The volume control should not be a potentiometer, but a step switch to control the volume. E.g. with 24 steps. So there are 6x24 (=144) resistors in total. The individual voltage dividers, i.e. the resistor values for the resistors are calculated for each of the 24 steps.
Now I want to use certain LDRs instead of resistors. Altogether 6 pieces (instead of the 144 normal resistors). The necessary electrical values to generate the individual target resistor values on the signal side are determined manually in advance. So it is then known which electrical values have to be given to the LED circuit to get the desired resistor value on the signal side.
So there are 2 "hierarchies" by the step switch, which is generated here by software. So altogether 144 switching states. I hope, I could describe this now more clearly. Enclosed a picture, how you can do this with a potentiometer. However, the individual voltage divider values are also very imprecise with regard to the substitute resistors. Therefore my approach.
Would be fine, if I could bring in my own ps (9V DC side).
An optocoupler is not designed to do what you try to make it do. It may or may not be able to work as variable resistance, but I doubt it will be accurate or stable (temperature affects the brightness of an LED, and likely the response of the detector).
If you want to regulate the current on the LED side using PWM, you may run into the issue that the output is switched fully on and fully off in tandem with the LED. Typical optocouplers (I didn't study the datasheet of this one - what you link to is NOT what I'd call an LDR) are more than fast enough for that.
tjf:
This LDR ist standard over the audio-world! May be I can do this not with Arduino...
Word. The part is designed and promoted for audio use. In the old days, it was an incandescent lamp and CdS cell. Or "LDR" as it was called. Not surprizing to see an LED version, although I wonder if some aficionados wouldn't say they can "hear" the difference.
As for the Arduino, rule #1 is if your project would work without an Arduino, it will certainly work with one!
WITS I don't think the Arduino can't be used in the manner you are suggesting.
As I see it, 6 PWM outputs are enough for this purpose of my project. I still have a few specific questions about this:
What type of Arduino do I use as the best? Can like to be more powerful than a UNO? Other requirement is WiFi. The UNO WiFi unfortunately only has 5 PWM outputs (+Nano?).
Am I limited to 5 volts for this project or can there be a solution where 9 volts are in play?
In short, please give me a combo recommendation to get me started ... UNO, Zero, Due, Mega 2560 + MKR WiFi 1010 ?
I am concorned that the PWM will present some problems. I would do an experiment with just one complete audio path and corresponding PWM/LED/LDR part(s) and circuitry to see a) how it functions and b) if you can certainly not hear any PWM leaking into the audio.
I think that external SPI or I2C digital to analog converters would eleimante the potial problems, simplify the circuitry and save pins on whatever micro you choose.
For example the MCP4728 is four d/a converters, I2C. Buy it on a breakout board from adafruit $7.50 or deal with it bare in its MSOP package, $2 at digikey. You’d have to learn some different things to get these going, but nothing that hasn’t been done.
alto777:
For example the MCP4728 is four d/a converters, I2C. Buy it on a breakout board from adafruit $7.50 or deal with it bare in its MSOP package, $2 at digikey. You’d have to learn some different things to get these going, but nothing that hasn’t been done.
If you want WiFi you need an ESP8266 based board, they can also do PWM. It's all done in software, though, on those boards, and thus may have glitches.
If you go the PWM way, an Uno or Nano (easier to build into a final project) with ESP-01 module as WiFi interface may be the simplest, most sensible solution.
If you go the external DAC way, go for a NodeMCU or WeMOS D1 Mini board. ESP8266 based, so WIFi on board, no Arduino needed.
I came across the MCP4922, it's two d/a convertors, on SPI communications and is available in a good old convenient DIP plastic package. $2.88/ at Digikey.
There's probably a number of devices. I think these are on the old side.
wvmarle:
If you want WiFi you need an ESP8266 based board, they can also do PWM. It's all done in software, though, on those boards, and thus may have glitches.
If you go the PWM way, an Uno or Nano (easier to build into a final project) with ESP-01 module as WiFi interface may be the simplest, most sensible solution.
If you go the external DAC way, go for a NodeMCU or WeMOS D1 Mini board. ESP8266 based, so WIFi on board, no Arduino needed.
alto777:
I came across the MCP4922, it's two d/a convertors, on SPI communications and is available in a good old convenient DIP plastic package. $2.88/ at Digikey.
There's probably a number of devices. I think these are on the old side.
You mean to use 3 of these MPC4922 (there is DACa and Dacb)?
A basic question about the Arduinos: For the MCP4922, for example, the UNO is obviously too low power. I would basically like to start with a DUE. Already because I have an finished extensive code for a parallel project, which I could use here without problems. A basic question: I would always be limited to 3.3 volts with a DUE - even when using external DACs like the MCP4xxx - or? Which would eliminate this choice again, because I need at least 5 volts.