1

I am trying to use (NDIR CO2 sensor Mikroelectronika) with Arduino Mega 2560 utilizing the Click shield.

Mikroelectronika provides libraries for their platform (likely proprietary), hence i have no idea how to manage to do this with arduino.

Here is the code I tried from the library page.

void application_init ( void )
{
log_cfg_t log_cfg;
ndirco2_cfg_t cfg;

//  Logger initialization.

log_cfg.level = LOG_LEVEL_DEBUG;
LOG_MAP_USB_UART( log_cfg );
log_init( &logger, &log_cfg );
log_info( &logger, "---- Application Init ----" );

//  Click initialization.

ndirco2_cfg_setup( &cfg );
NDIRCO2_MAP_MIKROBUS( cfg, MIKROBUS_1 );
ndirco2_init( &ndirco2, &cfg );

Delay_ms( 300 );

ndirco2_reset( &ndirco2 );
ndirco2_write_register( &ndirco2, NDIRCO2_AVERAGING_COUNT_REG, 0x03 );
ndirco2_set_mode( &ndirco2, NDIRCO2_CONTINUOUS_OP_MODE );
log_printf( &logger, "NDIR CO2 is initialized \r\n" );
Delay_ms( 200 ); 
}


void application_task ( )
{
uint16_t co2_data;

ndirco2_read_co2( &ndirco2, NDIRCO2_CHECK_EACH_MEASURE, &co2_data );
log_printf( &logger, "CO2 concentration is: %d ppm \r\n", co2_data );
}

The example for arduino is available here.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.