Using ESP32-CAM (AI-Thinker) with Bosch Sensors BME280/BME680 via I2C and its integration into Home Assistant via Esphome. With some small modifications you can use this code also for other boards e.g. ESP01/ESP12/... which I already tried as well. Focus here is NOT to show how to do flashing via esptool, just to share YAML configuration file used for flashing of microcontroller by esptool to save your time in development phase.
Note: BME280 is a temperature sensor. BME680 has additionally a gas sensor.
I was personally struggling to find out comprehensive tutorial, how to integrate ESP32-CAM together with any kind of Bosch sensor via I2C. The main motivation had been to use just one microcontroller (in this case ESP32-CAM) for everything - camera & temperature/gas sensor.
Here pinout of ESP32-CAM. The GPIO names are important to set I2C correctly. To this point we will come again when we write the code.
Image source: RandomNerdTutorials.com
Here my complete wiring:
Here you find a sketch made in Fritzing.
Be careful: BME280/680 are sensor with supply power 3.3V! ESP-CAM works with both 3.3/5V, but for better stability I recommend to use 5V.
Here complete YAML file for ESP32-CAM & BME280.
Based on the ESP32 (or other microcontroller) pinout, you have to define the right I2C pins. In my case I used GPIO13 as SDA and GPIO12 as scl (see wiring above). You can change it as you wish, but then you need to use the right pins. Another very important thing is to use correct sensor address - in my case 0x76, other option is e.g. 0x77.
Here a default example from ESPHome web site about ESP32-CAM.
This is an example, how it looks like in Home Assistant: