UPM

The UPM API is a high level sensor library for IoT devices using MRAA. See examples here. Back to index page.
SparkFun sensor images provided under CC BY-NC-SA-3.0.

AM2315 Class

Module: am2315

AM2315 by Measurement Specialties ( http://www.aosong.com/asp_bin/Products/en/AM2315.pdf ) is a digital humidity sensor with temperature output. RH reports between 0 and 100%, and the temperature range is -40 to +125 degC. The sampling period of this sensor is 2 seconds. Reads occurring more often than that return cached data.
am2315.jpeg

Methods

AM2315

(
  • bus
  • devAddr
)
Number

Instantiates an AM2315 object

Parameters:

  • bus Number

    Number of the used bus

  • devAddr Number

    Address of the used I2C device

Returns:

Number:

getHumidity

() Number

Gets the current measured humidity [RH]
Data is updated every 2 seconds - accesses occurring more often than that return cached data

Returns:

Number:

getTemperature

() Number

Gets the humidity cell temperature [degC]
Data is updated every 2 seconds - accesses occurring more often than that return cached data

Returns:

Number:

getTemperatureF

() Number

Gets the humidity cell temperature [degF]
Data is updated every 2 seconds - accesses occurring more often than that return cached data

Returns:

Number:

testSensor

() Number

Function intended to test the device and verify it is operating correctly.

Returns:

Number:

i2cWriteReg_32

(
  • reg
  • ival
)
Number

Writes a four-byte (32b) register
Note: these access routines are not the normal accesses to an I2C device. AM2315 contains a microcontroller that manages the actual readings. These handlers then make requests over I2C using a protocol defined by AM2315 .

Parameters:

  • reg Number

    Address of the register

  • ival Number

    32b value

Returns:

Number:

i2cWriteReg_16

(
  • reg
  • ival
)
Number

Writes a two-byte (16b) register

Parameters:

  • reg Number

    Address of the register

  • ival Number

    16b value

Returns:

Number:

i2cWriteReg_8

(
  • reg
  • ival
)
Number

Writes a one-byte (8b) register

Parameters:

  • reg Number

    Address of the register

  • ival Number

    8b value

Returns:

Number:

i2cReadReg_32

(
  • reg
)
Number

Reads a four-byte register

Parameters:

  • reg Number

    Address of the register

Returns:

Number:

i2cReadReg_16

(
  • reg
)
Number

Reads a two-byte register

Parameters:

  • reg Number

    Address of the register

Returns:

Number:

i2cReadReg_8

(
  • reg
)
Number

Reads a one-byte register

Parameters:

  • reg Number

    Address of the register

Returns:

Number: