TOP Contributors

  1. MIKROE (2762 codes)
  2. Alcides Ramos (374 codes)
  3. Shawon Shahryiar (307 codes)
  4. jm_palomino (118 codes)
  5. Bugz Bensce (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 (139248 times)
  2. FAT32 Library (71743 times)
  3. Network Ethernet Library (57115 times)
  4. USB Device Library (47428 times)
  5. Network WiFi Library (43082 times)
  6. FT800 Library (42403 times)
  7. GSM click (29835 times)
  8. mikroSDK (28073 times)
  9. PID Library (26885 times)
  10. microSD click (26198 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

Fan 5 Click

Rating:

0

Author: MIKROE

Last Updated: 2024-10-31

Package Version: 2.1.0.7

mikroSDK Library: 2.0.0.0

Category: Brushless

Downloaded: 96 times

Not followed.

License: MIT license  

Fan 5 Click is a compact add-on board specially designed for fan speed management. This board features Microchip’s TC654, a PWM mode fan speed controller with FanSense™ technology suitable for brushless DC fans.

No Abuse Reported

Do you want to subscribe in order to receive notifications regarding "Fan 5 Click" changes.

Do you want to unsubscribe in order to stop receiving notifications regarding "Fan 5 Click" changes.

Do you want to report abuse regarding "Fan 5 Click".

  • Information
  • Comments (0)

mikroSDK Library Blog


Fan 5 Click

Fan 5 Click is a compact add-on board specially designed for fan speed management. This board features Microchip’s TC654, a PWM mode fan speed controller with FanSense™ technology suitable for brushless DC fans.

fan5_click.png

Click Product page


Click library

  • Author : Stefan Ilic
  • Date : Dec 2022.
  • Type : I2C type

Software Support

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

Standard key functions :

  • fan5_cfg_setup Config Object Initialization function.

    void fan5_cfg_setup ( fan5_cfg_t *cfg );
  • fan5_init Initialization function.

    err_t fan5_init ( fan5_t *ctx, fan5_cfg_t *cfg );
  • fan5_default_cfg Click Default Configuration function.

    err_t fan5_default_cfg ( fan5_t *ctx );

Example key functions :

  • fan5_get_rpm1 Fan 5 get speed of FAN1.

    err_t fan5_get_rpm1 ( fan5_t *ctx, uint16_t *fan1_speed );
  • fan5_set_duty_cycle Fan 5 set duty cycle.

    err_t fan5_set_duty_cycle ( fan5_t *ctx, uint8_t duty_cycle );
  • fan5_turn_on_fans Fan 5 turn on fans.

    err_t fan5_turn_on_fans ( fan5_t *ctx );

Example Description

This example demonstrates the use of FAN 5 Click board by controlling and regulating the fan motors speed.

The demo application is composed of two sections :

Application Init

Initializes the driver, performs the Click default configuration, reads manufacturer id and sets configuration in correspondence to user-selected mode.


void application_init ( void ) 
{
    log_cfg_t log_cfg;  /**< Logger config object. */
    fan5_cfg_t fan5_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.
    fan5_cfg_setup( &fan5_cfg );
    FAN5_MAP_MIKROBUS( fan5_cfg, MIKROBUS_1 );
    if ( I2C_MASTER_ERROR == fan5_init( &fan5, &fan5_cfg ) ) 
    {
        log_error( &logger, " Communication init." );
        for ( ; ; );
    }

    if ( FAN5_ERROR == fan5_default_cfg ( &fan5 ) )
    {
        log_error( &logger, " Default configuration." );
        for ( ; ; );
    }
    fan5_turn_on_fans( &fan5 );
    uint8_t id = 0;
    fan5_get_mfr_id( &fan5, &id );
    log_printf( &logger, " Manufacturer ID: 0x%X \r\n", ( uint16_t ) id );

#if defined FAN_CONTROL_MODE
    fan5_set_duty_cycle( &fan5, FAN5_100_PER_DUTY );
    fan5_set_fan_fault1( &fan5, 500 );
#else
    fan5_set_duty_cycle( &fan5, FAN5_30_PER_DUTY );
    fan5_set_fan_fault1( &fan5, 0 );
#endif

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

Application Task

If Fan control is selected example will monitor FAN 1 speed and if the speed falls below 500 RPM for longer then 2.4 seconds fan output will be disabled. In other case, example is showcasing speed control by changing duty cycle and monitoring fan speed.

void application_task ( void ) 
{
#if defined FAN_CONTROL_MODE
    uint16_t speed = 0;
    uint8_t flag_data = 0;

    fan5_get_rpm1( &fan5, &speed);
    log_printf( &logger, " SPEED: %d RPM \r\n", speed );

    if ( FAN5_FAULT == fan5_get_fault_state( &fan5 ) )
    {
        fan5_get_status_flags ( &fan5, &flag_data );
        log_printf( &logger, " FLAG: %d \r\n", flag_data );
        if ( FAN5_F1F_FLAG & flag_data )
        {
            log_printf( &logger, " FAN SPEED DROPED !!! \r\n" );
            log_printf( &logger, " OUTPUT IS DISABLED \r\n" );
            fan5_turn_off_fans( &fan5 );
            for( ; ; );
        }
    }

    Delay_ms ( 1000 );
    Delay_ms ( 1000 );
#else
    uint16_t speed;
    uint8_t duty_value;

    for ( duty_value = FAN5_30_PER_DUTY; duty_value <= FAN5_100_PER_DUTY; duty_value++ )
    {
        fan5_set_duty_cycle( &fan5, duty_value );
        log_printf( &logger, " Duty value: %d \r\n", ( uint16_t ) duty_value );
        Delay_ms ( 1000 );
        Delay_ms ( 1000 );
        Delay_ms ( 1000 );
        Delay_ms ( 1000 );
        Delay_ms ( 1000 );
        fan5_get_rpm1( &fan5, &speed);
        log_printf( &logger, " SPEED: %d RPM \r\n", speed );
        Delay_ms ( 500 );
    }
#endif
}

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

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

EZO Carrier pH Click

0

EZO Carrier Click - pH is a compact add-on board that allows you to measure the potential of hydrogen (the power of hydrogen) in your application. This board features the EZO™ pH, a pH measurement interface circuit board from Atlas Scientific.

[Learn More]

eFuse 5 Click

0

eFuse 5 Click is a compact add-on board with a power path protection solution that limits circuit currents and voltages to safe levels during fault conditions. This board features the TPS16530, an easy-to-use, positive 58V, 4.5A eFuse with a 31mΩ integrated FET from Texas Instruments. This industrial eFuse has programmable undervoltage, overcurrent, inrush current protection, and output current monitoring features. Besides, it allows flexibility to configure the device between the two current-limiting fault responses (latch off and auto-retry).

[Learn More]

GPS 5 Click

0

GPS 5 Click is a compact add-on board that provides users with positioning, navigation, and timing services. This board features the M20050-1, a compact GPS module receiver using the MediaTek MT3333 flash chip, providing a complete GNSS receiver for optimum performance from Antenova. The receiver tracks 3 GNSS constellations concurrently (GPS+Galileo+GLONASS or GPS+Beidou) to considerably enhance location and TTFF (Time-to-first-fix) and has configurable low power modes operating from a 3.3V power supply. In addition to the possibility of using an external antenna, backup power, and various visual indicators, the M20050-1 also has an accurate 0.5ppm TXCO ensuring short TTFF alongside multi-path algorithms, which improves position accuracy in inner-city environments.

[Learn More]