TOP Contributors

  1. MIKROE (2653 codes)
  2. Alcides Ramos (352 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 (136715 times)
  2. FAT32 Library (69925 times)
  3. Network Ethernet Library (55938 times)
  4. USB Device Library (46261 times)
  5. Network WiFi Library (41884 times)
  6. FT800 Library (41150 times)
  7. GSM click (28979 times)
  8. PID Library (26412 times)
  9. mikroSDK (26355 times)
  10. microSD click (25353 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

iButton click

Rating:

0

Author: MIKROE

Last Updated: 2024-04-03

Package Version: 2.1.0.3

mikroSDK Library: 2.0.0.0

Category: 1-Wire

Downloaded: 17 times

Not followed.

License: MIT license  

iButton click - is an iButton™ probe Click board™. The iButton is a Analog Devices technology based on Analog's 1-Wire® communication protocol, and a chip usually packed in a robust stainless steel casing. The button-shaped iButton device has two contacts - the lid and the base. These contacts carry the necessary connections down to a sensitive silicone chip, embedded inside the metal button. When the iButton touches the reader probe on the Click board™, it establishes the communication with the host MCU, via the 1-Wire® interface. The communication is almost instant, so it is enough to press the iButton lightly to the probe contacts.

No Abuse Reported

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

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

Do you want to report abuse regarding "iButton click".

  • Example 1.0.0.0
  • Comments (0)

mikroSDK Library Blog


iButton click

iButton click - is an iButton™ probe Click board™. The iButton is a Analog Devices technology based on Analog's 1-Wire® communication protocol, and a chip usually packed in a robust stainless steel casing. The button-shaped iButton device has two contacts - the lid and the base. These contacts carry the necessary connections down to a sensitive silicone chip, embedded inside the metal button. When the iButton touches the reader probe on the Click board™, it establishes the communication with the host MCU, via the 1-Wire® interface. The communication is almost instant, so it is enough to press the iButton lightly to the probe contacts.

ibutton_click.png

click Product page


Click library

  • Author : Stefan Filipovic
  • Date : Feb 2024.
  • Type : One Wire type

Software Support

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

Standard key functions :

  • ibutton_cfg_setup Config Object Initialization function.

    void ibutton_cfg_setup ( ibutton_cfg_t *cfg );
  • ibutton_init Initialization function.

    err_t ibutton_init ( ibutton_t *ctx, ibutton_cfg_t *cfg );

Example key functions :

  • ibutton_add_key This function reads the ROM address from a DS1990A Serial Number iButton and stores it in the ctx->key_rom buffer.

    err_t ibutton_add_key ( ibutton_t *ctx );
  • ibutton_remove_keys This function removes all stored keys by clearing the ctx->key_rom buffer.

    void ibutton_remove_keys ( ibutton_t *ctx );
  • ibutton_check_key This function reads the ROM address from a DS1990A Serial Number iButton and checks if it is already stored in the ctx->key_rom buffer.

    err_t ibutton_check_key ( ibutton_t *ctx );

Example Description

This example demonstrates the use of the iButton click boards by registering a DS1990A Serial Number iButton key and then waiting until a key is detected on the reader and identifying if the key matches one of those stored in RAM.

The demo application is composed of two sections :

Application Init

Initializes the driver and registers a new DS1990A Serial Number iButton key and stores it in RAM.


void application_init ( void )
{
    log_cfg_t log_cfg;  /**< Logger config object. */
    ibutton_cfg_t ibutton_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.
    ibutton_cfg_setup( &ibutton_cfg );
    IBUTTON_MAP_MIKROBUS( ibutton_cfg, MIKROBUS_1 );
    if ( ONE_WIRE_ERROR == ibutton_init( &ibutton, &ibutton_cfg ) ) 
    {
        log_error( &logger, " Communication init." );
        for ( ; ; );
    }

    ibutton_register_keys ( &ibutton, NUMBER_OF_KEYS );

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

Application Task

Waits until a key is detected on the reader, and checks if there's a key found in the library that matches the one it has just read. All data is being logged on the USB UART where you can track the program flow.

void application_task ( void )
{
    err_t error_flag = IBUTTON_OK;
    ibutton_led_indication ( &ibutton, IBUTTON_LED_DISABLE );
    log_printf( &logger, " >>> Waiting for a key <<<\r\n" );
    do
    {
        ibutton_led_indication ( &ibutton, IBUTTON_LED_WAIT_KEY );
        error_flag = ibutton_check_key ( &ibutton );
    }
    while ( IBUTTON_ERROR == error_flag );

    ibutton_led_indication ( &ibutton, IBUTTON_LED_DISABLE );
    if ( IBUTTON_OK == error_flag )
    {
        log_printf( &logger, " MATCH, access allowed!\r\n" );
        ibutton_led_indication ( &ibutton, IBUTTON_LED_SUCCESS );
    }
    else if ( IBUTTON_KEY_NO_MATCH == error_flag )
    {
        log_printf( &logger, " NO MATCH, access denied!\r\n" );
        ibutton_led_indication ( &ibutton, IBUTTON_LED_WRONG_KEY );
    }
    ibutton_led_indication ( &ibutton, IBUTTON_LED_DISABLE );
    log_printf( &logger, "--------------------------------\r\n\n" );
    Delay_ms ( 500 );
}

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

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 4 click

0

LED Driver 4 click is a form of a high-efficiency boost converter that is ideally suited for driving an array of white LEDs. The driver has the ability to dim the connected LED array, without producing any noise on the output. The Click board is capable of driving a LED array with up to 26V, providing a constant current to the LED segments.

[Learn More]

ECG GSR Click

0

ECG GSR click is a complete solution for PPG, ECG and GSR application development, utilizing a specialized IC with a clinical-grade analog front-end (AFE) and electrical front-end. ECG GSR click uses the AS7030B IC, an ultra-low power, multi-channel bio-sensor, which features a wide range of different options, making it an ideal solution for development of blood oxygen level, heart rate and galvanic skin response monitoring applications, fitness applications, for the ECG bio-authentication, and similar applications related to heart monitoring. ECG GSR click is also equipped with the 3.5mm electrodes connectors, making it ready to be used out of the box.

[Learn More]

TouchClamp click

0

TouchClamp click is a mikroBUS™ add-on board with NXP’s MPR121 proximity capacitive touch sensor controller. It has seven plated holes for clamps which can be used to connect any – literally any – conductive object in order to use it as an input button to send an interrupt to the target board MCU.

[Learn More]