Author Topic: R-2R resistor ladder  (Read 8559 times)

0 Members and 1 Guest are viewing this topic.

Offline Spyro543

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1189
  • Rating: +74/-3
    • View Profile
R-2R resistor ladder
« 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
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

If you want to learn more about this take a look at the wikipedia page here.
« Last Edit: May 31, 2013, 02:42:44 pm by Spyro543 »

Offline Keoni29

  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2466
  • Rating: +291/-16
    • View Profile
    • My electronics projects at 8times8
Re: R-2R resistor ladder
« Reply #1 on: June 01, 2013, 05:35:41 am »
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.
« Last Edit: June 01, 2013, 05:35:57 am by Keoni29 »
If you like my work: why not give me an internet?








Offline aeTIos

  • Nonbinary computing specialist
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3915
  • Rating: +184/-32
    • View Profile
    • wank.party
Re: R-2R resistor ladder
« Reply #2 on: June 01, 2013, 05:42:09 am »
Nice oscilloscope you have there :o
I'm not a nerd but I pretend:

Offline Keoni29

  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2466
  • Rating: +291/-16
    • View Profile
    • My electronics projects at 8times8
Re: R-2R resistor ladder
« Reply #3 on: June 01, 2013, 05:44:05 am »
Hmm that scope gives me a cool idea :P
(calc ADC with scope software)
If you like my work: why not give me an internet?








Offline aeTIos

  • Nonbinary computing specialist
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3915
  • Rating: +184/-32
    • View Profile
    • wank.party
Re: R-2R resistor ladder
« Reply #4 on: June 01, 2013, 05:44:47 am »
will that work?
I'm not a nerd but I pretend:

Offline Keoni29

  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2466
  • Rating: +291/-16
    • View Profile
    • My electronics projects at 8times8
Re: R-2R resistor ladder
« Reply #5 on: June 01, 2013, 05:46:35 am »
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.
If you like my work: why not give me an internet?








Offline Streetwalrus

  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3821
  • Rating: +80/-8
    • View Profile
Re: R-2R resistor ladder
« Reply #6 on: June 01, 2013, 05:47:12 am »
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 ?
« Last Edit: June 01, 2013, 05:48:11 am by Streetwalker »

Offline Keoni29

  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2466
  • Rating: +291/-16
    • View Profile
    • My electronics projects at 8times8
Re: R-2R resistor ladder
« Reply #7 on: June 01, 2013, 05:53:04 am »
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.
If you like my work: why not give me an internet?








Offline Streetwalrus

  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3821
  • Rating: +80/-8
    • View Profile
Re: R-2R resistor ladder
« Reply #8 on: June 01, 2013, 05:55:17 am »
Yeah so you can actually make it in less than 10 seconds. :P (not counting display but that's pretty easy in Axe)

Offline Keoni29

  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2466
  • Rating: +291/-16
    • View Profile
    • My electronics projects at 8times8
Re: R-2R resistor ladder
« Reply #9 on: June 01, 2013, 07:34:25 am »
No you can't do it in so little time. You have to write some code for handling data streams.
If you like my work: why not give me an internet?








Offline Streetwalrus

  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3821
  • Rating: +80/-8
    • View Profile
Re: R-2R resistor ladder
« Reply #10 on: June 01, 2013, 07:35:31 am »
Yeah I was just sayin' that it wouldn't take really long to do it. :)

Offline Keoni29

  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2466
  • Rating: +291/-16
    • View Profile
    • My electronics projects at 8times8
Re: R-2R resistor ladder
« Reply #11 on: June 01, 2013, 07:36:23 am »
About 1 hour to write the code and about 10 hours to find that one annoying bug.
If you like my work: why not give me an internet?








Offline Streetwalrus

  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3821
  • Rating: +80/-8
    • View Profile
Re: R-2R resistor ladder
« Reply #12 on: June 01, 2013, 07:37:11 am »
BUGS ! D: I HATE BUGS !
* Streetwalker runs away from them
« Last Edit: June 01, 2013, 07:37:36 am by Streetwalker »

Offline aeTIos

  • Nonbinary computing specialist
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3915
  • Rating: +184/-32
    • View Profile
    • wank.party
Re: R-2R resistor ladder
« Reply #13 on: June 01, 2013, 07:40:20 am »
This is getting off-topic. <_<
Really.
And I actually shouldn't post this either because it's also off-topic <_<
I'm not a nerd but I pretend:

Offline Streetwalrus

  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3821
  • Rating: +80/-8
    • View Profile
Re: R-2R resistor ladder
« Reply #14 on: June 01, 2013, 07:41:21 am »
Haha yeah.

This is looking pretty awesome, Spyro. :D