Go Down

Topic: resistor ladder question (Read 4241 times) previous topic - next topic

GoForSmoke

I have seen that an R2R ladder can digitize analog voltage though I'm fuzzy about details.
Like, if the ladder has 8 outputs, will that count 8 bits or 8 steps (IIRC, it's 8 steps).

And, can the same ladder work in reverse, feed it 8 outputs and get a single combined voltage?

1) http://gammon.com.au/blink  <-- tasking Arduino 1-2-3
2) http://gammon.com.au/serial <-- techniques howto
3) http://gammon.com.au/interrupts
Your sketch can sense ongoing process events in time.
Your sketch can make events to control it over time.

larryd

#1
Jun 25, 2014, 05:19 am Last Edit: Jun 25, 2014, 05:24 am by LarryD Reason: 1
You can feed o/ps to the inputs and get a a single analog output.
For example if the outputs count up form 0 to 255 you generate a staircase on the analog output that has 256 decrete voltage levels. Hence a D to A converter

Edit.   http://en.m.wikipedia.org/wiki/Resistor_ladder

No technical PMs.
If you are asked a question, please respond with an answer.
If you are asked for more information, please supply it.
If you need clarification, ask for help.

TomGeorge

Hi, the ladder can turn a parallel digital signal into an analog signal.
The R2R arrangements gives each input a different analog weighting.

However placing an analog signal into the output of an R2R will not produce a parallel digital signal.

If you use a binary counter and a comparator you can accomplish a A to D with R2R.

Tom...... :)
Everything runs on smoke, let the smoke out, it stops running....

Paul__B


If you use a binary counter and a comparator you can accomplish a A to D with R2R.


Actually, it's not a Binary counter, it's a SAR, a Successive Approximation Register.  The general concept is a DAC - such as a resistor ladder - which generates trial values which are then compared to the input value, making a decision at each step as to whether the approximation is greater or less than the input.

The SAR does not simply count through single increments however, but starts with an approximation of half the reference value.  According to the comparison it next tries either a quarter or three quarters, and continues to halve the test interval at each step.  By doing this, it determines one binary bit of the value for every trial and so requires only as many trials - approximations - as bits are needed.

GoForSmoke

The idea was to use output shift register(s) or possibly bigger AVR port(s) to make analog audio through a ladder.
22K sound should be no real sweat if speed were the only real problem.

It looks possible to do 8 bit sound after a whole lot of work matching resistors and outputs that I can't say will will be uniform in themselves, which gets... is that geometrically more demanding with each extra bit?

What can I say? I find most 1 pin sound just too cheesy.

With some big bags of resistors and a lot of time and patience it looks possible.
OTOH spend the money and see what kind of quirks this or that sound chip board will take maybe less t & p.
1) http://gammon.com.au/blink  <-- tasking Arduino 1-2-3
2) http://gammon.com.au/serial <-- techniques howto
3) http://gammon.com.au/interrupts
Your sketch can sense ongoing process events in time.
Your sketch can make events to control it over time.

KeithRB



If you use a binary counter and a comparator you can accomplish a A to D with R2R.


Actually, it's not a Binary counter, it's a SAR, a Successive Approximation Register.  The general concept is a DAC - such as a resistor ladder - which generates trial values which are then compared to the input value, making a decision at each step as to whether the approximation is greater or less than the input.

The SAR does not simply count through single increments however, but starts with an approximation of half the reference value.  According to the comparison it next tries either a quarter or three quarters, and continues to halve the test interval at each step.  By doing this, it determines one binary bit of the value for every trial and so requires only as many trials - approximations - as bits are needed.



I built one of these out of MSI logic circuits in college. It worked!

polymorph

What do you mean, matching resistors? You only need a bunch of resistors, and another bunch of double the value. If the standard values don't yield quite what you need, just use two in series to get the doubled value.



2% resistors should be good enough. Use resistors of high enough value that the impedance of each pin is inconsequential. 10k/20k should be fine. Or 12k/24k. Those are standard values in 2% resistors.

Or you could add something like a 4050 CMOS HEX buffer, if you are worried about different pins of the Arduino having different impedances.
Steve Greenfield AE7HD
Drawing Schematics: tinyurl.com/23mo9pf - tinyurl.com/o97ysyx - https://tinyurl.com/Technote8
Multitasking: forum.arduino.cc/index.php?topic=223286.0
gammon.com.au/blink - gammon.com.au/serial - gammon.com.au/interrupts

MarkT

For 8 bits the resistor tolerance is 0.8% I think (1 part in 2^7).

These days resistors are readily available in 1% and 0.1% ratings, although
you pay more.  Due to the better matching of resistors from the same batch
it may be better to synthesise the 2R resistors as two resistors in series, then
all the resistors are the same value.

Datasheets for many SAR ADC chips show the general schematic for SAR
circuits, good place to learn about how to do it (if you want to make one
yourself).
[ I will NOT respond to personal messages, I WILL delete them, use the forum please ]

GoForSmoke

With a bag of 1% or 2% resistors and a meter, I'm pretty sure that some will be closer to dead nuts than others so those would be the ones for the high order bits.

From what I read on the linked page, this is a current device. I wonder how exactly the same current pin to pin either AVR port pins or output shift register pins are? They're made for digital work. And that is where the idea that the resistors may have to be matched to the pins comes from. Otherwise, the page did mention ladder units made of thin film (I knew John Gerber, his team developed thin film tech on salt blocks.) good up to 14 bits.

8 bit sound seems to me like it should be better than 1 bit PWM sound, and I've pretty much given up on any 16 bit ladder ideas. It'd be nice to pump WAV files out through SPI though.

1) http://gammon.com.au/blink  <-- tasking Arduino 1-2-3
2) http://gammon.com.au/serial <-- techniques howto
3) http://gammon.com.au/interrupts
Your sketch can sense ongoing process events in time.
Your sketch can make events to control it over time.

MarkT

For very accurate work you have to allow for the output resistance of the
pins driving the resistor network.  The ATmega devices have about 30 to 40 ohms
of output resistance at 5V supply, if I remember right.  Thus an R-2R ladder with
values of 500 and 1000 ohms would be well out of spec (470 and 970 ohms would
be better), whereas a 10k/20k network would be fine.
[ I will NOT respond to personal messages, I WILL delete them, use the forum please ]

larryd

I used these in the old days.
http://www.physics.ucdavis.edu/Classes/Physics116/MC1408-dac.pdf
No technical PMs.
If you are asked a question, please respond with an answer.
If you are asked for more information, please supply it.
If you need clarification, ask for help.

polymorph

Quote
With a bag of 1% or 2% resistors and a meter, I'm pretty sure that some will be closer to dead nuts than others so those would be the ones for the high order bits.


Hm. You may have a point, there. 1% off on bit D7 is going to be 1/2 of 1% of full scale output, whereas the entire bit D0 is only 1/255 of full scale.
Steve Greenfield AE7HD
Drawing Schematics: tinyurl.com/23mo9pf - tinyurl.com/o97ysyx - https://tinyurl.com/Technote8
Multitasking: forum.arduino.cc/index.php?topic=223286.0
gammon.com.au/blink - gammon.com.au/serial - gammon.com.au/interrupts

GoForSmoke


I used these in the old days.
http://www.physics.ucdavis.edu/Classes/Physics116/MC1408-dac.pdf


I see those on eBay, 25 for $15.

Were you making audio and if so, how was it?

1) http://gammon.com.au/blink  <-- tasking Arduino 1-2-3
2) http://gammon.com.au/serial <-- techniques howto
3) http://gammon.com.au/interrupts
Your sketch can sense ongoing process events in time.
Your sketch can make events to control it over time.

larryd

Quote
Were you making audio and if so, how was it?

No.
We took the output from a transformer tap position switch which was in binary (it represented tap position of the transformer) converted the binary to an analog voltage using a 1408 circuit.
Sent this to a computer system where it was displayed as a number from 0 to 38 (i.e. taps ,1,2,3...38).

No technical PMs.
If you are asked a question, please respond with an answer.
If you are asked for more information, please supply it.
If you need clarification, ask for help.

polymorph

The chip looks like a much better solution. Or some other DAC chip.
Steve Greenfield AE7HD
Drawing Schematics: tinyurl.com/23mo9pf - tinyurl.com/o97ysyx - https://tinyurl.com/Technote8
Multitasking: forum.arduino.cc/index.php?topic=223286.0
gammon.com.au/blink - gammon.com.au/serial - gammon.com.au/interrupts

Go Up