TOP Contributors

  1. MIKROE (2662 codes)
  2. Alcides Ramos (357 codes)
  3. Shawon Shahryiar (307 codes)
  4. jm_palomino (112 codes)
  5. Chisanga Mumba (90 codes)
  6. S P (73 codes)
  7. dany (71 codes)
  8. MikroBUS.NET Team (35 codes)
  9. NART SCHINACKOW (34 codes)
  10. Armstrong Subero (27 codes)

Most Downloaded

  1. Timer Calculator (137051 times)
  2. FAT32 Library (70175 times)
  3. Network Ethernet Library (56047 times)
  4. USB Device Library (46370 times)
  5. Network WiFi Library (41991 times)
  6. FT800 Library (41324 times)
  7. GSM click (29083 times)
  8. mikroSDK (26522 times)
  9. PID Library (26463 times)
  10. microSD click (25449 times)
Libstock prefers package manager

Package Manager

We strongly encourage users to use Package manager for sharing their code on Libstock website, because it boosts your efficiency and leaves the end user with no room for error. [more info]

< Back
mikroSDK Library

Temp Alarm click

Rating:

0

Author: MIKROE

Last Updated: 2024-04-03

Package Version: 2.1.0.5

mikroSDK Library: 2.0.0.0

Category: Temperature & humidity

Downloaded: 34 times

Not followed.

License: MIT license  

Temp Alarm Click is a compact add-on board that adds temperature alarm functionalities to your project. This board features the PTMP4718, a high-accuracy remote and local temperature sensor from Texas Instruments. This temperature sensor has pin-programmable alert thresholds, with a fault queue for debounce.

No Abuse Reported

Do you want to subscribe in order to receive notifications regarding "Temp Alarm click" changes.

Do you want to unsubscribe in order to stop receiving notifications regarding "Temp Alarm click" changes.

Do you want to report abuse regarding "Temp Alarm click".

  • Information
  • Comments (0)

mikroSDK Library Blog


Temp Alarm click

Temp Alarm Click is a compact add-on board that adds temperature alarm functionalities to your project. This board features the PTMP4718, a high-accuracy remote and local temperature sensor from Texas Instruments. This temperature sensor has pin-programmable alert thresholds, with a fault queue for debounce.

tempalarm_click.png

click Product page


Click library

  • Author : Stefan Ilic
  • Date : Aug 2023.
  • Type : I2C type

Software Support

We provide a library for the Temp Alarm 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 Temp Alarm Click driver.

Standard key functions :

  • tempalarm_cfg_setup Config Object Initialization function.

    void tempalarm_cfg_setup ( tempalarm_cfg_t *cfg );
  • tempalarm_init Initialization function.

    err_t tempalarm_init ( tempalarm_t *ctx, tempalarm_cfg_t *cfg );
  • tempalarm_default_cfg Click Default Configuration function.

    err_t tempalarm_default_cfg ( tempalarm_t *ctx );

Example key functions :

  • tempalarm_write_reg Temp Alarm register writing function.

    err_t tempalarm_write_reg ( tempalarm_t *ctx, uint8_t reg, uint8_t data_in );
  • tempalarm_read_remote_temperature Temp Alarm remote sensor read temperature function.

    err_t tempalarm_read_remote_temperature ( tempalarm_t *ctx, float *temperature );
  • tempalarm_set_alarm_high_limit Temp Alarm remote sensor set limit high temperature function.

    err_t tempalarm_set_alarm_high_limit ( tempalarm_t *ctx, float max_temperature );

Example Description

This example demonstrates the use of Temp Alarm click board by reading and displaying the temperature measurements and monitoring it.

The demo application is composed of two sections :

Application Init

Initializes the driver and sets the Local sensor critical temperature at 30 degC with hysteresis of 1 degC, and Remote sensor alarm temperature at 30 degC.


void application_init ( void ) 
{
    log_cfg_t log_cfg;  /**< Logger config object. */
    tempalarm_cfg_t tempalarm_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.
    tempalarm_cfg_setup( &tempalarm_cfg );
    TEMPALARM_MAP_MIKROBUS( tempalarm_cfg, MIKROBUS_1 );
    if ( I2C_MASTER_ERROR == tempalarm_init( &tempalarm, &tempalarm_cfg ) ) 
    {
        log_error( &logger, " Communication init." );
        for ( ; ; );
    }

    if ( TEMPALARM_ERROR == tempalarm_default_cfg ( &tempalarm ) )
    {
        log_error( &logger, " Default configuration." );
        for ( ; ; );
    }

    log_info( &logger, " Application Task " );
}

Application Task

Reads the temperature measurement in degrees Celsius and displays the results on the USB UART approximately once per second. Monitoring alarm and critical state.

void application_task ( void ) 
{
    uint8_t flag_data = 0; 
    int8_t local_temp = 0;
    float remote_temp = 0;
    tempalarm_get_alarms( &tempalarm, &flag_data );
    if ( TEMPALARM_ADC_BUSY_MASK != ( TEMPALARM_ADC_BUSY_MASK & flag_data ) )
    {
        tempalarm_read_temperature( &tempalarm, &local_temp );
        tempalarm_read_remote_temp( &tempalarm, &remote_temp );
        log_printf( &logger, " Local temperature : %d degC \r\n" , ( int16_t ) local_temp );
        log_printf( &logger, " Remote temperature : %.3f degC \r\n" , remote_temp );
        log_printf( &logger, " -------------------------------- \r\n" );
    }
    if ( TEMPALARM_PIN_STATE_LOW == tempalarm_get_alr_pin( &tempalarm ) )
    {
        log_printf( &logger, " Alarm is on, remote temperature  \r\n" );
        log_printf( &logger, "      is higher then 30 degC      \r\n" );
        log_printf( &logger, " -------------------------------- \r\n" );
    }
    if ( TEMPALARM_PIN_STATE_LOW == tempalarm_get_tcr_pin( &tempalarm ) )
    {
        log_printf( &logger, " Alarm is on, local temperature  \r\n" );
        log_printf( &logger, "      is higher then 30 degC      \r\n" );
        log_printf( &logger, " -------------------------------- \r\n" );
    }
    Delay_ms ( 1000 );
}

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.TempAlarm

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.


ALSO FROM THIS AUTHOR

LED Driver 16 click

0

LED Driver 16 Click is a compact add-on board that simplifies the control of multiple LEDs. This board features the PCA9745B, an SPI-configurable sixteen-channel constant current LED driver from NXP Semiconductors. Each LED output has an 8-bit resolution (256 steps) fixed-frequency individual PWM controller that operates at 31.25kHz with an adjustable duty cycle from 0 to 100% to allow the LED to be set to a specific brightness value. Powered through a selected mikroBUS™ power rail, either 3.3V or 5V, it provides a maximum output current of 57mA per channel and multiple built-in protection functions that protect the circuit during abnormalities.

[Learn More]

8x8 G click

0

8x8 G click is a 64 LED matrix display Click board™, composed of SMD LEDs organized in 8 rows by 8 columns. It has a digital brightness control in 16 steps, it can control every LED in the display matrix independently, it blanks the display on power up to eliminate glitches and it requires a single resistor to control the current through all the LEDs at once, which simplifies the design. 8x8 G click uses a fast SPI communication protocol, allowing fast display response and no lag.

[Learn More]

TouchPad 2 click

0

Touchpad 2 Click is a compact add-on board that easily integrates projected capacitive touch into their applications. This board features the IQS525, a projected capacitive touch and proximity trackpad/touchscreen controller from Azoteq. It features best in class sensitivity, signal-to-noise ratio, and automatic tuning of electrodes, in addition to the multi-touch and multi-hover feature. This Click board™ is characterized by embedded gesture engine recognition for simple gestures (tap, swipes, hold), as well as built-in noise detection and filtering. This Click board™ is suitable for human-machine interfaces, keypad or scrolling functions, single-finger gesture-based interfaces, and more.

[Learn More]