oximeter3 2.0.0.0
Main Page

Oximeter 3 click

Oximeter 3 Click is a compact add-on board perfectly suited for measuring the blood oxygen saturation.

click Product page


Click library

  • Author : MikroE Team
  • Date : Sep 2020.
  • Type : I2C type

Software Support

We provide a library for the Oximeter3 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 form compilers IDE(recommended way), or downloaded from our LibStock, or found on mikroE github account.

Library Description

‍This library contains API for Oximeter3 Click driver.

Standard key functions :

  • Config Object Initialization function.

    ‍void oximeter3_cfg_setup ( oximeter3_cfg_t *cfg );

    - Initialization function.

    ‍OXIMETER3_RETVAL oximeter3_init ( oximeter3_t *ctx, oximeter3_cfg_t *cfg );

    Example key functions :

  • Generic read function.

    ‍uint8_t oximeter3_generic_read ( oximeter3_t *ctx, uint8_t reg );

    - Gets state of the int pin

    ‍uint8_t oximeter3_get_int_status ( oximeter3_t *ctx );

  • Generic function for reading als and proximity values

    ‍uint16_t oximeter3_read_value ( oximeter3_t *ctx, uint8_t type_macro );

    Examples Description

‍This example demonstrates the use of Oximeter 3 Click board.

The demo application is composed of two sections :

Application Init

‍Initializes the driver, checks the device ID then configures the device for the selected mode.

void application_init ( void )
{
log_cfg_t log_cfg;
uint8_t dev_status;
LOG_MAP_USB_UART( log_cfg );
log_init( &logger, &log_cfg );
log_info( &logger, "---- Application Init ----" );
// Click initialization.
OXIMETER3_MAP_MIKROBUS( cfg, MIKROBUS_1 );
oximeter3_init( &oximeter3, &cfg );
dev_status = oximeter3_generic_read( &oximeter3, OXIMETER3_REG_PRODUCT_ID );
if ( dev_status != OXIMETER3_ID_VAL )
{
log_printf( &logger, " ***** ERROR! ***** \r\n" );
for ( ; ; );
}
{
}
else
{
}
log_printf( &logger, " ***** APP TASK ***** \r\n" );
}
#define OXIMETER3_HEART_RATE
Definition oximeter3.h:223
#define OXIMETER3_CMD_ALS_PERIODIC_MEASUREMENT_ENABLE
Definition oximeter3.h:119
#define OXIMETER3_CMD_MEASUREMENT_ENABLE
Definition oximeter3.h:123
#define OXIMETER3_CMD_PROX_PERIODIC_MEASUREMENT_ENABLE
Definition oximeter3.h:121
#define OXIMETER3_CMD_MEASUREMENT_DISABLE
Definition oximeter3.h:124
#define OXIMETER3_ID_VAL
Definition oximeter3.h:214
#define OXIMETER3_INT_STATUS_PROX
Definition oximeter3.h:194
#define OXIMETER3_LED_CURR_MIN
Definition oximeter3.h:148
#define OXIMETER3_LED_CURR_MID
Definition oximeter3.h:149
#define OXIMETER3_MAP_MIKROBUS(cfg, mikrobus)
Definition oximeter3.h:66
#define OXIMETER3_PROX_RATE_250_MPS
Definition oximeter3.h:141
#define OXIMETER3_PROX_TIMING_FREQ_390p625_KHZ
Definition oximeter3.h:204
#define OXIMETER3_PROX_TIMING_FREQ_3p125_MHZ
Definition oximeter3.h:207
void oximeter3_generic_write(oximeter3_t *ctx, uint8_t reg, uint8_t data_buf)
Generic write function.
uint8_t oximeter3_generic_read(oximeter3_t *ctx, uint8_t reg)
Generic read function.
void oximeter3_cfg_setup(oximeter3_cfg_t *cfg)
Config Object Initialization function.
OXIMETER3_RETVAL oximeter3_init(oximeter3_t *ctx, oximeter3_cfg_t *cfg)
Initialization function.
#define OXIMETER3_REG_COMMAND
Definition oximeter3.h:93
#define OXIMETER3_REG_PROX_RATE
Definition oximeter3.h:95
#define OXIMETER3_REG_PROX_MODULATOR_TIMING
Definition oximeter3.h:108
#define OXIMETER3_REG_LED_CURRENT
Definition oximeter3.h:96
#define OXIMETER3_REG_PRODUCT_ID
Definition oximeter3.h:94
#define OXIMETER3_REG_INTERRUPT_CTRL
Definition oximeter3.h:102
void application_init(void)
Definition main.c:41
uint8_t dev_mode
Definition main.c:35
Click configuration structure definition.
Definition oximeter3.h:261

Application Task

‍Depending on the selected mode it reads heart rate data (OXIMETER3_HEART_RATE mode) or values of proximity and ambient light sensor (OXIMETER3_PROX or OXIMETER3_ALS modes). All data is being logged on USB UART where you can track their changes.

void application_task ( void )
{
{
if( !oximeter3_get_int_status( &oximeter3 ) )
{
if ( rd_val > 10000 )
{
log_printf( &logger, "%u\r\n", rd_val );
counter = 2500;
}
else if ( counter > 2500 )
{
log_printf( &logger, "Please place your index finger on the sensor.\r\n" );
counter = 0;
}
}
}
{
if( !oximeter3_get_int_status( &oximeter3 ) )
{
log_printf( &logger, " * Proximity: %u \r\n", rd_val );
log_printf( &logger, " * ALS: %u \r\n", rd_val );
log_printf( &logger, "******************** \r\n" );
Delay_ms ( 500 );
}
}
}
#define OXIMETER3_ALS
Definition oximeter3.h:221
#define OXIMETER3_PROX
Definition oximeter3.h:222
uint8_t oximeter3_get_int_status(oximeter3_t *ctx)
Gets state of the int pin.
uint16_t oximeter3_read_value(oximeter3_t *ctx, uint8_t type_macro)
Generic function for reading als and proximity values.
#define OXIMETER3_REG_INTERRUPT_STATUS
Definition oximeter3.h:107
void application_task(void)
Definition main.c:109
uint16_t rd_val
Definition main.c:36
uint16_t counter
Definition main.c:37

Note

‍In the case of heart rate, please use a Serial Plot application for data plotting.

The full application code, and ready to use projects can be installed directly form compilers IDE(recommneded) or found on LibStock page or mikroE GitHub accaunt.

Other mikroE Libraries used in the example:

  • MikroSDK.Board
  • MikroSDK.Log
  • Click.Oximeter3

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. The terminal available in all Mikroelektronika compilers, or any other terminal application of your choice, can be used to read the message.