-
Notifications
You must be signed in to change notification settings - Fork 27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
BME688 gives constant humidity and gas readings #42
Comments
mihai-dinculescu
changed the title
BME688 100% humidity and constant gas reading
BME688 gives constant humidity and gas readings
Jan 12, 2022
Getting the same behavior with an Adafruit BME680 as well. Here's my code. fn main() -> anyhow::Result<()> {
esp_idf_sys::link_patches();
log::set_logger(&LOGGER).map(|()| LOGGER.initialize())?;
LOGGER.set_target_level("", log::LevelFilter::Debug);
let peripherals = Peripherals::take().context("failed to get peripherals")?;
let pins = peripherals.pins;
let mut delayer = delay::FreeRtos;
let i2c_config = <i2c::config::MasterConfig as Default>::default();
let i2c_master = i2c::Master::<i2c::I2C0, _, _>::new(
peripherals.i2c0,
i2c::MasterPins {
sda: pins.gpio23,
scl: pins.gpio22,
},
i2c_config,
)?;
let mut sensor: Bme680<_, FreeRtos> =
Bme680::init(i2c_master, &mut delayer, I2CAddress::Secondary).unwrap();
let settings = SettingsBuilder::new()
.with_humidity_oversampling(OversamplingSetting::OS16x)
.with_pressure_oversampling(OversamplingSetting::OS4x)
.with_temperature_oversampling(OversamplingSetting::OS8x)
.with_temperature_filter(IIRFilterSize::Size3)
.with_gas_measurement(Duration::from_millis(1500), 320, 25)
.with_temperature_offset(-2.2)
.with_run_gas(true)
.build();
let profile_dur = sensor.get_profile_dur(&settings.0).unwrap();
info!("Profile duration {:?}", profile_dur);
info!("Setting sensor settings");
sensor.set_sensor_settings(&mut delayer, settings).unwrap();
let sensor_settings = sensor.get_sensor_settings(settings.1);
info!("Sensor settings: {:?}", sensor_settings);
loop {
delayer.delay_ms(5 * 1000u32);
let power_mode = sensor.get_sensor_mode();
info!("Sensor power mode: {:?}", power_mode);
info!("Setting forced power modes");
sensor
.set_sensor_mode(&mut delayer, PowerMode::ForcedMode)
.unwrap();
// Something I've tried
// delayer.delay_ms(profile_dur.as_millis() as u32);
// Something else I've tried
// while sensor.get_sensor_mode().unwrap() == PowerMode::SleepMode {
// sensor
// .set_sensor_mode(&mut delayer, PowerMode::ForcedMode)
// .unwrap();
// }
let (data, _state) = sensor.get_sensor_data(&mut delayer).unwrap();
info!("Sensor Data {:?}", data);
info!("Temperature {}°C", data.temperature_celsius());
info!("Pressure {}hPa", data.pressure_hpa());
info!("Humidity {}%", data.humidity_percent());
info!("Gas Resistence {}Ω", data.gas_resistance_ohm());
}
} |
fenax
added a commit
to fenax/bme680
that referenced
this issue
Feb 2, 2022
Same behavior with and without #43 😭 Humidity seems to be correct when I remove :
Any ideas ? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Using an Adafruit BME688 with version 0.6.0 of this lib and the example code, I always get constant readings for humidity and gas.
Temperature and Pressure do slightly change and seem to be correct.
The text was updated successfully, but these errors were encountered: