1

I build a PCB using ESP32-S3-WROOM-1-N16R2 Controller. I programmed a BME680 sensor with this MCU. My pinouts are,

BME_SCK 38

BME_MISO 19

BME_MOSI 15

BME_CS 5

enter image description here

This is my Arduino code,

#include <Wire.h>
#include <SPI.h>
#include <Adafruit_Sensor.h>
#include "Adafruit_BME680.h"

#define BME_SCK 38 #define BME_MISO 19 #define BME_MOSI 15 #define BME_CS 5

#define SEALEVELPRESSURE_HPA (1013.25)

//Adafruit_BME680 bme(&Wire); // I2C //Adafruit_BME680 bme(&Wire1); // example of I2C on another bus //Adafruit_BME680 bme(BME_CS); // hardware SPI Adafruit_BME680 bme(BME_CS, BME_MOSI, BME_MISO, BME_SCK);

void setup() { Serial.begin(9600); while (!Serial);

SPI.begin(BME_SCK, BME_MISO, BME_MOSI, BME_CS); SPI.setDataMode(SPI_MODE0); // Set SPI mode (0, 1, 2, or 3)

Serial.println(F("BME680 test"));

if (!bme.begin()) { Serial.println("Could not find a valid BME680 sensor, check wiring!"); while (1); } else { Serial.println("BME680 sensor initialized successfully."); }

// Set up oversampling and filter initialization bme.setTemperatureOversampling(BME680_OS_8X); bme.setHumidityOversampling(BME680_OS_2X); bme.setPressureOversampling(BME680_OS_4X); bme.setIIRFilterSize(BME680_FILTER_SIZE_3); bme.setGasHeater(320, 150); // 320*C for 150 ms }

void loop() { if (! bme.performReading()) { Serial.println("Failed to perform reading :("); return; } Serial.print("Temperature = "); Serial.print(bme.temperature); Serial.println(" *C");

Serial.print("Pressure = "); Serial.print(bme.pressure / 100.0); Serial.println(" hPa");

Serial.print("Humidity = "); Serial.print(bme.humidity); Serial.println(" %");

Serial.print("Gas = "); Serial.print(bme.gas_resistance / 1000.0); Serial.println(" KOhms");

Serial.print("Approx. Altitude = "); Serial.print(bme.readAltitude(SEALEVELPRESSURE_HPA)); Serial.println(" m");

Serial.println(); delay(2000); }

I got output like,

R~�g�BME680 test
Could not find a valid BME680 sensor, check wiring!
R~R~�g�BME680 test
Could not find a valid BME680 sensor, check wiring!
R~�g�R��g�BME680 test
Could not find a valid BME680 sensor, check wiring!

I go through the ESP32-S3 datasheet, It says Any GPIO pins, we will assign for SPI, I2C Communications. Datasheet link for your reference, https://www.espressif.com/sites/default/files/documentation/esp32-s3-wroom-1_wroom-1u_datasheet_en.pdf ESP32-S3 series datasheet, https://www.espressif.com/sites/default/files/documentation/esp32-s3_datasheet_en.pdf

and also i wired the same pins in ESP32-S3 EVK and programmed with BME680, it gives data perfectly, I don't know what's the issue. How to solve this issue?

jsotola
  • 1,554
  • 2
  • 12
  • 20
Kuralmozhi
  • 21
  • 4

1 Answers1

0

I do not see anything wrong with the code. Please check for broken traces, cold joints, short circuits, etc. Use a multimeter to check the continuity of each SPI signal pin (SCK, MISO, MOSI, and CS) between the ESP32-S3 and the sensor. Here is a design that you can see for a cross-reference.

https://www.pcbway.com/project/shareproject/IoT_Indoor_system_with_ESP32_to_monitor_Temperature_Humidity_Pressure_and_Air_a1cf31ba.html

tepalia
  • 168
  • 5