Tuesday, December 18, 2012

How voltage divider works

I spend a lot of time trying to figure out how a "voltage divider" works, so I've written down everything I've learned and am uploading it here.  I am using a voltage divider to hook the Dexter board up to the Raspberry Pi so this info is relevant to Dexter.

4 comments:

  1. Hi Matt,
    I hope your not planning on using that voltage divider circuit. It's extremely power wasteful. Note that the total current used is 170mA while the load only uses 5mA. That works out to 97% waste.
    A zenor diode would make a much better voltage regulator.
    -Shaun

    ReplyDelete
  2. Hi Shaun,
    I am aware of the current waste (see the bottom lines of my graphic).

    I am actually going to use 2200 and 3300 resistors for R1 and R2 in practice. I've heard of zenor diodes but can't remember anything about them. If you'd like to propose how to wire one up to convert 5V down to 3.3V, I'd be happy to learn. The Raspberry Pi's TX/RX pins are 3.3V and the AVR's are 5V (when used with 5V power source) which is the problem I am trying to solve.

    ReplyDelete
  3. You really can't use a voltage divider that way. It's the low resistance gives regulation. The load resistance is combined with the regulator resistance, to form the divider (Rtotal = 1/[(1/R2)+(1/R3)]). In the above case, since R2 is very low, it doesn't matter much what the load is. But if you raise it to 3300, then the load resistance comes into play and the total resistance drops, and so does the output voltage.

    To use a zenor, you would just replace R2 with the diode. It would then keep the voltage at 3.3V so long as the current doesn't get too high.

    But honestly, the best solution is to just use a voltage regulator IC. It's one small part made to do exactly what you want.
    https://www.jameco.com/webapp/wcs/stores/servlet/Product_10001_10001_242114_-1

    ReplyDelete
  4. I'm a bit late to the party, but I thought I'd mention that this is only being used as a level shifter to connect a 5V TTL serial signal from dexter to the 3.3V input on the Pi. It's not meant to power a circuit, so current draw is minimal.

    It was intended as the simplest thing that could possibly work, originally wired by hand. Matt just thought it would be neater with a board, and would make it easier for others to make the same connections.

    For a final design, it would be more "proper" to use a level translator IC like this one, especially if we decide to use more I/O lines: http://www.ti.com/product/txb0108

    We're "cheating" for the other direction by connecting the Pi's 3.3V TTL serial output to dexter's 5V input. The logic high voltage level is well above the usual threshold of 2.5V, so it works fine. Probably best to disable pullup on the AVR's 5V input pin, though.

    For a final design, it would be more "proper" to use a switching transistor for the 3.3V out -> 5V in. Better yet would be a level translator IC like this one in both directions, especially if we decide to use more I/O lines: http://www.ti.com/product/txb0108

    ReplyDelete