A Bidirectional Logic Level Converter (for I2C)

27,137

39

12

Introduction: A Bidirectional Logic Level Converter (for I2C)

About: I'm mainly interested in music, food and electronics but I like to read and learn about a lot more than that.

When working with sensors and microcontroller or arduino's, you'll need a level converter as a lot of sensors are designed for 3,3V and most microcontrollers will be 5V.

I know that they can be bought cheaply at sparkfun and others but when you only want to buy one converter you might pay more for the shipping than for the actual thing. And besides that, it is a simple thing to make.

You only need two bss138 mosfets, four 10k resistors, two sets of male headerpins and a pcb or a piece of veroboard.

Step 1: The Circuit.

There is not much to tell about te construction of this circuit. Connect the gates directly to 3,3V, the sources via a 10K resistor to 3,3V and the drains via a 10K resistor to 5V.

Then make yourself a nice PCB-layout or find yourself a small piece of leftover veroboard and head to the next step.

Step 2: Soldering and Hook Up

Solder everything together. There are only 8 components so it shouldn't take long before you can add it to your breadboard.

I added a picture with the connections on it. The sda and scl could be swichted aslong as you switch them on the other side too.

Be the First to Share

    Recommendations

    • Battery Powered Contest

      Battery Powered Contest
    • Plywood Challenge

      Plywood Challenge
    • Plastic Contest

      Plastic Contest

    12 Discussions

    0
    Nyxius
    Nyxius

    3 years ago

    BTW, how did you make your PCB? Its very clean, but has a sort of homemade feel to it. I doubt you drew that by hand so I'm super curious.

    0
    janw
    janw

    Reply 3 years ago

    I drew it in eagle and used the uv method to etch it.

    0
    Nyxius
    Nyxius

    3 years ago

    Thanks for the help. I bought a velleman LLC and immediately regretted it. This is much better. Going to cannibalise the velleman to build this.

    0
    JoãoM41
    JoãoM41

    3 years ago

    Noob here, Could you explain how it works? The signal is inverted correct? Because when the signal is "low" the transistor is open, therefore doing the 5V? Also, why the resistor in between signal and voltage? Thank you for the tutorial.

    0
    MatS1
    MatS1

    5 years ago

    Hi, something I'm trying to understand about this, and also the SparkFun bi-directional level converter (4 channel).

    Only 6 pins are used: 2 each side for data and 1 each side for "HV" and "LV", i.e. supply voltages.

    But there is no ground connection? Is that correct?

    I looked at the SparkFun board in Eagle, and there are ports there marked GND but as far as I can tell they aren't connected to anything. Can't work out why...

    0
    janw
    janw

    Reply 5 years ago

    Connect ground of both sides directly and not vis this pcb

    0
    steveo98501
    steveo98501

    5 years ago on Introduction

    Why do you have 4 pins on each side when you are only connecting 3 pins on each side?

    0
    janw
    janw

    Reply 5 years ago on Introduction

    It's only because the board sits a bit more stable in the breadboard. You can make one with only 3 pins.

    0
    mpep
    mpep

    10 years ago on Introduction

    Hi, please advise which pins are for what? My crystal ball has broken. ;-)

    0
    janw
    janw

    Reply 10 years ago on Introduction

    look at the last picture in the last step. It should be there. SDA and SCL can be exchanged without problem aslong as you do it on both sides of the converter.