Can't read data from pressure sensor.

I have a TruStability Pressure sensor (SSCDANT150PGAA5) and I want read the value in my arduino. I can’t get it to work and I have no idea what may be going wrong or how to fix it.

Below are the wiring and the code. Does anyone see anything wrong with my approach? What next steps should I take?

WIRING:

NAME Arduino SENSOR PIN

GND 1
+5V 2
SCLK 13 3
MISO 12 4
SS 10 5

CODE:
#include <SPI.h>

// pins used for the connection with the sensor
// the other you need are controlled by the SPI library):
const int dataReadyPin = 12;
const int chipSelectPin = 10;

void setup() {
Serial.begin(19200);

// start the SPI library:
SPI.begin();
SPI.setClockDivider(128);
// initalize the data ready and chip select pins:
pinMode(dataReadyPin, INPUT);
pinMode(chipSelectPin, OUTPUT);
digitalWrite(chipSelectPin,HIGH);

delay(100);
Serial.println("----------------------------");
Serial.println(" TEST PRESSURE SENSOR v4
");

Serial.println("----------------------------");
}

void loop()
{
digitalWrite(chipSelectPin, LOW);
delay(10);

int inByte_1 = SPI.transfer(0x00);
int inByte_2 = SPI.transfer(0x00);
int inByte_3 = SPI.transfer(0x00);
int inByte_4 = SPI.transfer(0x00);

Serial.print("Byte_1 = “);Serial.print(inByte_1,DEC);Serial.print(” ");
Serial.print("Byte_2 = “);Serial.print(inByte_2,DEC);Serial.print(” ");
Serial.print("Byte_3 = “);Serial.print(inByte_3,DEC);Serial.print(” ");
Serial.print("Byte_4 = “);Serial.print(inByte_4,DEC);Serial.print(” ");

float psi = inByte_1<<8|inByte_2;
psi = (psi*5)/16384;
Serial.print(“PRES = “);Serial.print(psi);Serial.print(”\n”);

inByte_3 = inByte_3<<3;
//float realTemp = ((float)inByte_3*200/2047)-50;
//Serial.print("Temp

= ");Serial.print(realTemp);Serial.print("\n");
  
  digitalWrite(chipSelectPin,HIGH);
  delay(1000); 
}

Do you have an oscilloscope available? If so, hook it up to the clock and data lines, and see whether the sensor is actually sending any data.
Does the sensor need to be configured in any way? You only tie the "master in" line to the sensor, meaning the Arduino can't send data to it. Without the data sheet of the sensor, we don't know whether that's correct, or whether you need to tell the sensor something (write register, etc) to make it work.

found this datasheet - http://datasheet.octopart.com/SSCDANT150PGAA5-Honeywell-datasheet-10376954.pdf -

If I interpret page 6 (bottom):

pin 1:  should be NC == not connected
pin 2:  +5V
pin 3:  Connect to an analog IN 
pin 4:  GND

(not checked this code

void setup()
{
  Serial.begin(115200);
  Serial.println("pressure sensor 0.01...");
}

void loop()
{
  int raw = 0;
  for int i=0; i<16; i++) raw += analogRead(A0);
  raw /=16;

  float cooked = cook(raw); 

  Serial.print("Pressure: ");
  Serial.print(raw);
  Serial.print("\t\t");
  Serial.print(cooked, 2);
}

//
// formula based upon figure 3 page 5 of the datasheet;  
// OK you can also use AREF connector to 3.3V, then this code changes a bit
//
float cook(int raw)
{
  float voltage = 5.0 * raw/1023;
  float percent = 100.0 * voltage/3.3;  

  // handle out of scope range
  if (percent < 10) return -1;
  if (percent > 90) return -2;

  float maxPressure=150.0;
  float minPressure= 0.0

  float pressure = fmap(percent, 10, 90, minPressure, maxPressure); // we map 10% to minPressure and 90% to maxPressure
  return pressure;
}

float fmap(float x, float in_min, float in_max, float out_min, float out_max)
{
  return (x - in_min) * (out_max - out_min) / (in_max - in_min) + out_min;
}

Hope this helps…

Where did you find the link that this was a SPI device?

Wow... That seems to work. I thought I had purchased an SPI device. It turns out it was just analog.

What units is the program supposed to be providing? I can't tell from the data sheet or the program.

When I run the program and nothing is connected to the sensor (just Colorado atmosphere), I get a raw value of 114 and a "cooked" value of 112. Any idea what units this could be?

Thanks!

Oops. that was a "cooked" value of 12.91. Same question though. 12.91 what?