ultralowpress 2.0.0.0
Main Page

Ultra-Low Press click

‍Ultra-Low Press Click is a compact add-on board containing a mountable gage pressure sensor for pneumatic pressure measurements.

click Product page


Click library

  • Author : Luka Filipovic
  • Date : May 2021.
  • Type : I2C type

Software Support

We provide a library for the UltraLowPress Click as well as a demo application (example), developed using MikroElektronika compilers. The demo can run on all the main MikroElektronika development boards.

Package can be downloaded/installed directly from NECTO Studio Package Manager(recommended way), downloaded from our LibStock™ or found on Mikroe github account.

Library Description

‍This library contains API for UltraLowPress Click driver.

Standard key functions :

Example key functions :

Example Description

‍This application reads the serial number of the sensor. If there were

no errors it continues reading temperature and pressure data from the sensor.

The demo application is composed of two sections :

Application Init

‍Initializes host communication(UART and I2C). Reads devices serial number and logs it.

void application_init ( void )
{
log_cfg_t log_cfg;
ultralowpress_cfg_t ultralowpress_cfg;
LOG_MAP_USB_UART( log_cfg );
log_init( &logger, &log_cfg );
log_info( &logger, " Application Init " );
// Click initialization.
ultralowpress_cfg_setup( &ultralowpress_cfg );
ULTRALOWPRESS_MAP_MIKROBUS( ultralowpress_cfg, MIKROBUS_1 );
err_t init_flag = ultralowpress_init( &ultralowpress, &ultralowpress_cfg );
if ( init_flag == I2C_MASTER_ERROR )
{
log_error( &logger, " Application Init Error. " );
log_info( &logger, " Please, run program again... " );
for ( ; ; );
}
//Serial number of sensor read
uint16_t temp_read = 0;
uint32_t serial_read = 0;
init_flag = ultralowpress_generic_read( &ultralowpress, ULTRALOWPRESS_REG_SERIAL_NUM_H, &temp_read );
serial_read = temp_read;
serial_read <<= 16;
init_flag |= ultralowpress_generic_read( &ultralowpress, ULTRALOWPRESS_REG_SERIAL_NUM_L, &temp_read );
serial_read |= temp_read;
if ( init_flag < 0 )
{
log_error( &logger, " Read" );
for ( ; ; );
}
else
{
log_printf( &logger, " > Serial number: 0x%.8LX\r\n", serial_read );
}
Delay_ms ( 1000 );
log_info( &logger, " Application Task " );
}
#define ULTRALOWPRESS_MAP_MIKROBUS(cfg, mikrobus)
MikroBUS pin mapping.
Definition ultralowpress.h:124
#define ULTRALOWPRESS_REG_SERIAL_NUM_L
Definition ultralowpress.h:78
#define ULTRALOWPRESS_REG_SERIAL_NUM_H
Definition ultralowpress.h:79
err_t ultralowpress_generic_read(ultralowpress_t *ctx, uint8_t reg, uint16_t *rx_data)
Reading function.
void application_init(void)
Definition main.c:29

Application Task

‍Checks if data is available. When it's available it reads the temperature

and pressure data from the sensor and logs it.

void application_task ( void )
{
if ( ultralowpress_ready_to_read( &ultralowpress ) )
{
ultralowpress_clear_status( &ultralowpress );
float temp = ultralowpress_get_temp( &ultralowpress );
float press = ultralowpress_get_press( &ultralowpress );
log_printf( &logger, " > Temperature[ C ]: %.2f\r\n > Pressure[ Pa ]: %.2f\r\n", temp, press );
}
Delay_ms ( 100 );
}
void ultralowpress_clear_status(ultralowpress_t *ctx)
Clear status.
void application_task(void)
Definition main.c:81

The full application code, and ready to use projects can be installed directly from NECTO Studio Package Manager(recommended way), downloaded from our LibStock™ or found on Mikroe github account.

Other Mikroe Libraries used in the example:

  • MikroSDK.Board
  • MikroSDK.Log
  • Click.UltraLowPress

Additional notes and informations

Depending on the development board you are using, you may need USB UART click, USB UART 2 Click or RS232 Click to connect to your PC, for development systems with no UART to USB interface available on the board. UART terminal is available in all MikroElektronika compilers.