I2C level shifting by 74HC4050 or 74HC125AN

Hi everyone,

I am using a Freescale Accelerometer kit NXP® Semiconductors Official Site | Home,

For this I2C interface I am using Arduino Uno.

SDA and SCL signal pin should go from 3.3V to 5.5v.

I have 74HC4050 or 74HC125AN available.

Instead of bidirectional level shifter, dsscircuits.com is for sale | HugeDomains, can I use 74HC4050 or 74HC125AN?

Kindly help me to organized circuits with pull-up resister. Pin configuration from Arduino to freescale kit is required.


You can not use any of those chips.
The I2C lines are bidirectional, you can just use two transistors of FETs to level shift.

Could you kindly provide a circuit diagram ?
What kind of transistor I need to use ?

Edited that post to show one, just google for the FET version.
Any NPN transistor will do.

Thank you sir,

Do you mean both SDA and SCL pin need to connect this way ? I need 4 NPN BC547?

I have no Arduino micro, I want to wire it by Arduino Uno.
People are using 12C bus as follwing way.

// SDA: PIN 2 with pull up 4.7K to 3.3V on arduino Micro
// SCL: PIN 3 with pull up 4.7K to 3.3V on arduino Micro

They might be using +3.3V of arduino to Accelerometer MMA8652FC module.

Can you kindly explain why 74HC4050 can not be use this application?
Because of biderectional line of SDA and SCL , because of 74HC4050 is a hex buffer?

This may help:

Various level shifter breakout boards are available, for example:

Yes you need one circuit for each of the two I2C lines so four transistors in all.

Bidirectional means signals travel in both directions so any logic chip with an input and output will not work.

Dear Sir ,

I am using this circuit in attachment,
it works now.

In case of I2C for free-scale MAG3110 sensor which is built in FRDM-FXS-MULTI-B, I need an interrupt high pin (INT_MAG) to Arduino Uno digital I/O pin 3. How to convert it in voltage snifter ?

Kindly look at this attachment and give me a solution.



Just put a 1K resistor from the output to the base of an NPN transistor, any will do.
Then connect the emitter to ground and the collector to the Arduino input. Enable the internal pull up resistor on that input.

Please do not use the transistors for level shifting, that is a theoretical exercise, but it is not good in the real world.

A high level of 3.3V is a little outside the specifications of the Arduino Uno I2C bus. But it will work. As long as you don't add pullup resistors to 5V. If you need pullup resistors, connect them to 3.3V.

To make everything right, you have to level shift the Serial, the SPI, the I2C, and the Interrupts.
I suggest to use a 3.3V Arduino for all those signals.

Or do you only want to connect the I2C bus ? then use a module, like this 4-channel I2C-safe Bi-directional Logic Level Converter [BSS138] : ID 757 : $3.95 : Adafruit Industries, Unique & fun DIY electronics and kits or this http://www.adafruit.com/product/395. On Ebay are also many level shifters http://www.ebay.com/sch/i.html?_nkw=i2c+level They are just as good.

Koepel, please read the thread. That last post of mine was not about the I2C bus but an interrupt pin from the I2C device.

The transistor solution for I2C is not theoretical, it works, I have used it in many occasions. The OP found it worked too.

I also did it. It works well.

Grumpy_Mike, yeah, okay, I didn't read it very well.
And I have also made that circuit with transistors. With too many I2C modules at 3.3V it didn't work so well anymore. The modules with the mosfets have not failed me yet.

With too many I2C modules at 3.3V it didn't work so well anymore.

What pull ups were you using on the 3V3 side? I have gone down to 1K8 on occasions.

I don't know anymore, I think 10k plus all the pullups on the modules. I think it is somewhere in my shed deep down under boxes.

somewhere in my shed deep down under boxes.

I have just moved house, I have boxes, over 50 years of accumulated treasure.


Dear Sir,

When you did your PhD, I have not been born ! Congratulation to your 50 years great career!
Your profile is inspiring to all of us.

I am really lucky to have help from such great Engineer and Scientist!

I am working now few sensors, one of them is 3-Axis, 12-bit, Digital

Can you give me an idea to calculate accuracy ?


Can you give me an idea to calculate accuracy ?

Not too sure what you mean.

The best way is to look at the data sheet.

The only way to know how accurate a sensor is to calibrate it against a known quantity, and that can be tricky for an accelerometer without a whole room full of test equipment.

Dear Sir,

I am working with MMA8652FC, 3-Axis, 12-bit, Digital Accelerometer.
Its built in FRDM-FXS-MULTI-B free-scale sensor kit.

I have get data by applying I2C in Aduino Uno.

But, seems 3-axis sensor accuracy calculation is challenging, http://electronics.stackexchange.com/questions/33374/choosing-an-accelerometer

Kindly help me what to do for better measurement ? What to do for better performance and accuracy?
Should I use 2-axis sensor?

For reference, kindly look at this attachment.

MMA8652FC.pdf (491 KB)

Angulo_Acelerometro.pdf (581 KB)


What to do for better performance and accuracy?

It is basically down to the sensor and your requirements. How far are the two out from each other?

Understand that these sensors are not perfect, they all suffer from noise and drift so you have to resort to extra tricks when using them, like supporting and correcting them with other sensors like gyroscopes.

But unless you have a specific requirement of what parameters you want to achieve you are wasting your time worrying about it.
Some problems like inertial navigation tracking are beyond what the present day sensors can do.