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
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.
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
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
https://en.wikipedia.org/wiki/Covox_Speech_Thing
Are you sure? yes | no
I wonder if you could do speech synthesis with it, like https://web.archive.org/web/20150607070905/http://letsmakerobots.com/content/help-convert-blank-atmega328-speech-synthesizer-chip-under-5
Are you sure? yes | no
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
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
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
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