While researching and gathering components for my long term side-project "KNRTL",
a 4 channel loop-able AR generator/LFO, i found the very usable and cheap MCP 4725 DAC (digital > analog converter).
This converter is especially useful as it gets data via I2C and has 8 adresses you can choose from.
So technically you could use eight DACs on one I2C line. Well if you're like me, looking at the datasheets and ordering from adafruit, you probaby discovered, what i discovered after i had four of those in my hands:
Adrafruit deactivated all adresses but two.
So you are limited to two DACs.
In this Instructable i will tell you what i did to use all four by multiplexing the A0 pin.
Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.
Step 1: MCP4725 / HARDWARE
There is a lot of information on adafruits site, plus in the datasheet, so i assume you read both.
Whats important is Adafruits A0 port and how they used it.
Basically it tells the DAC which adress it should use or on which adress it should take commandes from the I2C bus.
There are two adresses available 0x63 and 0x62.
If A0 is not connected at all, or to ground, the DAC has the adress 0x62.
If A0 is on 5V/high, the DAC has the adress 0x63.
When you look at the photos, you can see that i made packs of two, by using the plastic row as distance.
I connected the I2C bus with pins, and let the A0 and Vout open.
Next what i did is connect the I2C bus cables with my controller, in my case its an Adafruit M0 feather.
Step 2: MULTIPLEXING THE A0 PIN
When you want to use tow of the DACs like Adafruit meant it to be, you have to tell both DACs via their adress pins what to do.
You do this by alternate switching between both adresses.
See the first image for an simple example script, to adress both DACs.
- In line 18, i adress the DAC on adress 0x63.
- In line 19, i tell it do output zero volts.
- In line 21, i adress the DAC on adress 0x62.
- In line 22, i tell it do output zerro volts.
The last adress, in this case 0x62 from line 21, stays active till you change it.
I don't change it for this simple script, but i make sure that the second DAC stays on zero Volts every time the button isn't pressed.
As the title of this step suggests, you can use the "same" technique like switching through adresses also the other way round.
You start by connecting the four (or more) A0 pins from your DACs to four Digital Output Pins of your controller.
Next, in your script, you never change the adress on the I2C bus, but leave it on 0x63.
Now to change adress, all you got to do is switch the corresponding t A0 pin via your controller to HIGH, tell the DAC which value to output, switch it low, switch on the next, and so on.
Voila, you can adress endless DACs.
Depends on the number of your free outputs obviously :)