Pages

31.8.13

Stripboard I2C Logic Level Converter

A very easy logic level converter to translate I2C signals from, say, a 5 V Arduino to a 3.3 V slave device.



I2C logic level converter


The Arduino and Basic Stamp are 5 V devices, but many modern devices — sensors, displays, flash cards and the like — are 3.3 V only and require level conversion to protect them from higher voltage signals.

Level shifting for the I2C communication protocol uses a FET design following the NXP application note. This board should work with high voltages up to 10 V and low voltages down to 1.8 V.

For ease of prototyping I used 2N7000 N-channel MOSFETs on strip board, and tried 2.2 K pull up resistors in the hope that they would allow slightly transfer rates than 10 K resistors used in the equivalent Adafruit PCB.


Layout


An online stripboard editor was used to create the schematic and layout, which are documented in a github repository.




The design fits on 6 strips x 8 holes. I used a slightly wider board to make room for colour coded loops of wire next to the right angle pin headers. The SDA and SCL lines are marked brown and grey. The low voltage can be supplied on either side of the board (blue line).

The grounds on the two devices also need to be joined. This can be accomplished on the board with a simple change to the design.


Demo


Here, the 5 V SCL and SDA pins on an Arduino Uno are connected to the 3.3 V I2C lines from a hacked voltmeter LED display. The converter works. :)



Materials




Resources




Linkbacks


11 comments:

PJ Allen said...

I think that your schematic should show better the routing to the headers (the 3pin vs the 4pin).

Tom said...

Unfortunately the stripboard editor that I used has no symbol for pin headers, but the Eagle schematic in the Github repository should clarify things. The colour coding in the schematic is the same as the stripboard layout, by the way.

Unknown said...

Nice!

Im planning to make a 2-side board version of this in eagle - ill let you know after i finish it

Tom said...

Cool! Why not fork the github repository and post the link?

Anonymous said...

Nice, will this circuit work for the RPi? I think the RPi i2c bus operates at 3.3v and my sensor operates at 5v.

Tom said...

It should work, the conversion is bidirectional. You will need to supply 5V to the sensor and connect the sensor and RPi grounds.

Anonymous said...

Thanks, cant wait to try it out

Unknown said...

Think your schematic and circuit are wrong. R3 should be pulling up the 3.3V SCL line on Q2 Source pin, not on the Drain pin.

Tom said...

The layout is correct but the schematic needs to be rearranged.

Max Pierson said...

Brilliant! This is the exact thing I need!

Unknown said...

Thanks for your work! Could you elaborate why there are 4 pins on one side and 3 pins on the other?

Post a Comment