adafruit_emc2101
¶
Brushless fan controller
- Author(s): Bryan Siepert
Implementation Notes¶
Hardware:
- Adafruit EMC2101 Breakout (Product ID: 4808)
Software and Dependencies:
- Adafruit CircuitPython firmware for the supported boards: https://circuitpython.org/downloads
- Adafruit’s Bus Device library: https://github.com/adafruit/Adafruit_CircuitPython_BusDevice
- Adafruit’s Register library: https://github.com/adafruit/Adafruit_CircuitPython_Register
-
class
adafruit_emc2101.
ConversionRate
¶ Options for
accelerometer_data_rate
andgyro_data_rate
-
class
adafruit_emc2101.
EMC2101
(i2c_bus)¶ Basic driver for the EMC2101 Fan Controller.
Parameters: i2c_bus (I2C) – The I2C bus the EMC is connected to. Quickstart: Importing and using the device
Here is an example of using the
EMC2101
class. First you will need to import the libraries to use the sensorimport board from adafruit_emc2101.emc2101_lut import EMC2101_LUT as EMC2101
Once this is done you can define your
board.I2C
object and define your sensor objecti2c = board.I2C() # uses board.SCL and board.SDA emc = EMC2101(i2c)
Now you have access to the
manual_fan_speed
attribute to setup the desired fanspeedemc.manual_fan_speed = 25
If you need control over PWM frequency and the controller’s built in temperature/speed look-up table (LUT), you will need
emc2101_lut.EMC2101_LUT
which extends this class to add those features, at the cost of increased memory usage.-
conversion_rate
¶ The rate at which temperature measurements are taken. Must be a
ConversionRate
-
dac_output_enabled
¶ When set, the fan control signal is output as a DC voltage instead of a PWM signal
-
external_temperature
¶ The temperature measured using the external diode
-
fan_speed
¶ The current speed in Revolutions per Minute (RPM)
-
forced_ext_temp
¶ The value that the external temperature will be forced to read when
forced_temp_enabled
is set. This can be used to test the behavior of the LUT without real temperature changes
-
forced_temp_enabled
¶ When True, the external temperature measurement will always be read as the value in
forced_ext_temp
-
initialize
()¶ Reset the controller to an initial default configuration
-
internal_temperature
¶ The temperature as measured by the EMC2101’s internal 8-bit temperature sensor
-
invert_fan_output
¶ When set to True, the magnitude of the fan output signal is inverted, making 0 the maximum value and 100 the minimum value
-
lut_enabled
¶ Enable or disable the internal look up table used to map a given temperature to a fan speed.
When the LUT is disabled (the default), fan speed can be changed with
manual_fan_speed
. To actually set this to True and modify the LUT, you need to use the extended version of this driver,emc2101_lut.EMC2101_LUT
-
manual_fan_speed
¶ The fan speed used while the LUT is being updated and is unavailable. The speed is given as the fan’s PWM duty cycle represented as a float percentage. The value roughly approximates the percentage of the fan’s maximum speed
-
spinup_drive
¶ The drive strength of the fan on spinup in % max RPM
-
spinup_time
¶ The amount of time the fan will spin at the current set drive strength. Must be a
SpinupTime
-
tach_limit
¶ The maximum /minimum speed expected for the fan
-
-
class
adafruit_emc2101.
SpinupDrive
¶ Options for
spinup_drive
-
class
adafruit_emc2101.
SpinupTime
¶ Options for
spinup_time
adafruit_emc2101.emc2101_lut
¶
Brushless fan controller: extended functionality
- Author(s): Bryan Siepert, Ryan Pavlik
Implementation Notes¶
Hardware:
- Adafruit EMC2101 Breakout (Product ID: 4808)
Software and Dependencies:
- Adafruit CircuitPython firmware for the supported boards: https://circuitpython.org/downloads
- Adafruit’s Bus Device library: https://github.com/adafruit/Adafruit_CircuitPython_BusDevice
- Adafruit’s Register library: https://github.com/adafruit/Adafruit_CircuitPython_Register
The class defined here may be used instead of adafruit_emc2101.EMC2101
,
if your device has enough RAM to support it. This class adds LUT control
and PWM frequency control to the base feature set.
-
class
adafruit_emc2101.emc2101_lut.
EMC2101_LUT
(i2c_bus)¶ Driver for the EMC2101 Fan Controller, with PWM frequency and LUT control.
See
adafruit_emc2101.EMC2101
for the base/common functionality.Parameters: i2c_bus (I2C) – The I2C bus the EMC is connected to. -
initialize
()¶ Reset the controller to an initial default configuration
-
lut
¶ The dict-like representation of the LUT, actually of type
FanSpeedLUT
-
lut_enabled
¶ Enable or disable the internal look up table used to map a given temperature to a fan speed. When the LUT is disabled fan speed can be changed with
manual_fan_speed
-
lut_temperature_hysteresis
¶ The amount of hysteresis in Degrees Celsius of hysteresis applied to temperature readings used for the LUT. As the temperature drops, the controller will switch to a lower LUT entry when the measured value is below the lower entry’s threshold, minus the hysteresis value
-
pwm_frequency
¶ Selects the base clock frequency used for the fan PWM output
-
pwm_frequency_divisor
¶ The Divisor applied to the PWM frequency to set the final frequency
-
set_pwm_clock
(use_preset=False, use_slow=False)¶ - Select the PWM clock source, choosing between two preset clocks or by configuring the clock using
pwm_frequency
andpwm_frequency_divisor
.Parameters: - use_preset (bool) – True: Select between two preset clock sources
False: The PWM clock is set by
pwm_frequency
andpwm_frequency_divisor
- use_slow (bool) – True: Use the 1.4kHz clock False: Use the 360kHz clock.
Returns: None
Raises: - AttributeError – if use_preset is not a
bool
- AttributeError – if use_slow is not a
bool
- use_preset (bool) – True: Select between two preset clock sources
False: The PWM clock is set by
-
-
class
adafruit_emc2101.emc2101_lut.
FanSpeedLUT
(fan_obj)¶ A class used to provide a dict-like interface to the EMC2101’s Temperature to Fan speed Look Up Table.
Keys are integer temperatures, values are fan duty cycles between 0 and 100. A max of 8 values may be stored.
To remove a single stored point in the LUT, assign it as
None
.