Close

R-2R DAC inspired by tiny7 by al1

A project log for Me building projects from hackaday.io

This is where I build and talk about projects designed by the great people of this community.

davedarkodavedarko 11/04/2015 at 09:518 Comments

Inspired by #tiny7 by @al1

Following @Elliot Williams on youtube I noticed his next "logic noise" HaDblog post will feature R-2R DACs and an hour later I had this idea for a little project, using a shift register with some 6.8kOhm resistors I have too many of. Since I really liked the Idea of using the accessible ISP header on arduinos to send data to the shift register like the #tiny7 by @al1 does, I had to put this on a protoboard. Expect some weird sounds to follow, because they are nowhere near to be accurate with 5% tolerance resistors. This just screams for a self checking arduino script that writes data out and checks the output with analog input.


Discussions

Elliot Williams wrote 11/13/2015 at 21:12 point

That's awesome.  I'm sure that you'll find for audio (for instance) that it works well enough.  

Great call to drive it with a shift reg.

Watch the 127-128 transition (the most significant bit).  That's where the worst glitching will show up.  If you trim that out, 5%ers can work just fine.

It's not like a R-2R DAC is rocket science, though.  They're hella forgiving and super fun.

  Are you sure? yes | no

Eric Hertz wrote 11/05/2015 at 14:08 point

I read somewhere they used this method to build sound-cards on parallel ports way back in the day... there were even products based on it.

  Are you sure? yes | no

davedarko wrote 11/05/2015 at 11:09 point

I now remember ... it all started with a voice changer on instructables that used an arduino with a wave shield and the DAC was controlled by SPI. Seems like 4bit on a port would be much faster then a software controlled shift register though. 

  Are you sure? yes | no

Jarrett wrote 11/04/2015 at 19:29 point

I was investigating this a few months ago as a method of building a super cheap analog value, and I think the numbers I came up with were max 5-bit accuracy with 5% resistors.

For bonus points, can you design something with tri-state outputs like a 74hc595 shift register and use a single resistor on each output as a voltage divider, using highs, lows, and high-Zs to stack resistors in parallel?

It's much harder to conceptualise, and your resistor values will need to be cleverly chosen, but it might be a fun brain problem.  :)

  Are you sure? yes | no

davedarko wrote 11/05/2015 at 11:14 point

Sadly I have enough brain problems already and don't quite get what you mean ;) 

Most of the time I'm too lazy to do the maths and just try it out, so I'll post some graphs soon. I also have a MCP41100 or two, that should be interesting as well.

  Are you sure? yes | no

Jarrett wrote 11/05/2015 at 17:31 point

http://imgur.com/wUbhKX5

Drew a couple possible equivalents. Using 5v, 0v, or high-impedance outputs on the shift register, you should be able to generate an arbitrary analog value.

  Are you sure? yes | no