Two logic converters?

I want to use both a BH1750, and a BME680 in the same project, however I need to use logic level converters. Can I use one converter for both seeing as they both are connected to I2C?

So what voltage are you running these two chips at?
What voltage is your master running at?

3.3v as per the datasheet requirements. BME680 is typically supposed to be 3.3v, and BH1750 can be between 2.5 - 3.6v.

The master is 5v.

So yes all you need is one logic level converter for both devices.

In fact you can do it without any logic level converters if you disable the input pull up on the two I2C lines of the master and just have pullups to 3V3.

I'm using the Adafruit level converter circuit:
image

As I said that is just a waste of parts.

@LarryD The question is about I2C so it needs to be a bidirectional converter.

1 Like

What do you suggest? How do I go about using just pullups?

Your best bet is the logic level converters. I do not think the additional cost will kill your project and your logic levels will not be on the edge.

In most I2C buses, the low and high input voltage level thresholds of SDA and SCL must depend on Vcc . E.g. an SDA voltage level of 1.1 V will be interpreted as low in an I2C bus with Vcc = 5 V and as high in an I2C bus with Vcc = 1.2 V.

Do you mean the Adafruit ones that I posted a pic of?

Logic level converters are used when logic levels of master/slave(s) are different.
If your master is 5volt, two slaves are 3.3volt and another slave is 5volt, then connect the 5volt slave directly to the master and the two 3.3volt slaves via one level converter.

Don't confuse power for the slaves with logic voltages.
Some sensors can be powered with 5volt, but have 3.3volt logic.
Post web-links to the parts if you're not sure.
Leo..

https://www.mouser.com/datasheet/2/348/bh1750fvi-e-186247.pdf

I am using the bare chips, so the datasheet is all the relevant data except my schematic:

An odd question.
You just add a pullup resistor ( 1K8 ) from the I2C clock to the 3V3 line. And add another to the I2C data line to the 3V3 line. And disable the input pull up on the two I2C lines of the master, just after you call serial begin, with a pinMode INPUT call for each of the two I2C lines the Master is using.

Don't be silly the logic levels are not in any way on the edge of anything. The I2C protocol requires a pull down signal when communicating.

I don't really want to have to do anything special for the programming, I want to plug-and-play like I was using the Adafruit modules.

It matters not.

1 Like

It's your loss, you asked the question and I answered with an efficient solution, you want to use extra hardware for no reason then I can't stop you.
Thanks for wasting my time.

That isn't my fault. I asked if I could use them both on one level converter, not "can you revise my logic converter". I now know that I can use them both on the same converter, and my question is answered.

Sure, I'm glad for the advice, but I would rather not do funny things in code when I don't have to. If not for the code side of it, I would have used that idea.

Then use an I2C library that does not automatically enable the internal pull up resistors, or it that not acceptable?

Or just forget disabling them altogether and have just a slightly higher voltage on the I2C pins of your chips. It will not be higher than 0.7V above the supply level that is needed to cause damage to the chips. Calculate yourself what it will rise to with a 30K pull up to 5V and a 1K8 pull up to 3V3.

Can you specify exactly what is wrong with the Adafruit setup?

It costs money, and every extra component reduces the mean time between failures of a circuit, so it is less reliable. Also we have a planet to save and wasting resources to fit with your lack of confidence in adding two software instructions is not helping.

1 Like