"The R-2R Ladder: What it is and Why you need one!"

So what is an R-2R ladder?

Well, it is just a cleverly arranged set of resistors that gives you the unique action of turning binary signals into an analogue output voltage. It works by the principle of superposition where switching on binary inputs adds more voltage at the output.

Here is a diagram of one showing binary inputs and analogue output.

An R-2r ladder setup showing resistances

The above ladder is just 4 bits long but you can extend it to any length (the limiting factor is the accuracy of the resistors).

Using a ladder network is a common way of creating an 8 bit DAC (Digital to Analogue Converter) as each control bit contributes to a binary weighted output voltage. However, for a highly accurate DAC, the resistors will be laser trimmed and located inside a chip.  

The ladder is still a useful  construct to use as you can create a very cheap 8 bit DAC if you are not too worried about accuracy ( using 1% resistors will allow fairly good output). 

How Does it Work: R-2R ladder analysis

It uses Kirchhoffs current law which states that the sum of currents  entering a node must be equal to the sum of the currents leaving a node. In the ladder, at each node, the current is split in half.  By switching the currents into each node the total current flowing is binary weighted.

Kirchhoffs current law

Using the principle of superposition when you add more current into a resistance the total voltage appearing is the sum of the voltages caused by all the individual currents i.e. as each bit is activated so the voltage increases at the output. 

Another clever thing about the R-2R ladder, and the reason that it works is that if you look to the left you always see the same impedance:

looking left you always see the same impedance for an r-2r ladder

Thévenin equivalent circuit

Using Thévenin's theorem you can work out the voltage contribution of each bit.  A Thévenin circuit is the equivalent of a network of resistances and voltage sources (and current sources).  You can replace the network with a Thévenin equivalent circuit and it will work in exactly the same way as the original network.

To use the Thévenin theorem replace all voltage sources with short circuits and all current sources with open circuits - calculate the resistance looking into the port for the Thévenin resistance Rth.  For the Thévenin voltage calculate the no load output voltage.

Thévenin equivalent circuit

Contribution if bit 3 is active (the MSB): 

Thévenin circuit equivalent for MSB (bit 3)

Contribution if bit 2 is active (the MSB): 

Thévenin circuit equivalent for MSB (bit 3), (bit 2)

 Contribution if bit 1 is active (the MSB):

Thévenin circuit equivalent for MSB (bit 3), (bit 2), (bit 1)

When each bit is active it contributes a binary weighted voltage to the output Vo.

R-2R Ladder Uses

These are the two main uses, there are probably more!

DAC (Digital to Analogue Converter)

As I described earlier the primary use of the binary weighted resistor ladder is for digital to analogue conversion as a DAC.

Multiple key Press Detector

The other useful, and related function, is to implement a button press detector feeding the analogue voltage to an ADC pin inside a microcontroller.

For the key input method, each key generates a binary weighted current (since each key is connected to one control pin of the ladder),  and the  output is a binary weighted voltage. 

So you can determine whichever set of keys have been pressed even if they are pressed at the same time as another key!

Note: Use 1% resistors to ensure the ladder works correctly.

Practical limits of achievable linearity/accuracy.

According to US patent: 7362253 

"Practical circuit implementations of the D/A converter utilizing R2R ladders are 1) scaling the switch sizes in a binary-weighted fashion and 2) decoding the MSBs into segments of resistor value R. Even with these techniques, the best D/A converters still only achieve 12 to 13 bits linearity accuracy." (in a 16 bit DAC).

Extract from : http://www.freepatentsonline.com/7362253.html

Notes on implementation

The R2R ladder is a current operating device, so the binary inputs can be connected directly to the outputs of the port either a discrete device or a microcontroller.

When the ground referenced ladder has an input bit that is set to 0V then no current flows so it contributes nothing to the output and conversely, current flows when +V is applied.

Also when using the ladder as a multiple key press detector you can connect only (push-to-make) to +V (Current flows) and leave no connection for zero (No current flows).

R2R Ladder Operational Summary

Summary : It generates a binary weighted output current, that by superposition becomes a binary weighted voltage.

Practical circut using an R-2R ladder

Here is a practical implementation of an R-2R ladder using standard resistors:

  • 4k7 (top of the voltage divider)
  • 10k
  • 22k
  • 47k
  • 100k

You can see that these roughly double as you go down the list, giving an approximate binary weighted output.

The top arm of the divider is 4k7 and the other resistors are switched (pulled down) into the circuit using a push to make push-button.

practical r-2r ladder

The question then is: 

What values are output from the middle of the voltage divider for each combination of the four push buttons?

Yes, you can go and work out parallel reistance values for each one but below you'll find a program to do it easily. In addition  it shows the ADC value separation for a Arduino Uno ADC (10 bit). This allows you to see how much wriggle room there is (or noise rejection) i.e. separation between ADC values for each combination of button press.

Down load the program written in TCL (free from activestate) to do this easily:

practical r-2r ladder calculation

TCL is a very useful language rather like javascript - totaly free. Just install the Activestate TCL package Activestate.com (you eventually get to a Windows ready download link).

After intstalling the main TCL windows program, download the TCL program in the link below. Open up File Explorer and double click on the .tcl program - and it works.

Click the link to Download here.


Privacy Policy | Contact | About Me

Site Map | Terms of Use


Share this page:
Enjoy this page? Please pay it forward. Here's how...

Would you prefer to share this page with others by linking to it?

  1. Click on the HTML link code below.
  2. Copy and paste it, adding a note of your own, into your blog, a Web page, forums, a blog comment, your Facebook account, or anywhere that someone would find this page valuable.

Comments

Have your say about what you just read! Leave me a comment in the box below.

Don’t see the comments box? Log in to your Facebook account, give Facebook consent, then return to this page and refresh it.