I2C and Wire() question

Hi, i have a question that can be "obvious" to some people, but i need some help to understand. Im using an ESP32CAM, it doesnt have SCL and SDA pins, so i used the command Wire(14,15) [14 SDA, 15 SCL], to achive the writing/reading of I2C, the thing is ... can i connect more I2C stuff to the same pins using different addreses? because i understand that twoWire its an "emulation" of I2C bus, so maybe that feature its not allowed. Please maybe is dumb, but i need some clarification, thanks.

I don't know for sure, but I would try it. You won't damage anything by testing as long as voltages match. Do not directly connect a 5V I2C device to the 3.3V ESP32.

1 Like

I would appreciate a lot! i cannot find information about this :frowning:

https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-reference/peripherals/i2c.html

That is not my understanding of it. I think the ESP has more versatile internal function assignment to pins, such that the two internal I2C controllers can be assigned to different pins. I'm not sure if all, or just some.

The answer to your question is yes, even an emulation supports multiple addresses (it would be extremely pathetic if not).

I wonder, why you didn't just try...

1 Like

oh! i have read that in some place, but i think i read the opposite in some other place, so thats why i was asking to you haha. I think ill try to code and see if it works, i was worried to get the pins fried or kill the esp32cam.

What I2C devices are you attaching?

That is why it is so important to not rely on forums and "brag and run" sites for information. Go to the original source documentation. If you can't understand it, you've moved ahead too fast.

Are your I2C devices 3.3V powered? Are the I/O's 3.3V?

by now i want to attach the MCP23017 to increase IO digital pins, maybe ill change it later to other more useful IO expander.I would like to connect an Oled screen to it too.

Yeah! the main problem in the original documentation is that sometimes are explained really hard, and im not an expert, so sometimes is faster if others can explain the same in an easy way.

They are powered in 3.3V or 5, it depend, but i use a logic converter to work in the ESP32CAM with 3.3V.

So, you have a level converter for which device? I assume the common bus is the one attached to the ESP, so it's using 3.3V? Can you post a diagram?

For example, I have an ESP32 running a TM1637 display, on 5V. There is a level translator between them. So I could add a 3.3V device on the 3.3V side, or a 5V device on the 5V side.

The answer to that is to find some worthy sites that really do know what they're talking about (have a good track record with you and others). There are a few, not all sites are BS.

But those places are not the place to go for the resolution of doubts.

Ok i made this really quick on paint haha, but as you can see i have both sources, so i can use both depending on the needs, and the level converter do the job when they need communication. i didnt want to draw the other stuff cause its a lot, but you can get it

but well, thank you so much for the clarification, i will try to connect the things using the same port SCL and SDA and different addresses :slight_smile: ill tell you if it goes ok

I think I've already confirmed it. Because, I have a DS3231 module with an ESP32. When I ran the I2C scan, it found both the DS3231 and the on board I2C EEPROM chip. In that case, I also re-assigned the ESP I2C pins.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.