Hello,
I am trying to read pressure values from a Honeywell HSCSANN150PG2A3 using an Arduino Due. Right now my output to the serial monitor is an always either 6 or 134 in an there values returned seem to be almost random, as best as I can tell.
Right now I have ground connected to the first leg of the sensor, 3.3V connected to the second leg, SDA connected to the third leg, and SCL connected to the fourth leg. Everything is connected directly. (There is a picture of the sensor with the legs labeled on page 25 of the data sheet) If I understand correctly the Due SDA and SCL have internal pull-up resistors. So, I think this setup should be correct.
Here is my code:
// Arduino Due
// This script will get pressure values from a Honeywell HSCSANN150PG2A3 pressure sensor
// Include Wire I2C library
#include <Wire.h>
const int Pressure_Sensor_Address = 40; // 0x28 in hex
void setup() {
// Start serial communications
Serial.begin(9600);
// Create a wire object
Wire.begin();
}
void loop() {
// Start talking with pressure sensor
Wire.beginTransmission(Pressure_Sensor_Address);
// Ask for registor zero
Wire.write(0);
// End transmissor
Wire.endTransmission();
// Request 1 byte from address
Wire.requestFrom(Pressure_Sensor_Address, 1);
// Wait for response
while(Wire.available() == 0);
// Get pressure and read it into variable
int c = Wire.read();
// Print value
Serial.println(c);
delay(1000);
}
I am thinking I must be getting the data incorrectly or it needs to be interpreted somehow, but I can't seem to figure it out from the data sheet. Maybe I am asking for the wrong register or I need to request more bytes. I tried messing around with this, but it did not seem to help.
Here is the url of the data sheet: Safety and Productivity Solutions | Honeywell
Thank you! Any help is greatly appreciated.
Have a great Thanksgiving.