Device Compatibility

Available Sensors

temperature, humidity, pressure, uv, gyroscope, accelerometer


You should have familiarity with Configuration Files before exploring further.

When downloading an app from the MATRIX App Store, End users must explicitly authorize MOS applications to utilize hardware sensors.

This requires that each application to identify the sensors it requires in config.yaml. Sensors will not work unless this is specified. Below is an example for an app that requires the temperature and humidity sensor.

  - temperature
  - humidity

Reading Sensors

All sensors are initialized using the sensor method. This method should only be used once per sensor. Once called, your can use a .then promise to initiate a callback.

matrix.sensor(sensorType, options);
  • sensorType: Type of sensor you are initializing
  • options: The options for that sensor. All sensors support a refresh and timeout property.
// Example
var temperatureValue = 0; // global variable to hold sensor value
var humidityValue = 0; // global variable to hold humidity value

// Sensor options
var options = {
  refresh: 1000, // milliseconds between data points
  timeout: 10000 // how long before stopping this sensor

// Begin calling temperature sensor
matrix.sensor('temperature', options).then(data => {
  temperatureValue = data.value; // update global variable
  console.log(temperatureValue); // print new temperature value

// Begin calling humidity sensor
matrix.sensor('humidity', options).then(data => {
  humidityValue = data.value; // update global variable
  console.log(humidityValue); // print new humidity value


Below are all the possible data formats for each sensor.


Output for temperature (in ℃).

  value: 36.95899963378906,
  type: 'temperature'


Output for humidity.

  value: 30.409704208374023,
  type: 'humidity'


Output for pressure (in mbars).

  value: 101692,
  type: 'pressure'


Output for UV.

   value: 0.0053547522984445095,
   risk: 'Low'


Output for gyroscope.

  yaw: 144.78964233398438,
  pitch: 2.112252950668335,
  roll: -92.0414810180664,
  x: -10.78155517578125,
  y: 1.8841552734375,
  z: 0.441131591796875,
  type: 'gyroscope'


Output for accelerometer

  x: 0.1,
  y: 0.23,
  z: 0.224,
  type: 'accelerometer'


Output for magnetometer

  x: 0.51,
  y: 0.53,
  z: -0.124,
  type: 'magnetometer'