Apologies if this has been covered before, but does anyone know if it's possible to use 2 dual-channel 12-bit DAC chips like the MCP4822 at the same time with an Arduino, for 4-channel DAC.
a|x
Apologies if this has been covered before, but does anyone know if it's possible to use 2 dual-channel 12-bit DAC chips like the MCP4822 at the same time with an Arduino, for 4-channel DAC.
a|x
Answered my own question: Apparently it is..
http://ua726.co.uk/2011/09/25/multiple-mcp4922-spi-dacs-on-an-arduino/
a|x
Yes, just need a separate CS for each device. That's how SPI works. All SCK, MOSI, MISO connected in parallel, unique CS for each device.
MCP4822, MCP4922, same way. Common SCK, MOSI, unique CS.
Control shutdown & LDAC as needed for your application.
Cool, thanks for the quick reply, CrossRoads!
Is there any practical limit to the number of DACs that can be run at the same time?
My interest is in developing Eurorack modules, where the voltage outputs are in the LFO range, so don't have to be updated at anything like audio rates.
a|x
If you want a lot of slow channels it may be cheaper to use a batch of sample & hold
circuits run from one DAC. That just a bunch of analog multiplexers, capacitors and
opamp buffers.
For instance you can drive 16 capacitors from one 1-to-16 analog switch, and 4
quad opamps to buffer the capacitors. You might want to only use 15 channels so the
DAC can be disconnected completely during transitions though. Use film capacitors
not ceramic. With ultra low input current opamps with low offset you should be able
to get something like 12 bit accuracy I think. Just regularly refresh each capacitor with
the correct voltage to avoid the slow discharge affecting the output. You have to allow
for the charging time of the capacitor too, but in theory this arrangement just trades
bandwidth for channels directly.
Hi MarkT,
So if I used a 16-way switch, I would effectively divide the possible bandwidth by 16. I see.
This is probably a very silly question, but does a DAC like the MCP4822 maintain an output voltage state indefinitely, once it's been set, or does it have to be constantly updated at a particular rate? Sorry, I'm a complete noob at this..
alx
Indefinitely. But you've looked at the datasheet already I hope - that's always the
definitive information source.
Also, I guess with your 16-way switch method, there would likely be some kind of ripple, as the capacitors charged and discharged. Wouldn't necessarily be an issue, but with modular synth v/octave CV, you might notice a pitch wobble.
I think I'll just stick with two dual-channel DACs, for the moment.
Thanks again for the tips, guys.
As I said you should be able to get to within 12 bit accuracy which is the best you can
do really given the DAC. Low input currents for opamps are measured in picoamps,
and with a 500kSPS DAC you can update each capacitor every 50us or so, so the
charge ripple would be of the order of atto-coulombs (hundreds of electrons)... Its
managable.
Is there any practical limit to the number of DACs that can be run at the same time?
Nope. You can use shift register and create the chip selects that way and not tie up all you IO too.
Only limit really is time.
If the DAC supports 8 MHZ SPI, then you can send out 2 bytes in about 2uS.
2 more or so to send data to the shifter register for CS control, so 4uS to update one channel.
Say 100 Hz refresh rate, 0.01Sec
0.01S/.000004S = 2500 channels?
May need a chip with more memory for that. '1284P has 16K SRAM, twice that of a Mega2560.
How much data do you need per channel? Or you calculate it as you go? Or pull it from a lookup table?
I'm just investigating options here, really. I have a couple of projects in mind. The simpler one is an 8-part MIDI to trigger interface. I was planning just to use 8 digital outputs, but now I'm thinking I could use DACs for 4 of the outputs, giving me the option to also have them output continuously-variable voltages, rather than just 5v pulses. From what's been said here, I could probably hook up 8 CV outputs relatively easily. With 8 variable-voltage outs, though, I'd probably want to use them to send out CV based on MIDI continuous controller data, and I suspect MIDI data reception and processing would then become the bottleneck in the system, rather than the CV output part of the system.
Anyway, time to start breadboarding a bare-bones system, and writing some code.
Thanks again for your advice, guys!
Ok, good luck.