 # What is the "weighted pin" technique?

Hi i have been working on a project and have been trying to learn more about it in the process. Using an Arduino uno r3 my output is supposedly using the "weighted pin" technique but i have no idea how it works or how to implement it. google is of no help for this. any help would be appreciated

What are you trying to do with this project?

it is a guitar pedal using the arduino with a built-in pre amp and an active mixer stage. the schematic is below http://www.instructables.com/file/F6DPG7PGZMIUHMJ

In this instance it refers to the linking of two PWM pins together to increase the resolution. The two different resistor values give each pin a different “weight”, or portion of the PWM resolution.

The Arduino output is only loosely based on Kyle’s circuit. The part I kept was the weighted pin approach to get the Arduino to output 10-bit audio using only 2 pins. I stuck with his suggested weighted resistor ratings of 1.5K as the 8-bit value and 390K as the added 2-bit value (which is basically 1.5K x 256). From there I scrapped the rest. His output stage components were unnecessary because the audio was not going to an output, but rather to the new audio mixer stage.

Using this technique requires very accurate resistor values, much more accurate than you can buy off the shelf. You can measure lots of resistors to find ones that will give you a good fit but it is a bit time consuming and even then it is almost imposable to get suitable ones.

Not having accurate resistor values results in a loss of monoticity. http://en.wikipedia.org/wiki/Monotonic_function

ok thanks for the info. is there a way to measure monotonicity? or does that even make any sense? also, how do you determine the controlled input?

You measure it by measuring the output voltage for every input step. As the steps get higher the output gets higher. If going from one step to the next highest the output voltage drops instead of rises you have lost monoticity.
If you have a scope program up a ramp and look at it and see if there is a kink in the rising waveform.

Grumpy_Mike: You measure it by measuring the output voltage for every input step. As the steps get higher the output gets higher. If going from one step to the next highest the output voltage drops instead of rises you have lost monoticity. If you have a scope program up a ramp and look at it and see if there is a kink in the rising waveform.

A kink is fine, as long as it is not a downward kink. It would still be monotonic, just not linear ;)

``````Monotonic and linear:
/
/
/
/
/
/

Monotonic but not linear:
/
/
--
/
/
/

Non-monotonic:
/
\  /
/ \/
/
/
/
``````

Both monotonicity and linearity are what you are striving for.

Yes I think we define the word kink differently. In my book it means a downward step as described in the first part of my answer. If two successive numbers produce the same output it is still mono tonic. What you want ideally is to have the output change by at least half a significant bit for each number increment.

Grumpy_Mike: Yes I think we define the word kink differently. In my book it means a downward step as described in the first part of my answer. If two successive numbers produce the same output it is still mono tonic. What you want ideally is to have the output change by at least half a significant bit for each number increment.

I go by the google definition:

Google: Noun A sharp twist or curve in something that is otherwise straight.

But I digress.

Yes, upwards every step is a must. True linearity would be ideal, but is never going to happen in the real world. Something better than general monotonicity is needed though.

Wading your way through piles of resistors to find the ones that are the right value, while one of the most boring jobs imaginable, is really all you can do to try and get that almost regular increase on every step.