Electronic humidity sensors (hydrometer) measure humidity by measuring the capacitance or resistance of air samples. This sensor comes packaged with the BME280 integrated environmental unit, only available on MetaEnvironment boards, and is accessible through the HumidityBme280 interface.

import com.mbientlab.metawear.module.HumidityBme280;

final HumidityBme280 humidity; = board.getModule(HumidityBme280.class);


For humidity measurements, oversampling can be used to reduce the noise. Oversampling modes are set with setOversampling.

import com.mbientlab.metawear.module.HumidityBme280.OversamplingMode;

// set oversampling to 16x

Humidity Data

Relative humidity data is a float value from 0 to 100 percent and is represented as a forced data producer.

humidity.value().addRouteAsync(new RouteBuilder() {
    public void configure(RouteComponent source) { Subscriber() {
            public void apply(Data data, Object ... env) {
                Log.i("MainActivity", "Humidity = " + data.value(Float.class));
}).continueWith(new Continuation<Route, Void>() {
    public Void then(Task<Route> task) throws Exception {
        return null;