Omnimaga
General Discussion => Technology and Development => Other => Topic started by: Spyro543 on May 31, 2013, 02:42:00 pm
-
An R-2R resistor ladder is a nice little method of doing digital to analog conversion.
The one I made is 8-bit, so it can output 256 different voltages from 0V to 3.3V. Here are some pics:
http://i.imgur.com/GPynZsR.jpg (http://i.imgur.com/GPynZsR.jpg)
You can see on my oscilloscope that I'm generating a saw wave. All I'm doing is counting from 0 to 255 really fast over and over again, and putting the number onto the 8 pins of the PIC that are connected to the resistor ladder. You can also see on the oscilloscope that the wave isn't perfectly straight, and that's because of the resistors' tolerance that is differing the resistance slightly. There's nothing I can do to fix that, except use resistors with smaller tolerance.
Here's a close up pic of the ladder:
http://i.imgur.com/VObI1xr.jpg (http://i.imgur.com/VObI1xr.jpg)
If you want to learn more about this take a look at the wikipedia page here (http://en.wikipedia.org/wiki/Resistor_ladder#R-2R_resistor_ladder_network_.28digital_to_analog_conversion.2C_or_DAC.29).
-
I made a 4 bit one for use with calcs once. I tested that one with different waveforms as well. I even tried converting sound samples to calc format, but it did not quite work.
-
Nice oscilloscope you have there :o
-
Hmm that scope gives me a cool idea :P
(calc ADC with scope software)
-
will that work?
-
Of course that will work. If you have a 12 bit analog to digital converter with an I2C bus you could interface it with the 84+. You'd need to implement the I2C protocol in software though.
-
It will. Because here we're all awesome and there's nothing we can't do. :P
Edit : Why I2C ? wouldn't your soundchip interface work ?
-
The atmega 328 has a built in 10 bit ADC, so I could use one of those and use the same protocol as my soundchip uses.
-
Yeah so you can actually make it in less than 10 seconds. :P (not counting display but that's pretty easy in Axe)
-
No you can't do it in so little time. You have to write some code for handling data streams.
-
Yeah I was just sayin' that it wouldn't take really long to do it. :)
-
About 1 hour to write the code and about 10 hours to find that one annoying bug.
-
BUGS ! D: I HATE BUGS !/me runs away from them
-
This is getting off-topic. <_<
Really.
And I actually shouldn't post this either because it's also off-topic <_<
-
Haha yeah.
This is looking pretty awesome, Spyro. :D
-
What else can we say about r2r ladders? We're talking about digital to analogue and vice versa converters.
-
What else can we say about r2r ladders? We're talking about digital to analogue and vice versa converters.
Well, why do you bother to build yourself such a thing? If that's only for learning purposes i can take that, but otoh the simulator ouput should be enough. Else why don't you just buy an off-the-shelf component (dac/adc) with much higher resolution/precision and smaller footprint? FYI R-2R networks are normally built with integrated matched resistor values. Building it with discrete components is doomed to failure. Cheers,
-
The ADC on the atmega/arduino chipset is notoriously slow, however. If you need speed, you might want to get a dedicated high-speed ADC (I generally use the SPI interface with an Arduino)
-
DAC and ADC are very expensive. Especially i2c ones.
-
You can get free samples from TI for some fairly powerful ADCs.
-
Samples? I never get those. I am not a university nor big company (not even a small one). TI is not known for throwing samples at everyone.
-
they actually have options for individuals, IIRC. Just find the chips you want and request a free sample if they're available (sometimes they're not, but I've always found the chips I need).