FAN 8 click
Fan 8 Click is a compact add-on board that represents a compliant fan controller. This board features the MAX6615, a fan-speed controller, and a dual-channel temperature monitor with external thermistor inputs from Maxim Integrated, now part of Analog Devices. The MAX6615 controls the speed of two cooling fans based on the temperatures of external thermistors and the device's internal temperature, reporting temperature values in a digital form using the I2C serial interface.
click Product page
Click library
- Author : Stefan Filipovic
- Date : Aug 2021.
- Type : I2C type
Software Support
We provide a library for the FAN8 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 FAN8 Click driver.
Standard key functions :
fan8_cfg_setup
Config Object Initialization function.
void fan8_cfg_setup(fan8_cfg_t *cfg)
FAN 8 configuration object setup function.
FAN 8 Click configuration object.
Definition fan8.h:246
fan8_init
Initialization function.
err_t fan8_init(fan8_t *ctx, fan8_cfg_t *cfg)
FAN 8 initialization function.
FAN 8 Click context object.
Definition fan8.h:227
fan8_default_cfg
Click Default Configuration function.
err_t fan8_default_cfg(fan8_t *ctx)
FAN 8 default configuration function.
Example key functions :
fan8_set_duty_cycle
This function sets the duty cycle of the selected fan channel and waits until the duty cycle is set at the PWM output.
err_t fan8_set_duty_cycle(fan8_t *ctx, uint8_t fan_ch, uint8_t duty_cycle)
FAN 8 set duty cycle function.
fan8_measure_rpm
This function measures the RPM of the selected fan channel.
err_t fan8_measure_rpm(fan8_t *ctx, uint8_t fan_ch, uint8_t num_pulses, uint16_t *fan_rpm)
FAN 8 measure fan RPM function.
fan8_read_temperature
This function reads the temperature from the thermistor attached to the selected temperature channel.
err_t fan8_read_temperature(fan8_t *ctx, uint8_t temp_ch, float *temperature)
FAN 8 read temperature function.
Example Description
This example demonstrates the use of FAN 8 click board.
The demo application is composed of two sections :
Application Init
Initializes the driver and performs the click default configuration.
{
log_cfg_t log_cfg;
LOG_MAP_USB_UART( log_cfg );
log_init( &logger, &log_cfg );
log_info( &logger, " Application Init " );
err_t init_flag =
fan8_init( &fan8, &fan8_cfg );
if ( I2C_MASTER_ERROR == init_flag )
{
log_error( &logger, " Application Init Error. " );
log_info( &logger, " Please, run program again... " );
for ( ; ; );
}
{
log_error( &logger, " Default Config Error. " );
log_info( &logger, " Please, run program again... " );
for ( ; ; );
}
log_info( &logger, " Application Task " );
}
@ FAN8_ERROR
Definition fan8.h:266
#define FAN8_MAP_MIKROBUS(cfg, mikrobus)
MikroBUS pin mapping.
Definition fan8.h:212
void application_init(void)
Definition main.c:34
Application Task
Changes the speed of fans at both channels by changing the PWM duty cycle, then calculates the fans RPM from measured tachometer signal. It also reads the temperature of two thermistors. The results are being displayed to the USB UART where you can track their changes.
{
uint16_t fan_rpm = 0;
float temperature = 0;
{
}
{
}
duty_cnt += duty_inc;
log_printf( &logger, " - Channel 1 values -\r\n" );
log_printf( &logger, " PWM Duty Cycle : %d\r\n", ( uint16_t ) duty_cnt );
log_printf( &logger, " Last measured fan RPM : %u\r\n", fan_rpm );
log_printf( &logger, " Temperature : %.2f C\r\n\r\n", temperature );
log_printf( &logger, " - Channel 2 values -\r\n" );
log_printf( &logger, " PWM Duty Cycle : %d\r\n", ( uint16_t ) duty_cnt );
log_printf( &logger, " Last measured fan RPM : %u\r\n", fan_rpm );
log_printf( &logger, " Temperature : %.2f C\r\n\r\n", temperature );
{
log_printf( &logger, " Fault detected!\r\n\r\n", temperature );
}
Delay_ms ( 500 );
}
#define FAN8_MAX_DUTY_CYCLE
FAN 8 duty cycle values.
Definition fan8.h:161
#define FAN8_DUTY_CYCLE_STEP_10
Definition fan8.h:167
#define FAN8_2_PULSES_PER_REVOLUTION
Definition fan8.h:178
#define FAN8_MIN_DUTY_CYCLE
Definition fan8.h:162
#define FAN8_FAN_CHANNEL_1
FAN 8 fan channels value.
Definition fan8.h:134
#define FAN8_FAN_CHANNEL_2
Definition fan8.h:135
#define FAN8_TEMP_CHANNEL_1
FAN 8 temperature channels value.
Definition fan8.h:148
#define FAN8_TEMP_CHANNEL_2
Definition fan8.h:149
uint8_t fan8_check_fault_indicator(fan8_t *ctx)
FAN 8 check fault indicator function.
void application_task(void)
Definition main.c:76
Note
The MAX6615 measures the tachometer signal every 67s, therefore the fan RPM value will be updated once per 67s. An NTC 10K3 thermistor is required for proper temperature measurements.
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.FAN8
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.