TOP Contributors

  1. MIKROE (2779 codes)
  2. Alcides Ramos (376 codes)
  3. Shawon Shahryiar (307 codes)
  4. jm_palomino (118 codes)
  5. Bugz Bensce (97 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 (139566 times)
  2. FAT32 Library (72041 times)
  3. Network Ethernet Library (57256 times)
  4. USB Device Library (47615 times)
  5. Network WiFi Library (43219 times)
  6. FT800 Library (42566 times)
  7. GSM click (29930 times)
  8. mikroSDK (28292 times)
  9. PID Library (26933 times)
  10. microSD click (26309 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

Charger 3 Click

Rating:

0

Author: MIKROE

Last Updated: 2024-10-31

Package Version: 2.1.0.15

mikroSDK Library: 2.0.0.0

Category: Battery Charger

Downloaded: 280 times

Not followed.

License: MIT license  

Charger 3 Click is a compact add-on board that represents a standalone battery charger with thermal regulation. This board features the TP4056, a complete constant-current/constant-voltage linear charger for single-cell lithium-ion batteries from NanJing Top Power ASIC Corp.

No Abuse Reported

Do you want to subscribe in order to receive notifications regarding "Charger 3 Click" changes.

Do you want to unsubscribe in order to stop receiving notifications regarding "Charger 3 Click" changes.

Do you want to report abuse regarding "Charger 3 Click".

  • Information
  • Comments (0)

mikroSDK Library Blog


Charger 3 Click

Charger 3 Click is a compact add-on board that represents a standalone battery charger with thermal regulation. This board features the TP4056, a complete constant-current/constant-voltage linear charger for single-cell lithium-ion batteries from NanJing Top Power ASIC Corp.

charger3_click.png

Click Product page


Click library

  • Author : Stefan Nikolic
  • Date : nov 2020.
  • Type : I2C type

Software Support

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

Standard key functions :

  • Config Object Initialization function.

    void charger3_cfg_setup ( charger3_cfg_t *cfg );
  • Initialization function.

    CHARGER3_RETVAL charger3_init ( charger3_t *ctx, charger3_cfg_t *cfg );
  • Click Default Configuration function.

    void charger3_default_cfg ( charger3_t *ctx );

Example key functions :

  • Charger 3 enable write function.

    void charger3_enable_write ( charger3_t *ctx );
  • Charger 3 set current function.

    uint8_t charger3_set_current ( charger3_t *ctx, float curr_value );
  • Charger 3 calculate digipot resistance function.

    float charger3_calc_digipot_res ( charger3_t *ctx );

Examples Description

This example demonstrates the utilization of Charger 3 Click.

The demo application is composed of two sections :

Application Init

The application init sets up the UART LOG and I2C communication drivers. The default configuration disables write protection and sets the operation mode to charging.

void application_init ( void ) {
    log_cfg_t log_cfg;  /**< Logger config object. */
    charger3_cfg_t charger3_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.

    charger3_cfg_setup( &charger3_cfg );
    CHARGER3_MAP_MIKROBUS( charger3_cfg, MIKROBUS_1 );
    err_t init_flag = charger3_init( &charger3, &charger3_cfg );
    if ( init_flag == I2C_MASTER_ERROR ) {
        log_error( &logger, " Application Init Error. " );
        log_info( &logger, " Please, run program again... " );

        for ( ; ; );
    }

    Delay_ms ( 100 );
    charger3_default_cfg ( &charger3 );
    log_info( &logger, " Application Task " );
    log_printf( &logger, " ------------------------------------\r\n" );
    Delay_ms ( 100 );
}

Application Task

Task consists of two operations. First, the desired battery charging current is set by the user. Since setting the current doesn't implicitly reveals the resistance, the value of AD5175 digipot is directly read from the RDAC register, calculated and displayed on the uart log.

void application_task ( void ) {
    float result;

    charger3_set_current( &charger3, 0.4 );
    Delay_ms ( 1000 );
    result = charger3_calc_digipot_res( &charger3 );
    log_printf( &logger, " Digipot res value: %.2f ohm\r\n", result );
    log_printf( &logger, " ------------------------------------\r\n" );
    Delay_ms ( 1000 );
    Delay_ms ( 1000 );
    Delay_ms ( 1000 );
    Delay_ms ( 1000 );
    Delay_ms ( 1000 );
}

Note

While the resistance of the AD5175 can be directly set and read, the total resistance value on the PROG pin should be accounted for ( this means an additional 1kohm in series ) setting of the battery charging current.

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

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

Barometer 12 Click

0

Barometer 12 Click is a compact add-on board that measures air pressure in a specific environment. This board features the ICP-10125, a high-accuracy, low-power, 10-atm waterproof barometric pressure and temperature sensor from TDK InvenSense.

[Learn More]

PWR Meter 2 Click

0

PWR Meter 2 Click is a compact and accurate power monitoring Click board™, capable of measuring and monitoring voltage up to 24V and current up to 5A.

[Learn More]

STM32F0Discovery Examples

0

Examples for STM32F051 line with STM32F0Discovery development board.

[Learn More]