ESP32 CAM with other I2C devices?

I am planning a couple projects and wanted to take advantage of the camera component, and got the device below. That said, as I continue looking it looks like the I2C pins are internal to the board, which would make hooking up other I2C devices. Am I reading the schematic wrong or can I not use the I2C bus on the chip for other things? Can ESPHOME have multiple I2C buses defined?

https://www.amazon.com/gp/product/B07QS7VFMJ/ref=ppx_yo_dt_b_asin_title_o02_s00?ie=UTF8&psc=1

Thanks for any help

Correct. Pins for GPIO21 (SDA) and GPIO22 (SCL) are not connected to the header pins. You would have to solder directly to the surface mount pads of the ESP module to add extra devices.

No, it uses the internal i2C hardware and associated registers. No software based i2c is available. So only one bus on the pins specifically associated with the i2C bus.

Beter later than never :smiley:

Actually it is possible to have multiple I2C devices connected to the ESP32CAM via ESPHOME.

Check this example:

The camera code remain the same:

esp32_camera:
  external_clock:
    pin: GPIO0
    frequency: 20MHz
  i2c_pins:
    sda: GPIO26
    scl: GPIO27
  data_pins: [GPIO5, GPIO18, GPIO19, GPIO21, GPIO36, GPIO39, GPIO34, GPIO35]
  vsync_pin: GPIO25
  href_pin: GPIO23
  pixel_clock_pin: GPIO22
  power_down_pin: GPIO32
# Add additional image settings ....
  name: Camera displayed name
# ....

For the additional I2C sensor, you need to specific the I2C pins:

i2c:
  - id: bus_b
    sda: GPIO3
    scl: GPIO1
    scan: True # This is useful to see all active I2C addresses, but not mandatory

Then the sensor code: (in this case a temperature / humidity sensor)

sensor:
  - platform: hdc1080
    i2c_id: bus_b
    address: 0x40 
    temperature:
      name: "Room temp"
    humidity:
      name: "Room hum"
    update_interval: 60s
4 Likes

It is now, 4 years later.

2 Likes

Agree, I didn’t find any complete response as today, so, maybe someone like me who was searching for a solution today, might get this helpful.

3 Likes

I try 2 hours but as soon as i put

i2c:
  - id: bus_b
    sda: GPIO3
    scl: GPIO1

the camera stop

try this:

i2c:
sda: GPIO03
scl: GPIO01
scan: True
id: bus_a

:wink: