Fan 2 Click Board
Fan 2 Click Board
The Fan 2 Click Board™ carries the MAX31760 precision fan-speed controller. It can measure temperature and adjust the fan speed to keep the temperature at the same level. The Fan 2 Click Board™ can also control two fans at the same time.
The Fan 2 Click Board™ is designed to run on either a 3.3V or 5V power supply. It communicates with the target microcontroller over the I2C interface, with additional functionality provided by the following pins on the MikroBUSline: INT, AN, RST, CS.
Software Support
Code examples for the Fan 2 Click Board™, written for MikroElektronika hardware and compilers are available on Libstock.
CODE SNIPPET
The following code snippet shows 3 functions from the example that control the fan speed. The first one initializes the Fan 2 Click Board™ to work automatically, depending on the temperature, while the second and third one demonstrates manual control.
01 //sets fan to automatic control (default), and fills the look-up table 02 void Fan_2_Init() 03 { 04 FAN2_I2CdriverInit( I2CM1_Set_Slave_Address, 0, 0, I2CM1_Write_Bytes, I2CM1_Read_Bytes); 05 FAN2_sendCommand(_FAN2_CONTROL_REGISTER_1, _FAN2_CMD1_DEFAULT); 06 FAN2_sendCommand(_FAN2_CONTROL_REGISTER_2, _FAN2_CMD2_DEFAULT); 07 FAN2_sendCommand(_FAN2_CONTROL_REGISTER_3, _FAN2_CMD3_DEFAULT | _FAN2_CMD3_INSTANT_RAMP); 08 FAN2_setupLUT(LUTSettings); 09 } 10 11 //sets fan to manual control 12 void Fan_2_Manual() 13 { 14 FAN2_sendCommand(_FAN2_CONTROL_REGISTER_1, _FAN2_CMD1_DEFAULT); 15 FAN2_sendCommand(_FAN2_CONTROL_REGISTER_2, _FAN2_CMD2_DEFAULT | _FAN2_CMD2_DIRECT_CONTROL); 16 FAN2_sendCommand(_FAN2_CONTROL_REGISTER_3, _FAN2_CMD3_DEFAULT | _FAN2_CMD3_INSTANT_RAMP); 17 } 18 19 //turns fan on and off 20 void Fan_2_Task() 21 { 22 FAN2_sendCommand(_FAN2_DIRECT_CONTROL_REGISTER, _FAN2_DUTYCYCLE_100); 23 delay_ms (5000); 24 FAN2_sendCommand(_FAN2_DIRECT_CONTROL_REGISTER, _FAN2_DUTYCYCLE_0); 25 delay_ms (5000); 26 }
Fan 2 Click Board
Frequently Asked Questions
Have a Question?
Be the first to ask a question about this.