upm  1.7.1
Sensor/Actuator repository for libmraa (v2.0.0)
Public Member Functions

Description for the RSC TruStability line. More...

Detailed Description

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.

upm::RSC rsc(0, 9, 8);
cout << "Sensor Name: " << rsc.getSensorName() << endl;
rsc.setMode(NORMAL_MODE);
rsc.setDataRate(N_DR_330_SPS);
while (shouldRun) {
cout << "inH2O pressure: " << rsc.getPressure() << endl;
cout << "Temp (C): " << rsc.getTemperature() << endl;
upm_delay(1);
}

Public Member Functions

 RSC (uint8_t bus, uint8_t cs_ee_pin, uint8_t cs_adc_pin)
 Default constructor for rsc. More...
 
 ~RSC ()
 
std::string getSensorName ()
 
std::string getSensorSerialNumber ()
 
float getPressureRange ()
 
float getMinimumPressure ()
 
std::string getPressureUnit ()
 
std::string getPressureType ()
 
uint8_t * getInitialADCState ()
 
void updateCoefficients ()
 
void setupADC (uint8_t *adc_init_values)
 
float getTemperature ()
 
float getPressure ()
 
void setMode (RSC_MODE mode)
 
void setDataRate (RSC_DATA_RATE dr)
 

Constructor & Destructor Documentation

RSC ( uint8_t  bus,
uint8_t  cs_ee_pin,
uint8_t  cs_adc_pin 
)

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
busSPI bus to use.
cs_ee_pinThe CS pin for accessing the EEPROM
cs_adc_pinThe CS pin for accessing the ADC
~RSC ( )

rsc destructor

Here is the call graph for this function:

Member Function Documentation

string getSensorName ( )

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

Returns
std::string sensor name

Here is the call graph for this function:

string getSensorSerialNumber ( )

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

Returns
std::string sensor serial number

Here is the call graph for this function:

float getPressureRange ( )

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
float Total sensor pressure range

Here is the call graph for this function:

float getMinimumPressure ( )

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
float Sensor minimum pressure

Here is the call graph for this function:

string getPressureUnit ( )

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:

  1. Pascal
  2. Kilo Pascal
  3. Mega Pascal
  4. PSI
  5. inH2O
  6. Bar
  7. milli Bar

This info can be retrieved from the EEPROM

Returns
std::string pressure units

Here is the call graph for this function:

string getPressureType ( )

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

  1. Differential
  2. Absolute
  3. Gauge
Returns
std::string sensor type

Here is the call graph for this function:

uint8_t * getInitialADCState ( )

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

Returns
std::string sensor type

Here is the call graph for this function:

void 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.

Here is the call graph for this function:

void setupADC ( uint8_t *  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_valuespointer to uint8_t array containing the initial ADC values

Here is the call graph for this function:

float getTemperature ( void  )

Function to get the compensated temperature value.

Returns
float compensated temperature value

Here is the call graph for this function:

float getPressure ( )

Function to get the compensated pressure value

Returns
float compensated pressure value

Here is the call graph for this function:

void setMode ( RSC_MODE  mode)

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

  1. Normal Mode - 256 KHz
  2. Fast Mode - 512 KHz
Returns
mode enum of type RSC_MODE

Here is the call graph for this function:

void setDataRate ( RSC_DATA_RATE  dr)

Function to set the data rate for the RSC sensor: Following are the different data rates available:

In Normal Mode

  1. 20 SPS
  2. 45 SPS
  3. 90 SPS
  4. 175 SPS
  5. 330 SPS
  6. 600 SPS
  7. 1000 SPS

In Fast Mode

  1. 40 SPS
  2. 90 SPS
  3. 180 SPS
  4. 350 SPS
  5. 660 SPS
  6. 1200 SPS
  7. 2000 SPS

SPS - Samples per Second

Returns
dr enum of type RSC_DATA_RATE

Here is the call graph for this function:


The documentation for this class was generated from the following files: