Discover the versatility of barometers in diverse fields, from agriculture to aviation, as they contribute to efficiency and precision in a wide range of applications
A
A
Hardware Overview
How does it work?
Barometer 4 Click is based on the ICP-10111, an ultra-low power, low noise, digital output barometric pressure and temperature sensor from TDK InvenSense. It is based on an innovative MEMS capacitive pressure sensor technology that can measure pressure from 30kPa up to 110kPa with an accuracy of ±1Pa over a wide operating temperature range at the industry’s lowest power. This high-accuracy MEMS capacitive pressure sensor can also measure altitude differentials down to 8.5cm without the penalty of increased power consumption or reduced sensor throughput. The ICP-10111 also offers industry-leading temperature stability of the pressure sensor with a temperature coefficient offset of
±0.5Pa/°C. The high accuracy, temperature stability, and low power consumption offered by ICP-10111 make it ideally suited for applications such as drone flight control and stabilization, indoor/outdoor navigation, sports and fitness activity monitoring, and battery-powered IoT. The ICP-10111 also requires a supply voltage of 1.8V to work regularly. Therefore, a small LDO regulator, BH18PB1WHFV from Rohm Semiconductor, provides 1.8V out of mikroBUS™ power rails. This LDO cuts power consumption by lowering its current consumption to approximately 2μA when the application operates in the Standby state. Barometer 4 Click communicates with MCU using a standard I2C 2-Wire interface that supports
400kHz Fast Mode operation. Since the sensor for operation requires a 1.8V logic voltage level only, this Click board™ also features the PCA9306 voltage-level translator from Texas Instruments. The I2C interface bus lines are routed to the dual bidirectional voltage-level translator, allowing this Click board™ to work properly with both 3.3V and 5V MCUs. This Click board™ can operate with either 3.3V or 5V logic voltage levels selected via the VCC SEL jumper. This way, both 3.3V and 5V capable MCUs can use the communication lines properly. Also, this Click board™ comes equipped with a library containing easy-to-use functions and an example code that can be used as a reference for further development.
Features overview
Development board
Clicker 2 for PIC18FJ is a compact starter development board that brings the flexibility of add-on Click boards™ to your favorite microcontroller, making it a perfect starter kit for implementing your ideas. It comes with an onboard 8-bit PIC microcontroller, the PIC18F87J50 from Microchip, two mikroBUS™ sockets for Click board™connectivity, a USB connector, LED indicators, buttons, a mikroProg connector, and two 26-pin headers for interfacing with external electronics. Its compact design with clear and easily recognizable silkscreen markings allows you to build gadgets with unique functionalities and features quickly. Each part of the Clicker 2 for
PIC18FJ development kit contains the components necessary for the most efficient operation of the same board. In addition to the possibility of choosing the Clicker 2 for PIC18FJ programming method: using USB HID mikroBootloader, an external mikroProg connector for PIC18FJ programmer, or through an external ICD3/3 programmer, the Clicker 2 board also includes a clean and regulated power supply module for the development kit. It provides two ways of board-powering; through the USB Mini-B cable, where onboard voltage regulators provide the appropriate voltage levels to each component on the board or using a Li-Polymer battery via an onboard battery
connector. All communication methods that mikroBUS™ itself supports are on this board, including the well-established mikroBUS™ socket, reset button, and several user-configurable buttons and LED indicators. Clicker 2 for PIC18FJ is an integral part of the Mikroe ecosystem, allowing you to create a new application in minutes. Natively supported by Mikroe software tools, it covers many aspects of prototyping thanks to a considerable number of different Click boards™ (over a thousand boards), the number of which is growing every day.
Microcontroller Overview
MCU Card / MCU
![default](https://dbp-cdn.mikroe.com/catalog/mcus/resources/PIC18F87J50/PIC18F87J50.jpg)
Architecture
PIC
MCU Memory (KB)
128
Silicon Vendor
Microchip
Pin count
80
RAM (Bytes)
3904
Used MCU Pins
mikroBUS™ mapper
Take a closer look
Schematic
![Barometer 4 Click Schematic schematic](https://dbp-cdn.mikroe.com/catalog/click-boards/resources/1ee7909e-334a-6444-96e7-0242ac120009/schematic.webp)
Step by step
Project assembly
Track your results in real time
Application Output
After loading the code example, pressing the "DEBUG" button builds and programs it on the selected setup.
![Application Output Step 1](https://dbp-cdn.mikroe.com/cms/shared-resources/1eed554e-d80f-6694-8cb9-02420a000272/AP-Step1.jpg)
After programming is completed, a header with buttons for various actions available in the IDE appears. By clicking the green "PLAY "button, we start reading the results achieved with Click board™.
![Application Output Step 3](https://dbp-cdn.mikroe.com/cms/shared-resources/1eed5550-3c0f-6800-a19f-02420a000272/AP-Step3.jpg)
Upon completion of programming, the Application Output tab is automatically opened, where the achieved result can be read. In case of an inability to perform the Debug function, check if a proper connection between the MCU used by the setup and the CODEGRIP programmer has been established. A detailed explanation of the CODEGRIP-board connection can be found in the CODEGRIP User Manual. Please find it in the RESOURCES section.
![Application Output Step 4](https://dbp-cdn.mikroe.com/cms/shared-resources/1eed5550-d4d0-6b20-a348-02420a000272/AP-Step4.jpg)
Software Support
Library Description
This library contains API for Barometer 4 Click driver.
Key functions:
barometer4_get_pressure_and_temperature
- Barometer 4 get pressure and temperature functionbarometer4_get_raw_data
- Barometer 4 get RAW data functionbarometer4_soft_reset
- Barometer 4 software reset function
Open Source
Code example
This example can be found in NECTO Studio. Feel free to download the code, or you can copy the code below.
/*!
* @file main.c
* @brief Barometer4 Click example
*
* # Description
* This library contains API for the Barometer 4 Click driver.
* The library initializes and defines the I2C bus drivers
* to write and read data from registers.
* This demo application shows an example of
* atmospheric pressure and temperature measurement.
*
* The demo application is composed of two sections :
*
* ## Application Init
* The initialization of the I2C module and log UART.
* After driver initialization and default settings,
* the app display device ID.
*
* ## Application Task
* This is an example that shows the use of a Barometer 4 Click board™.
* Logs the atmospheric pressure [ Pa ] and temperature [ degree Celsius ] data.
* Results are being sent to the Usart Terminal where you can track their changes.
*
* @author Nenad Filipovic
*
*/
#include "board.h"
#include "log.h"
#include "barometer4.h"
static barometer4_t barometer4;
static log_t logger;
void application_init ( void )
{
log_cfg_t log_cfg; /**< Logger config object. */
barometer4_cfg_t barometer4_cfg; /**< Click config object. */
/**
* Logger initialization.
* Default baud rate: 115200
* Default log level: LOG_LEVEL_DEBUG
* @note If USB_UART_RX and USB_UART_TX
* are defined as HAL_PIN_NC, you will
* need to define them manually for log to work.
* See @b LOG_MAP_USB_UART macro definition for detailed explanation.
*/
LOG_MAP_USB_UART( log_cfg );
log_init( &logger, &log_cfg );
log_info( &logger, " Application Init " );
// Click initialization.
barometer4_cfg_setup( &barometer4_cfg );
BAROMETER4_MAP_MIKROBUS( barometer4_cfg, MIKROBUS_1 );
err_t init_flag = barometer4_init( &barometer4, &barometer4_cfg );
if ( I2C_MASTER_ERROR == init_flag )
{
log_error( &logger, " Application Init Error. " );
log_info( &logger, " Please, run program again... " );
for ( ; ; );
}
barometer4_default_cfg ( &barometer4 );
log_info( &logger, " Application Task " );
log_printf( &logger, "----------------------------\r\n" );
Delay_ms( 100 );
static uint16_t device_id;
err_t err_flag = barometer4_get_device_id( &barometer4, &device_id );
if ( BAROMETER4_ERROR == err_flag )
{
log_error( &logger, " Communication Error. " );
log_info( &logger, " Please, run program again... " );
for ( ; ; );
}
log_printf( &logger, " Device ID : 0x%.4X \r\n", device_id );
log_printf( &logger, "----------------------------\r\n" );
Delay_ms( 1000 );
}
void application_task ( void )
{
static float pressure;
static float temperature;
barometer4_get_pressure_and_temperature( &barometer4, &pressure, &temperature );
log_printf( &logger, " Pressure : %.2f Pa\r\n", pressure );
log_printf( &logger, " Temperature : %.2f C\r\n", temperature );
log_printf( &logger, "----------------------------\r\n" );
Delay_ms( 1000 );
}
void main ( void )
{
application_init( );
for ( ; ; )
{
application_task( );
}
}
// ------------------------------------------------------------------------ END