Arduino Toolkit - 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