Ambient Light Sensor

Ambient light sensors convert light intensity into a digital signal using a combination of photodiodes and analog-to-digital converters. The light sensor of choice on select boards is the LTR-329ALS device from Lite-On, represented by the AmbientLightLtr329 interface.

import com.mbientlab.metawear.module.AmbientLightLtr329;

final AmbientLightLtr329 alsLtr329 = board.getModule(AmbientLightLtr329.class);


The sensor has three configurable parameters, set with the module’s ConfigEditor class:

Parameter Description
Gain Controls data range and resolution
Integration Time Measurement time for each cycle
Measurement Rate How frequently to update illuminance data
import com.mbientlab.metawear.module.AmbientLightLtr329.*;

// Set the gain to 8x
// Set integration time to 250ms
// Set measurement rate to 50ms

Illuminance Data

Illuminance data is categorized as an async data producer; data is interpreted as a float value and is in units of lux (lx).

alsLtr329.illuminance().addRouteAsync(new RouteBuilder() {
    public void configure(RouteComponent source) { Subscriber() {
            public void apply(Data data, Object... env) {
                Log.i("MainActivity", String.format(Locale.US, "illuminance = %.3f lx".
}).continueWith(new Continuation<Route, Void>() {
    public Void then(Task<Route> task) throws Exception {
        return null;