Connecting a Pressure Sensor and LCD to an Arduino

Hey,
I was working on a project that involved the connection of a digital pressure sensor with a LCD and Arduino board.

The LCD model is 1602 16x2 Character LCD Display Module HD44780 Controller Blue/Green screen blacklight LCD1602 LCD monitor 1602 5V.

The Arduino Board I am using is Arduino UNO R3 Compatible Atmega328P Board.

These are the details of the pressure sensor:
Company Name: Mouser Electronics
Mouser P/N: 785-SSCDRRN005PD2A3
Description: DIP, Dual Rad Barbed Honeywell Board Mount Pressure Sensor, Digital Output, I2C transmission, address 0x28, pressure +5psi to -5psi

Can anyone help me with the code for this project specifically the pressure sensor? I can't understand how to write the code for getting digital outputs?

I tried using the following website as well for the code for the pressure sensor but it doesn't work for some reason. I kept the connections and the code the same as on the website:
https://playground.arduino.cc/Main/HoneywellTruStabilitySSC-HSCPressureSensors

If someone could write out the code I would be highly grateful. Thank you!

P.S. I have also tried attaching the data sheet for the sensor for further review but it doesn't upload because the file is too big. Therefore, I am attaching a link to the pdf of the data sheet for my ssc sensor.

It's I2C so should connect to A4/A5, and you need pull-up resistors. Possibly level shifters if it's a 3.3V sensor.

Start with an I2C scanner, see if the sensor address shows up.

Then see if there's an Arduino library for it, install it, run the examples that usually come with it. Go from there.

Hey,
Thank you for the reply. I am done with the connections and installed the libraries as well. I also used the example code but my Arduino doesn't work for some reason even though, the code compiles. The code I am using is as follows:

#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

  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);

}

The main problem I am having is that I don't know how to take the digital pressure readings from the surrounding. I would appreciate if you could help me a bit on that. Thank you!

Can you anything in your serial monitor? Make sure it is on 115200 baudrate.

Tools --> serial monitor in the lower right corner you can set the baudrae

Hey,
I set the baudrae to 115200 and the serial monitor just prints start and then update. It does not print any subsequent readings. Thank you!

Do you see the address of the sensor show up when running an I2C scanner? If not, fix your wiring.

Then, does that library by chance have a .begin() function? Many do, and if it's there you'll need it to get the sensor to work.

Hey,
The address of the sensor shows up when I run the i2c Scanner. The code for the library is as follows:

#ifndef HONEYWELL_SSC_H
#define HONEYWELL_SSC_H

//  Author: Tomas Van Verrewegen <tomasvanverrewegen@telenet.be>
//  Version: 0.2

#include <Arduino.h>
#include <Wire.h>

class SSC
{
  public:

  enum Error
  {
    NoError                 = 0,
    ConnectionError         = 1,
    CommunicationError      = 2,
    NotRunningError         = 3,
    DiagnosticError         = 4,
    CommandModeError        = 5,
    ErrorMask               = 15
  };
  
  enum Flag
  {
    RunningFlag             = 128,
    FlagsMask               = ~ErrorMask
  };

  SSC(uint8_t address, uint8_t powerPin = 255);
  //uint8_t powerPin = 255
  uint8_t address() const { return a; }
  uint8_t powerPin() const { return q; }

  uint8_t error() const { return f & ErrorMask; }
  uint8_t flags() const { return f & FlagsMask; }

  bool isRunning() const { return f & RunningFlag; }
  
  //  minimum pressure of the sensor (in bar, Pascal, ...)
  float minPressure() const { return pmin; }
  void setMinPressure(float p) { pmin = p; }
  
  //  maximum pressure of the sensor (in bar, Pascal, ...)
  float maxPressure() const { return pmax; }
  void setMaxPressure(float p) { pmax = p; }
  
  //  minimum reading of the sensor (see datasheet)
  uint16_t minRaw() const { return rmin; }
  void setMinRaw(uint16_t raw) { rmin = raw; }

  //  maximum reading of the sensor (see datasheet)
  uint16_t maxRaw() const { return rmax; }
  void setMaxRaw(uint16_t raw) { rmax = raw; }
  
  //  return pressure and temperature
  uint16_t pressure_Raw() const { return p; }
  uint16_t temperature_Raw() const { return t; }
  float pressure() const { return rawToPressure(pressure_Raw()); }
  float temperature() const { return rawToTemperature(temperature_Raw()); }

  //  start / stop the device
  uint8_t start();
  uint8_t stop();
  
  //  update pressure and temperature
  uint8_t update();

  //  convert pressure and temperature
  float rawToPressure(uint16_t raw) const { return rawToPressure(raw, rmin, rmax, pmin, pmax); }
  static float rawToPressure(uint16_t raw, uint16_t rawMin, uint16_t rawMax, float pMin, float pMax) { return float(raw - rawMin) * (pMax - pMin) / (rawMax - rawMin) + pMin; }
  static float rawToTemperature(uint16_t raw) { return float(raw) * 0.097703957 - 50.0; }

  //  control the sensor from a stream
  uint8_t commandRequest(Stream& stream);

  private:
  
  uint8_t setError(uint8_t error) { f = (f & FlagsMask) | error; return error; }
  uint8_t commandReply(Stream& stream, uint8_t result) { stream.println(result); return result; }
  template<typename T> uint8_t commandReply(Stream& stream, uint8_t result, const T& data) { stream.println(data); return result; }
  
  uint8_t a;
  uint8_t q;
  uint8_t f;
  uint16_t p;
  uint16_t t;
  uint16_t rmin;
  uint16_t rmax;
  float pmin;
  float pmax;
};

#endif

I don't think there is a begin function present in the code for this library.

there are functions called start() and stop().

Hey,
The ssc start() function has already been called in the setup of the code and I don't need a stop() function as I want to measure the pressure continuously with a delay of 1s until I turn OFF the circuit manually myself.

Hi,
What address do you get on the scanner?

Thanks.. Tom.... :slight_smile:

Hey,
I got 0x28 as the address in the i2c scanner. That is what I put up in the Arduino code. But it still doesn't work.

Hi,
Can you please post a copy of your circuit, in CAD or a picture of a hand drawn circuit in jpg, png?

Thanks.. Tom.. :slight_smile: