9.15 Sensors

9.15.1 bme280

: bme280

BME280 pressure, temperature and humidity sensor

Methods

: obj = bme280(arObj)
: obj = bme280(arObj, propertyname, propertyvalue ....)

Constructor to create BME280 sensor

Inputs

arObj - the arduino parent object

propertyname, propertyvalue - optional property name, value pairs. Current known properties are: Current properties are:

I2CAddress

I2C address of the sensor (default 0x40)

Bus

I2C bus - 0 or 1 (default 0)

Outputs

obj - created object

Example

 
 a = arduino()
 sensor = bme280(a)
 
 
: [C, timestamp] = readTemperature(obj)

Read the temperature

Inputs

obj - the sensor object

Outputs

C - read temperature in deg C.

timestamp - timestamp when read

Example

 
 a = arduino()
 s = bme280(a)
 # get temp
 temp = s.readTemperature
 
 

See also: bme280.

: [relH, timestamp] = readHumidity(obj)

Read the relative humidity

Inputs

obj - the sensor object

Outputs

relH - relative humidity as a percentage (0 - 100.0)

timestamp - timestamp when read

: [P, timestamp] = readPressure(obj)

Read the pressure

Inputs

obj - the sensor object

Outputs

P - pressure reading from sensor.

timestamp - timestamp when read

: [readings, overrun] = read(obj)
: [P, H, C, timestamp, overrun] = read(obj)

Read the sensor data

Inputs

obj - the sensor object

Outputs

P - pressure reading from sensor.

H - humidity reading from sensor.

C - temperature reading from sensor.

timestamp - timestamp when read

overrun - overrun flag.

readings - table structure with fields for Timestamp, Pressure, Temperature and Humidity.

: inf = info(obj)

Read the sensor info

Inputs

obj - the sensor object

Outputs

inf - structure containing the sensor information.

Structure fields are:

Version

Chip firmware version

SensorId

sensor id value

Type

sensor type ’bme280’

Status

Status value read from sensor

: flush(obj)

Flush sensor data

Inputs

obj - the sensor object

Outputs

None

: release(obj)

Release the resources of the sensor

Inputs

obj - the sensor object

Outputs

None

9.15.2 bno055

: bno055

BNO055 9 axis orientation sensor

Methods

: obj = bno055(arObj)
: obj = bno055(arObj, propertyname, propertyvalue ....)

Constructor to create BME280 sensor

Inputs

arObj - the arduino parent object

propertyname, propertyvalue - optional property name, value pairs. Current known properties are: Current properties are:

I2CAddress

I2C address of the sensor (default 0x40)

Bus

I2C bus - 0 or 1 (default 0)

OperatingMode

Operating mode ’ndof’ or ’amg’

Outputs

obj - created object

Example

 
 a = arduino()
 sensor = bno055(a)
 
 
: [C, timestamp] = readTemperature(obj)

Read the temperature

Inputs

obj - the sensor object

Outputs

C - read temperature in deg C.

timestamp - timestamp when read

Example

 
 a = arduino()
 s = bno055(a)
 # get temp
 temp = s.readTemperature
 
 

See also: bno055.

: [readVal, timestamp] = readAcceleration(obj)

Read the acceleration rate

Inputs

obj - the sensor object

Outputs

readVal - the 3 acceleration values

timestamp - timestamp when read

: [readVal, timestamp] = readAngularVelocity(obj)

Read the angular velocity

Inputs

obj - the sensor object

Outputs

readVal - the 3 angular velocity values

timestamp - timestamp when read

: [readVal, timestamp] = readMagneticField(obj)

Read the magnetic field components

Inputs

obj - the sensor object

Outputs

readVal - the 3 magnetic field values

timestamp - timestamp when read

: [readVal, timestamp] = readOrientation(obj)

Read the oriientation components

Inputs

obj - the sensor object

Outputs

readVal - the 3 orientation values

timestamp - timestamp when read

: [readings, overrun] = read(obj)
: [accel, gyro, mag, timestamp, overrun] = read(obj)
: [accel, gyro, mag, orientation, timestamp, overrun] = read(obj)

Read the sensor data

Inputs

obj - the sensor object

Outputs

accel - acceleration reading from sensor.

gyro - angular acceleration reading from sensor.

mag - magnetic field reading from sensor.

orientation - orientation reading from sensor.

timestamp - timestamp when read

overrun - overrun flag.

readings - table structure with fields for Timestamp, Acceleration, AngularVelocity, MagneticField, Orientation.

: inf = readCalibrationStatus(obj)

Read the sensor calibration status

Inputs

obj - the sensor object

Outputs

status - structure containing the calibration information.

Structure fields are:

System

System calibrarion

Accelerometer

Accelerometer calibration status

Gyroscope

Gyroscope calibration status

Magnetometer

Magnetometer calibration status

Values for each will be either ’uncalibrated’, ’partial’ or ’full’.

: inf = info(obj)

Read the sensor info

Inputs

obj - the sensor object

Outputs

inf - structure containing the sensor information.

Structure fields are:

Version

Software firmware version

SensorId

sensor id value

Type

sensor type ’bno055’

: flush(obj)

Flush sensor data

Inputs

obj - the sensor object

Outputs

None

: release(obj)

Release the resources of the sensor

Inputs

obj - the sensor object

Outputs

None

9.15.3 lis3dh

: lis3dh

LIS3DH 3 degrees sensor

Methods

: obj = lis3dh(arObj)
: obj = lis3dh(arObj, propertyname, propertyvalue ....)

Constructor to create LIS3DH sensor

Inputs

arObj - the arduino parent object

propertyname, propertyvalue - optional property name, value pairs. Current known properties are: Current properties are:

I2CAddress

I2C address of the sensor (default 0x40)

Bus

I2C bus - 0 or 1 (default 0)

Outputs

obj - created object

Example

 
 a = arduino()
 sensor = lis3dh(a)
 
 
: [readVal, timestamp] = readAcceleration(obj)

Read the acceleration rate

Inputs

obj - the sensor object

Outputs

readVal - the 3 acceleration values

timestamp - timestamp when read

: [readings, overrun] = read(obj)
: [accel, timestamp, overrun] = read(obj)

Read the sensor data

Inputs

obj - the sensor object

Outputs

accel - acceleration reading from sensor.

timestamp - timestamp when read

overrun - overrun flag.

readings - table structure with fields for Timestamp, Acceleration.

: inf = info(obj)

Read the sensor info

Inputs

obj - the sensor object

Outputs

inf - structure containing the sensor information.

Structure fields are:

SensorId

sensor id value

Type

sensor type ’lis3dh’

Status

sensor status value

: flush(obj)

Flush sensor data

Inputs

obj - the sensor object

Outputs

None

: release(obj)

Release the resources of the sensor

Inputs

obj - the sensor object

Outputs

None

9.15.4 lps22hb

: lps22hb

LPS22HB absolute pressure and temperature sensor

Methods

: obj = lps22hb(arObj)
: obj = lps22hb(arObj, propertyname, propertyvalue ....)

Constructor to create LPS22HB sensor

Inputs

arObj - the arduino parent object

propertyname, propertyvalue - optional property name, value pairs. Current known properties are: Current properties are:

I2CAddress

I2C address of the sensor (default 0x5C)

Bus

I2C bus - 0 or 1 (default 0)

Outputs

obj - created object

Example

 
 a = arduino()
 sensor = lps22hb(a)
 
 
: [C, timestamp] = readTemperature(obj)

Read the temperature

Inputs

obj - the sensor object

Outputs

C - read temperature in deg C.

timestamp - timestamp when read

Example

 
 a = arduino()
 s = lps22hb(a)
 # get temp
 temp = s.readTemperature
 
 

See also: lps22hb.

: [P, timestamp] = readPressure(obj)

Read the pressure

Inputs

obj - the sensor object

Outputs

P - pressure reading from sensor.

timestamp - timestamp when read

: [readings, overrun] = read(obj)
: [P, C, timestamp, overrun] = read(obj)

Read the sensor data

Inputs

obj - the sensor object

Outputs

P - pressure reading from sensor.

C - temperature reading from sensor.

timestamp - timestamp when read

overrun - overrun flag.

readings - table structure with fields for Timestamp, Pressure, Temperature and Humidity.

: inf = info(obj)

Read the sensor info

Inputs

obj - the sensor object

Outputs

inf - structure containing the sensor information.

Structure fields are:

Version

Chip firmware version

SensorId

sensor id value

Type

sensor type ’lps22hb’

Status

Status value read from sensor

: flush(obj)

Flush sensor data

Inputs

obj - the sensor object

Outputs

None

: release(obj)

Release the resources of the sensor

Inputs

obj - the sensor object

Outputs

None

9.15.5 lsm6dso

: lsm6dso

LSM6DSO 6 degrees sensor

Methods

: obj = lsm6dso(arObj)
: obj = lsm6dso(arObj, propertyname, propertyvalue ....)

Constructor to create LSM6DSO sensor

Inputs

arObj - the arduino parent object

propertyname, propertyvalue - optional property name, value pairs. Current known properties are: Current properties are:

I2CAddress

I2C address of the sensor (default 0x40)

Bus

I2C bus - 0 or 1 (default 0)

Outputs

obj - created object

Example

 
 a = arduino()
 sensor = lsm6dso(a)
 
 
: [C, timestamp] = readTemperature(obj)

Read the temperature

Inputs

obj - the sensor object

Outputs

C - read temperature in deg C.

timestamp - timestamp when read

Example

 
 a = arduino()
 s = lsm6dso(a)
 # get temp
 temp = s.readTemperature
 
 

See also: lsm6dso.

: [readVal, timestamp] = readAcceleration(obj)

Read the acceleration rate

Inputs

obj - the sensor object

Outputs

readVal - the 3 acceleration values

timestamp - timestamp when read

: [readVal, timestamp] = readAngularVelocity(obj)

Read the angular velocity

Inputs

obj - the sensor object

Outputs

readVal - the 3 angular velocity values

timestamp - timestamp when read

: [readings, overrun] = read(obj)
: [accel, gyro, mag, timestamp, overrun] = read(obj)

Read the sensor data

Inputs

obj - the sensor object

Outputs

accel - acceleration reading from sensor.

gyro - angular acceleration reading from sensor.

timestamp - timestamp when read

overrun - overrun flag.

readings - table structure with fields for Timestamp, Acceleration, AngularVelocity.

: inf = info(obj)

Read the sensor info

Inputs

obj - the sensor object

Outputs

inf - structure containing the sensor information.

Structure fields are:

SensorId

sensor id value

Type

sensor type ’lsm6dso’

: flush(obj)

Flush sensor data

Inputs

obj - the sensor object

Outputs

None

: release(obj)

Release the resources of the sensor

Inputs

obj - the sensor object

Outputs

None

9.15.6 mpu6050

: mpu6050

MPU-6050 6 degrees sensor

Methods

: obj = mpu6050(arObj)
: obj = mpu6050(arObj, propertyname, propertyvalue ....)

Constructor to create MPU-6050 sensor

Inputs

arObj - the arduino parent object

propertyname, propertyvalue - optional property name, value pairs. Current known properties are: Current properties are:

I2CAddress

I2C address of the sensor (default 0x40)

Bus

I2C bus - 0 or 1 (default 0)

Outputs

obj - created object

Example

 
 a = arduino()
 sensor = mpu6050(a)
 
 
: [C, timestamp] = readTemperature(obj)

Read the temperature

Inputs

obj - the sensor object

Outputs

C - read temperature in deg C.

timestamp - timestamp when read

Example

 
 a = arduino()
 s = mpu6050(a)
 # get temp
 temp = s.readTemperature
 
 

See also: mpu6050.

: [readVal, timestamp] = readAcceleration(obj)

Read the acceleration rate

Inputs

obj - the sensor object

Outputs

readVal - the 3 acceleration values

timestamp - timestamp when read

: [readVal, timestamp] = readAngularVelocity(obj)

Read the angular velocity

Inputs

obj - the sensor object

Outputs

readVal - the 3 angular velocity values

timestamp - timestamp when read

: [readings, overrun] = read(obj)
: [accel, gyro, mag, timestamp, overrun] = read(obj)

Read the sensor data

Inputs

obj - the sensor object

Outputs

accel - acceleration reading from sensor.

gyro - angular acceleration reading from sensor.

timestamp - timestamp when read

overrun - overrun flag.

readings - table structure with fields for Timestamp, Acceleration, AngularVelocity.

: inf = info(obj)

Read the sensor info

Inputs

obj - the sensor object

Outputs

inf - structure containing the sensor information.

Structure fields are:

SensorId

sensor id value

Type

sensor type ’mpu6050’

: flush(obj)

Flush sensor data

Inputs

obj - the sensor object

Outputs

None

: release(obj)

Release the resources of the sensor

Inputs

obj - the sensor object

Outputs

None

9.15.7 si7021

: si7021

SI7021 temperature and humidity sensor

Methods

: obj = si7021(arObj)
: obj = si7021(arObj, propertyname, propertyvalue ....)

Constructor to create si7021 sensor

Inputs

arObj - the arduino parent object

propertyname, propertyvalue - optional property name, value pairs. Current known properties are: Current properties are:

I2Caddress

I2C address of the si7021 (default 0x40)

Bus

I2C bus (default 0)

Outputs

obj - created SI7020 object

Example

 
 a = arduino()
 sensor = si7021(a)
 
 
: [C, timestamp] = readTemperature(obj)

Read the temperature

Inputs

obj - the si7021 object

Outputs

C - read temperature in deg C.

timestamp - timestamp when read

Example

 
 a = arduino()
 s = si7021(a)
 # get temp
 temp = s.readTemperature()
 
 

See also: si7021.

: [relH, timestamp] = readHumidity(obj)

Read the relative humidity

Inputs

obj - the si7021 object

Outputs

relH - relative humidity as a percentage (0 - 100.0)

timestamp - timestamp when read

: [readings, overrun] = read(obj)
: [H, C, timestamp, overrun] = read(obj)

Read the sensor data

Inputs

obj - the si2071 sensor object

Outputs

H - humidity reading from sensor.

C - temperature reading from sensor.

timestamp - timestamp when read

overrun - overrun flag.

readings - table structure with fields for Timestamp, Temperature and Humidity.

: relH = info(dsObj)

Read the sensor info

Inputs

dsObj - the si7021 object

Outputs

inf - structure containing the sensor information.

Structure fields are:

Version

Chip firmware version

SensorDd

sensor id value

Type

String for detected chip type

: flush(obj)

Flush sensor data

Inputs

obj - the sensor object

Outputs

None

: release(obj)

Release the resources of the sensor

Inputs

obj - the sensor object

Outputs

None


Next: Test Functions, Previous: Matlab Compatability Classes, Up: Function Reference   [Contents][Index]