TruStability High Accuracy Silicon Ceramic (HSC) Series and Standard Accuracy Silicon Ceramic (SSC) Series are piezoresistive silicon pressure sensors offering a digital output for reading pressure over the specified full scale pressure span and temperature range. They are available in standard pressure ranges from 1 psi to 150 psi (60 mbar to 10 bar) and are intended for use with non-corrosive, non-ionic gases, such as air and other dry gases. The liquid media option extends the performance of these sensors to con-corrosive, non-ionic liquids.
The library uses I2C to connect to the sensor (see the Wire library). SPI can also be used (with some sensors, see datasheet), but is not implemented in this library.
If you have multiple devices connected to the I2C bus, remember that this device screws up the bus when it is not powered. One solution is to keep the device powered all the time. Another possible solution is to add an analog switch to physically disconnect the GND and Vsupply line or SCL and SDA line to the device. This needs more testing.
Check your sensor before you begin: some of them work with 3.3V some with 5V.
This library has been tested, but might still contain bugs, so please be careful.
Bugs, suggestions, comments are always welcome here.
Components:
#include <SSC.h>
// create an SSC sensor with I2C address 0x78 and power pin 8.
SSC ssc(0x78, 8);
void setup()
{
Serial.begin(115200);
Wire.begin();
// set min / max reading and pressure, see datasheet for the values for your sensor
ssc.setMinRaw(0);
ssc.setMaxRaw(16383);
ssc.setMinPressure(0.0);
ssc.setMaxPressure(1.6);
// start the sensor
Serial.print("start()\t\t");
Serial.println(ssc.start());
}
void loop()
{
// update pressure / temperature
Serial.print("update()\t");
Serial.println(ssc.update());
// print pressure
Serial.print("pressure()\t");
Serial.println(ssc.pressure());
// print temperature
Serial.print("temperature()\t");
Serial.println(ssc.temperature());
delay(5000);
}
Available commands:
#include <Wire.h>
#include <SSC.h>
// create an SSC sensor with I2C address 0x78 and power pin 8.
SSC ssc(0x78, 8);
void setup()
{
Serial.begin(115200);
Wire.begin();
// set min / max reading and pressure, see datasheet for the values for your sensor
ssc.setMinRaw(0);
ssc.setMaxRaw(16383);
ssc.setMinPressure(0.0);
ssc.setMaxPressure(1.6);
// start the sensor
ssc.start();
}
void loop()
{
while(Serial.available()) {
hih.commandRequest(Serial);
}
delay(100);
}