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.

RSC Class

Module: rsc

The RSC Series is a piezoresistive silicon pressure sensor offering a digital output for reading pressure over the specified full scale pressure span and temperature range. It is calibrated and temperature compensated for sensor offset, sensitivity, temperature effects, and non-linearity using a 24-bit analog-todigital converter with integrated EEPROM. Pressure data may be acquired at rates between 20 and 2000 samples per second over an SPI interface. It is intended for use with non-corrosive, non-ionic gases, such as air and other dry gases, designed and manufactured according to ISO 9001 standards, and is REACH and RoHS compliant.
Most of the functionality available on this chip has been implemented. The driver calculates the compensated pressure and temperature values based on the information provided in the datasheet. The user must not mess around with the coefficient and adc init value readings from the EEPROM as these are used to calculate the compensated pressure and temperature values.
In order to get the sensor to work properly on an Edison, you would need to turn off the Edison SPI power management, this can be done with the command: echo on > /sys/devices/pci0000:00/0000:00:07.1/power/control
You might have to use external pull up resistors on all the lines. More info about this has been provided in the datasheet with a table and a diagram.

Methods

RSC

(
  • bus
  • cs_ee_pin
  • cs_adc_pin
)
Number

This device supports SPI. The sensor has two chip select pins since there are two ways to access content on the sensor - EEPROM/ADC. We will not be using the SPI CS here because that would work for all SPI operations. Hence, you are expected to initialize any 2 gpio pins for CS by providing the pin numbers.

Parameters:

  • bus Number

    SPI bus to use.

  • cs_ee_pin Number

    The CS pin for accessing the EEPROM

  • cs_adc_pin Number

    The CS pin for accessing the ADC

Returns:

Number:

getSensorName

() String

This function provides the sensor name as a string to the user.

Returns:

String:

std::string sensor name

getSensorSerialNumber

() String

This function provides the sensor serial number as a string to the user.

Returns:

String:

std::string sensor serial number

getPressureRange

() Number

This function provides the pressure range which the sensor can read out. This will vary for the different kinds of RSC sensors. This value is read from the EEPROM

Returns:

Number:

float Total sensor pressure range

getMinimumPressure

() Number

This function provides the minimum pressure which the sensor can read out. This will vary for the different kinds of RSC sensors. This value is read from the EEPROM

Returns:

Number:

float Sensor minimum pressure

getPressureUnit

() String

This function gets the units that the particular RSC sensor being used reads out the pressure data in. Following are the possible units data can be read out in:
This info can be retrieved from the EEPROM

Returns:

String:

std::string pressure units

getPressureType

() String

Function returns the type of RSC pressure sensor being used. This info is available in the EEPROM. Types:

Returns:

String:

std::string sensor type

getInitialADCState

() Uint8_t *

Function returns the initial state that the ADC registers need to be set to. This info is retrieved from the EEPROM.

Returns:

Uint8_t *:

std::string sensor type

updateCoefficients

()

Function used to update the coefficients. This function doesn't return the coefficent values. Intstead, it updates the 2-D array with the coefficient values read from the EEPROM. This function is mostly for internal use only.

setupADC

(
  • adc_init_values
)

Function used to set up the ADC with the initial values of the ADC registers read from the EEPROM.

Parameters:

  • adc_init_values Uint8_t *

    pointer to uint8_t array containing the initial ADC values

getTemperature

() Number

Function to get the compensated temperature value.

Returns:

Number:

float compensated temperature value

getPressure

() Number

Function to get the compensated pressure value

Returns:

Number:

float compensated pressure value

setMode

(
  • mode
)

Function to set the mode for the RSC sensor: There are 2 types of modes available:

Parameters:

  • mode RSC_MODE

    undefined

setDataRate

(
  • dr
)

Function to set the data rate for the RSC sensor: Following are the different data rates available:
In Normal Mode
In Fast Mode
SPS - Samples per Second

Parameters:

  • dr RSC_DATA_RATE

    undefined