- Order number: MIKROE-3045
- Manufacturer product ID: MIKROE-3045
iButton click - is an iButton™ probe Click board™. The iButton is a technology based on the 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.
Due to its robustness, the iButton can withstand much more stress than similar devices used to carry an information: tags, cards, and other such devices are prone to damage, while a chip packed inside a thick stainless steel can be highly resilient. This Click board™ carries an iButton probe, along with two LEDs. It can be used to interface any iButton with the host MCU, displaying the resulting status information on any of the two independently programmed LEDs. This Click board™ is very useful for building a wide range of applications that can utilize a wide number of different iButton devices.
How does it work?
iButton click carries the CZ-0-PIN, a high-quality iButton probe from Demiurge company. The metal probe ensures resistance to dirt, dust, moisture, shock and other environmental hazards while ensuring good alignment with the iButton device, at the same time. The manufacturer guarantees compatibility with Maxim iButton devices, but any other device compatible with the maxim iButton can be read by the probe.
The iButton device is capable of powering itself up through the data line by employing the so-called parasite power supply. This Click board™ is equipped with the pull-up resistor to the 3.3V mikroBUS™ rail, providing power for the iButton that way. So-called parasite PSU of the iButton contains an internal capacitor, which provides enough current for the proper operation, once it has been charged by the data line. To allow proper functioning of the parasitic PSU, the idle state of the data line is HIGH, while the data line of the iButton device is in an open-drain configuration, pulling the data line to a LOW logic level when asserted.
The 1-Wire communication line is routed to the SMD jumper, which allows routing of the 1-Wire communication either to the PWM pin or to the AN pin of the mikroBUS™. These pins are labeled GP0 and GP1 respectively, the same as the SMD jumper positions, making the selection of the desired pin simple and straightforward.
The green LED labeled as ST1 is routed to the RST pin of the mikroBUS™, while the red LED is labeled as ST2 and it is routed to the CS pin of the mikroBUS™. These two pins allow visual feedback from the software, for example, if the serial number of the docked iButton matches the authorization criteria, the green LED can be used to signal it. These LEDs are can be used for any type of signalization, and are not directly connected with the iButton device itself.
Specifications
Type | 1-Wire |
Applications | An ideal solution for building a wide range of applications that can utilize a wide number of different iButton devices |
On-board modules | CZ-0-PIN, a high quality iButton probe from Demiurg company |
Key Features | The metal probe ensures good alignment of the iButton device, two programmable LEDs that can be used for the status report, simple software development with the included library functions |
Interface | 1-Wire |
Input Voltage | 3.3V |
Click board size | M (42.9 x 25.4 mm) |
Pinout diagram
This table shows how the pinout on iButton click corresponds to the pinout on the mikroBUS™ socket (the latter shown in the two middle columns).
Onboard settings and indicators
Label | Name | Default | Description |
---|---|---|---|
PWR | PWR | - | Power LED indicator |
ST1 | ST1 | - | User programmable GREEN LED |
ST2 | ST2 | - | User programmable RED LED |
JP1 | GP0, GP1 | Left | 1-Wire data comm. pin selection: left position GP0, right position GP1 |
Software support
We provide a demo application for iButton click on our Libstock page, as well as a demo application (example), developed using MikroElektronika compilers. The demo can run on all the main MikroElektronika development boards.
Library Description
Initializes and defines the GPIO click driver and functions witch turn on or turn off the LED.
Key functions:
void ibutton_enableGreenLed(uint8_t state);
- The function enables or disables a green LED on click (RST pin) depending on the state of the parameter value.void ibutton_enableRedLed(uint8_t state);
- The function enables or disables a red LED on the Click board™ (CS pin) depending the on the state of the parameter valuer.
Example description
The application is composed of three sections:
- System Initialization - Initializes the peripherals and pins.
- Application Initialization - Initializes the Click board™ driver.
- Application Task - Realizes communication between the iButton and buffer (EEPROM) which includes reading, writing and comparing values.
void applicationTask() { uint8_t check_flag; if(!Ow_Reset(OW_PORT, OW_PIN)) { check_flag = Read_Key(); if(check_flag = 0) { mikrobus_logWrite("Key exist", _LOG_LINE); Delay_ms(500); }else { mikrobus_logWrite("Key doesn't exist", _LOG_LINE); Delay_ms(500); } } else { mikrobus_logWrite("Add new key", _LOG_LINE); Delay_ms(500); while(Ow_Reset(OW_PORT, OW_PIN)) { if(check_state == 0) { mikrobus_logWrite("Insert iButton", _LOG_LINE); Delay_ms(500); check_state = 1; } } check_flag = Add_key(); if(check_flag == 0) { mikrobus_logWrite("Key added", _LOG_LINE); Delay_ms(500); }else { mikrobus_logWrite("Key already exist", _LOG_LINE); Delay_ms(500); } mikrobus_logWrite("Read iButton", _LOG_LINE); check_state = 0; } Delay_ms(100); }
uint8_t Check_ibutton(uint8_t *ibutton_data)
- Compares iButton data values with buffer data values.uint8_t Check_CRC(uint8_t *ibutton)
void Do_something(void)
- Enables red LED on click and disables green LED on click.void Do_something_else(void)
- Enables green LED on the Click board and disables red LED on click.uint8_t Add_key()
- Writes iButton data to buffer data in first free location.uint8_t * Read_from_EEPROM(uint8_t key_num, uint8_t *buffer_data)
- Reads data from the buffer (EEPROM).uint8_t Read_Key()
- Reads iButton data, compares this data with buffer data and depending on the comparison calls other functions to do something.uint8_t Get_Free_Location(uint8_t *buffer_data)
- Returns the value of the first free buffer location.void Write_to_EEPROM(uint8_t key_num, uint8_t *buffer_data, uint8_t *ibutton_data)
- Writes data to buffer (EEPROM).uint8_t *Get_data()
- Realizes 1-Wire® communication.
Additional notes and information
Depending on the development board you are using, you may need USB UART click, USB UART 2 clickor 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.
mikroSDK
This click board is supported by mikroSDK - MikroElektronika Software Development Kit. To ensure proper operation of mikroSDK compliant click board demo applications, mikroSDK should be downloaded from the LibStock and installed for the compiler you are using.
For more information about mikroSDK, visit the official page.
Downloads