- 
                Notifications
    You must be signed in to change notification settings 
- Fork 2
Open
Description
Hi,
I'm using shuttle board with esp32 on I2c mode.  How to fix   Bosch API return code: 113
Any help is appreciated thanks !
Logs
19:41:47.858 -> ✅ open() passed
19:41:47.997 -> ✅ reset() passed
19:41:47.997 -> 
19:41:47.997 -> ✅ ID() passed
19:41:47.997 -> ✅ init() finished successfully
19:41:47.997 -> ✅ Init ready succeeded
19:41:52.961 -> ⚙️ Setting required parameters...
19:41:53.000 -> ✅ Parameters configured. Waiting for stabilization...
19:41:54.993 -> ⏳ Attempting to set CONTINUOUS mode...
19:41:55.026 -> 📋 Bosch API return code: 113
19:41:55.026 -> _bmv080_handle_class is OK
19:41:55.026 -> Error setting BMV080 mode. Code: 0
19:41:55.071 -> ⏳ Attempting to set DUTY CYCLE mode...
19:41:55.117 -> 📋 Bosch API return code: 113
19:41:55.117 -> _bmv080_handle_class is OK
19:41:55.117 -> ❌ Failed to set duty-cycle mode. Code: 0
19:41:55.117 -> ⏳ Attempting to set CONTINUOUS mode...
19:41:55.158 -> 📋 Bosch API return code: 113
19:41:55.193 -> _bmv080_handle_class is OK
19:41:55.193 -> Error setting BMV080 modeArdiuno IDE
#include "SparkFun_BMV080_Arduino_Library.h" // CTRL+Click here to get the library: http://librarymanager/All#SparkFun_BMV080
#include <Wire.h>
SparkFunBMV080 bmv080; // Create an instance of the BMV080 class
#define BMV080_ADDR 0x54  // Shuttleboard BMV080  defaults to 0x57
#define SDA_PIN 21
#define SCL_PIN 22
#ifdef ARDUINO_SPARKFUN_THINGPLUS_RP2040
#define wirePort Wire1
#else
#define wirePort Wire
#endif
void scan_device(){
    Serial.println("\n🔍 Scanning I2C...");
    for (uint8_t addr = 1; addr < 127; addr++) {
        Wire.beginTransmission(addr);
        if (Wire.endTransmission() == 0) {
        Serial.print("✅ Found device at 0x");
        Serial.println(addr, HEX);
        }
    }
    Serial.println("🔍 Scan complete");
}
void check_connection(){
    if (bmv080.begin(BMV080_ADDR, Wire) == false)
    {
        Serial.println("BMV080 not detected at default I2C address. Check your jumpers and the hookup guide. Freezing...");
        while (1);
    }
    Serial.println("BMV080 found!");
}
void setup()
{
    Serial.begin(115200);
    delay(2000);
    Serial.println("🔧 Serial started");
    Serial.println();
    Serial.println("BMV080 Example 1 - Basic Readings");
    Wire.begin(SDA_PIN, SCL_PIN);
    // wirePort.setClock(400000); //Increase I2C data rate to 400kHz
    
    // scan_device();
    check_connection();
    
    /* Initialize the Sensor (read driver, open, reset, id etc.)*/
    Serial.println(bmv080.reset());
    
   if (!bmv080.init()) {
        Serial.println("❌ Sensor init failed");
        while (1); // halt
    }
    Serial.println("✅ Init ready succeeded");
    delay(5000); // <-- Give the sensor some time before setting mode
    Serial.println("⚙️ Setting required parameters...");
    bmv080.setVolumetricMassDensity(1.2);  // Air at sea level ~1.2 kg/m³
    bmv080.setDutyCyclingPeriod(30);       // Default ~30s duty cycle
    bmv080.setIntegrationTime(0.1);        // 100ms integration
    bmv080.setDoObstructionDetection(true);
    bmv080.setDoVibrationFiltering(true);
    bmv080.setMeasurementAlgorithm(1);     // 1 = Standard
    Serial.println("✅ Parameters configured. Waiting for stabilization...");
    delay(2000);  // Wait after setting params
    int ret = bmv080.setMode(SF_BMV080_MODE_CONTINUOUS);
    if (ret == true) {
    Serial.println("BMV080 set to continuous mode");
    } else {
    Serial.print("Error setting BMV080 mode. Code: ");
    Serial.println(ret);
    }
    int res = bmv080.setMode(SF_BMV080_MODE_DUTY_CYCLE);
    if (res) {
    Serial.println("✅ BMV080 set to duty-cycle mode");
    } else {
    Serial.print("❌ Failed to set duty-cycle mode. Code: ");
    Serial.println(res);
    }
    /* Set the sensor mode to continuous mode */
    if (bmv080.setMode(SF_BMV080_MODE_CONTINUOUS) == true)
    {
        Serial.println("BMV080 set to continuous mode");
    }
    else
    {
        Serial.println("Error setting BMV080 mode");
    }
}
void loop()
{
    if (bmv080.readSensor())
    {
        float pm10 = bmv080.PM10();
        float pm25 = bmv080.PM25();
        float pm1 = bmv080.PM1();
        Serial.print("PM10: ");
        Serial.print(pm10);
        Serial.print("\t");
        Serial.print("PM2.5: ");
        Serial.print(pm25);
        Serial.print("\t");
        Serial.print("PM1: ");
        Serial.print(pm1);
        if (bmv080.isObstructed() == true)
        {
            Serial.print("\tObstructed");
        }
        Serial.println();
    }
    delay(100);
}Metadata
Metadata
Assignees
Labels
No labels