I2C_ASDX

July 30, 2026 ยท View on GitHub

Arduino CI Arduino-lint JSON check GitHub issues

License: MIT GitHub release PlatformIO Registry

I2C_ASDX

Arduino library for I2C ASDX pressure sensor.

Description

The ASDX sensor of Honeywell exists in many variations. Check the datasheet of your type for all the details.

The I2C_ASDX library can read the sensor and give the pressure in millibar, bar or PSI or many other units. See below.

Pressure is measured in 14 bit = 16384 "steps", from which 80% is actually used.

Feedback, as always, is welcome.

0.4.0 Breaking change

Version 0.4.0 introduced a breaking change. You cannot set the pins in begin() any more. This reduces the dependency of processor dependent Wire implementations. The user has to call Wire.begin() and can optionally set the Wire pins before calling begin().

Hardware connection

Always check datasheet for the exact pins.

        ASDX              ARDUINO
    +----------+        +----------+
    |          |        |          |
    |     GND o|--------|o GND     |
    |     VCC o|--------|o VCC     |
    |     SDA o|--------|o SDA     |
    |     SCL o|--------|o SCL     |
    |          |        |          |
    +----------+        +----------+

Pressure sensors:

Other:

I2C

I2C multiplexing

Sometimes you need to control more devices than possible with the default address range the device provides. This is possible with an I2C multiplexer e.g. TCA9548 which creates up to eight channels (think of it as I2C subnets) which can use the complete address range of the device.

Drawback of using a multiplexer is that it takes more administration in your code e.g. which device is on which channel. This will slow down the access, which must be taken into account when deciding which devices are on which channel. Also note that switching between channels will slow down other devices too if they are behind the multiplexer.

Interface

#include "I2C_ASDX.h"

Constructor

  • I2C_ASDX(uint8_t address, uint8_t psi, TwoWire *wire = &Wire) Constructor, I2C address and maximum pressure. Optional the wire interface can be defined.
  • bool begin() initializes internals. Returns true if the address can be found on the I2C bus.
  • void reset() resets the internal variables, including pressure.
  • bool isConnected() tests if the address can be found on the I2C bus.
  • uint8_t getAddress() returns the I2C address used. Mainly for debug message.

Read

Before any call to getPressure() one need to call read() unless one wants the last value read.

  • int read() actually reads the sensor, checks for errors, calculates the pressure and set the lastRead timestamp. Returns I2C_ASDX_OK or an error code.

Units

  • int getPressure() returns the last read pressure in milliBar. (rounded integer!). Returns 0 after a reset() and no read() done yet. Calling getPressure() (Or any of the other pressure functions) multiple times without read() will return the same value again.
  • float getMilliBar() returns pressure in milliBar (float).
  • float getBar() returns pressure in bar.
  • float getPSI() returns pressure in PSI = Pounds per Square Inch.
  • float getATM() returns pressure in Atmosphere.
  • float getDynes() returns pressure in Dynes.
  • float getInchHg() returns pressure in inches mercury.
  • float getInchH2O() returns pressure in inches water.
  • float getPascal() returns pressure in Pascal. Note this is the SI unit.
  • float getTORR() returns pressure in TORR.
  • float getCmHg() returns pressure in centimetre mercury.
  • float getCmH2O() returns pressure in centimetre water.
  • float getMSW() returns pressure in Meters of Sea Water. (under water pressure unit).

Related library: https://github.com/RobTillaart/pressure additional conversions.

State

  • uint16_t errorCount() total counter for the number of errors occurred. The internal counter wraps to zero after 65535 errors.
  • uint32_t lastRead() time in milliseconds of last successful read of the sensor.
  • int state() last known state of read, also returned by read()
statemeaning
I2C_ASDX_OKno error
I2C_ASDX_INITbegin() not called
I2C_ASDX_READ_ERRORI2C error
I2C_ASDX_C000_ERRORsensor error
I2C_ASDX_CONNECT_ERRORI2C error

Debugging

Raw counter API, for debugging, your own conversion or efficient storage and comparison.

  • int rawPressureCount() idem.
    1638  =   0 PSI
    14746 = max PSI (type dependant)

Testing

The library is tested with only 3 different sensors, all of the PG type.

Code is prepared but not tested for 15, 5 and 1 PSI too.

    ID    UNIT       TYPE   DESCRIPTION
                              output is proportional to difference
    PG    PSI        Gage   * between applied pressure and atmospheric pressure
    MG    mBar       Gage   * idem
    BG    Bar        Gage   * idem
    KG    KiloPascal Gage   * idem
     D    Differential      * between pressure applied to each of the ports.
     A    Absolute          * between applied pressure and built-in reference to vacuum.


    ADDRESS   PRESSURE   RANGE          TYPE      P   A T V
    0x58      100 psi    0..6895 mBar   SSCDANN 100PG 5 A 5
    0x38       60 psi    0..4137 mbar   SSCDANN 060PG 3 A 5
    0x28       30 psi    0..2068 mbar   SSCDANN 030PG 2 A 5

    P = pressure range
    A = I2C address indicator
    T = accuracy range
    V = voltage (3 volt also supported, not tested)

That said it is expected that the library is modifiable to support many more as long as they have the following raw read values.

    1638  =   0 PSI
    14746 = max PSI

Tested types

Type numberresultnotes
SSCDANN 100PG 5A5OKtype A 10% - 90% only
SSCDANN 060PG 3A5OK
SSCDANN 030PG 2A5OK

(elaborate test table)

Operation

See examples

Future

Must

  • update documentation.
  • keep in sync with MS4525DO_RT

Should

  • int begin(float psi) to allow calibration or even arbitrary units.
    • return state?

Could

  • add real life examples if possible.
  • add error/state code for after reset() and before read()
    • I2C_ASDX_NO_READ or I2C_ASDX_RESET
    • I2C_ASDX_NOT_INIT if begin() not called?
  • C000 error => OVF ERROR (like MS4525?)

Wont

  • pressure in N/m2 => pitot formula. v = sqrt(2 * pressure / rho);
    • rho is specific weight in kg/m3, depends on humidity temperature and height.
  • remove less common pressure formats from lib (0.4.x ?)
    • are covered in pressure lib.
    • but they do no harm either.
  • move code from .h to .cpp

Support

If you appreciate my libraries, you can support the development and maintenance. Improve the quality of the libraries by providing issues and Pull Requests, or donate through PayPal or GitHub sponsors.

Thank you,