Skip to main content

Library to interface with a VanTurtle analog fan controller over I2C

Project description

VanTurtleFan

VanTurtleFan is a Python library designed to interface with a VanTurtle analog fan controller over I2C. It provides an easy-to-use API to control fan speed, direction, and power state.

Features

  • Turn fans on or off.
  • Adjust fan speed.
  • Reverse airflow direction.
  • Reset fan states.
  • Read if the fan is in auto hold mode.

Requirements

  • I2C bus support on your device (Raspberry Pi, Arduino,ESP32, etc)
  • Python 3.5 or higher
  • smbus library installed

Installation

To install the library, use the following command:

pip install vanturtlefan

Usage

Here is an example of how to use the VanTurtle_Fan class:

from fan_vanturtle import VanTurtle_Fan

# Initialize the VanTurtle_Fan controller
# Bus 1 is the default on raspberry pi 5
# 0x27 is the address if all DIP switches are set to off
fans = VanTurtle_Fan(bus=1, address=0x27)

# Turn on the first fan (left on the PCB, labelled "FAN ONE")
fans.onoff(VanTurtle_Fan.FAN_ONE)
# Turn on the second fan
fans.onoff(VanTurtle_Fan.FAN_TWO)

# Reverse airflow direction
fans.reverse(VanTurtle_Fan.FAN_ONE)
# Increase the speed
fans.faster(VanTurtle_Fan.FAN_TWO)
# Decrease the speed
fans.slower(VanTurtle_Fan.FAN_TWO)

# Check if the fan is in temperature hold mode
print(fans.is_autohold(VanTurtle_Fan.FAN_ONE))
# Enable temperature hold mode
fans.auto(VanTurtle_Fan.FAN_ONE)

# Make a beeping noise
fans.beep(VanTurtle_Fan.FAN_ONE)

Troubleshooting

Make sure that the RJ45 cables are connected correctly and that the pins on one end are in the same order as on the other.

Check that the LEDs on the board are turning on when executing a command. If they remain off your commands might not be reaching the controller of there is less than 3.3 volts on the VCC. If both LEDs are continuously on but faint, the controller has power but has not been initialised over I2C yet.

Addresses

Move the DIP switches on the to change the I2C address of the controller. This allows you to use multiple fan controllers on the same bus if you'd like.

Use the table below to find your address, or scan for it.

1 (A0) 2 (A1) 3 (A3) Address
On (up) On (up) On (up) 20
Off (down) On (up) On (up) 21
On (up) Off (down) On (up) 22
Off (down) Off (down) On (up) 23
On (up) On (up) Off (down) 24
Off (down) On (up) Off (down) 25
On (up) Off (down) Off (down) 26
Off (down) Off (down) Off (down) 27

License

This project is licensed under the MIT License. See the LICENSE file for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

vanturtlefan-1.0.0.tar.gz (4.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

vanturtlefan-1.0.0-py3-none-any.whl (5.2 kB view details)

Uploaded Python 3

File details

Details for the file vanturtlefan-1.0.0.tar.gz.

File metadata

  • Download URL: vanturtlefan-1.0.0.tar.gz
  • Upload date:
  • Size: 4.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.8.10

File hashes

Hashes for vanturtlefan-1.0.0.tar.gz
Algorithm Hash digest
SHA256 fc10df00c575f11100b333acebe115ce2c8145378c10074bc4e9ad0ca94a732c
MD5 41b03e36c2a3115026abe396944b5fe3
BLAKE2b-256 68540fa0f5f6adf1cdd9ada884f231b0b64f246d003a8cda247d6098ab9ad068

See more details on using hashes here.

File details

Details for the file vanturtlefan-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: vanturtlefan-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 5.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.8.10

File hashes

Hashes for vanturtlefan-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 50b98bec75ba8914c5570570114ed87a112eb4f1938d441b6dedfc11fddf8b30
MD5 3225abef129ba92febdb96c233d7015b
BLAKE2b-256 2ac33df0a679b91a81203c0a1bb9e8e158d46d0ff42f432694c592a6b2e9d934

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page