Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/jwillikers/fan-controller-circuitpython

A simple program to set the speed of a fan using the RP2040 QT Py and the EMC2101 fan controller
https://github.com/jwillikers/fan-controller-circuitpython

circuitpython emc2101 fan microcontroller pipkin python qt-py rp2040

Last synced: 10 days ago
JSON representation

A simple program to set the speed of a fan using the RP2040 QT Py and the EMC2101 fan controller

Awesome Lists containing this project

README

        

= Fan Controller
Jordan Williams
:experimental:
:icons: font
ifdef::env-github[]
:tip-caption: :bulb:
:note-caption: :information_source:
:important-caption: :heavy_exclamation_mark:
:caution-caption: :fire:
:warning-caption: :warning:
endif::[]
:Adafruit-EMC2101: https://www.adafruit.com/product/4808[Adafruit EMC2101 I2C PC Fan Controller and Temperature Sensor]
:Adafruit-QT-Py-RP2040: https://www.adafruit.com/product/4900[Adafruit QT Py RP2040]
:CircuitPython: https://circuitpython.org/[CircuitPython]
:just: https://github.com/casey/just[just]
:Noctua-NF-P12-redux-1700-PWM-Fan: https://noctua.at/en/nf-p12-redux-1700-pwm[Noctua NF-P12 redux-1700 PWM Fan]
:pre-commit: https://pre-commit.com/[pre-commit]
:pipkin: https://github.com/aivarannamaa/pipkin[pipkin]

image:https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit&logoColor=white[pre-commit, link=https://github.com/pre-commit/pre-commit]
image:https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json[Ruff, link=https://github.com/astral-sh/ruff]

A simple fan controller using the {Adafruit-QT-Py-RP2040} and the {Adafruit-EMC2101}, written in {CircuitPython}.

ifdef::env-github[]
++++


Raspberry PI Pico PWM Fan Controller Breadboard Top View 1



Raspberry PI Pico PWM Fan Controller Breadboard Top View 2



Raspberry PI Pico PWM Fan Controller Breadboard Side View 1



Raspberry PI Pico PWM Fan Controller Breadboard Side View 2



Raspberry PI Pico PWM Fan Controller Breadboard Side View 3


++++
endif::[]

ifndef::env-github[]
image::pics/pico-pwm-fan-controller-breadboard-top-1.jpg[Raspberry PI Pico PWM Fan Controller Breadboard Top View 1, align=center]
image::pics/pico-pwm-fan-controller-breadboard-top-2.jpg[Raspberry PI Pico PWM Fan Controller Breadboard Tope View 2, align=center]
image::pics/pico-pwm-fan-controller-breadboard-side-1.jpg[Raspberry PI Pico PWM Fan Controller Breadboard Side View 1, align=center]
image::pics/pico-pwm-fan-controller-breadboard-side-2.jpg[Raspberry PI Pico PWM Fan Controller Breadboard Side View 2, align=center]
image::pics/pico-pwm-fan-controller-breadboard-side-3.jpg[Raspberry PI Pico PWM Fan Controller Breadboard Side View 3, align=center]
endif::[]

== Hardware

All the hardware components in my particular build are enumerated here.

.Fan Controller Components
* {Adafruit-QT-Py-RP2040}
* {Adafruit-EMC2101}
* https://www.adafruit.com/product/64[Half-size breadboard]
* {Noctua-NF-P12-redux-1700-PWM-Fan}
* https://www.adafruit.com/product/759[Premium Male/Male Jumper Wires - 40 x 3" (75mm)]
* https://www.adafruit.com/product/4399[STEMMA QT / Qwiic JST SH 4-Pin Cable - 50mm Long]
* USB-C Power Supply for the microcontroller

Programming will require a USB-C cable and a computer.

== How it Works

This is a dead-simple fan controller that simply lowers the speed of the {Noctua-NF-P12-redux-1700-PWM-Fan} to a quiet 40% speed.
The microcontroller simply sets the fan speed and then enters deep sleep indefinitely.
Technically, it enters deep sleep for around nineteen years, but after it sets the initial fan speed on the EMC2101 there's no compelling reason for it to wake up again.
I could probably use PWM straight from the microcontroller just as easily, but the EMC2101 development board has an even easier to use CircuitPython library.
The fan setup might evolve in the future to take into account temperature sensing dynamic speed adjustment.

== Getting Started

The instructions here setup the software for the QT Py RP2040.
It is assumed that you are on and familiar with Linux and using CircuitPython on microcontrollers.

[TIP]
====
To access the serial connection to the QT Py RP2040 without requiring superuser privileges, add your user to the `dialout` group.

[,sh]
----
sudo usermod --append --groups dialout $USER
----

Now restart for the change to take effect.
====

. Wait for the file to finish copying, after which the Feather RP2040's onboard storage should automatically be mounted.

. Clone this project's repository.
+
[,sh]
----
git clone https://github.com/jwillikers/fan-controller.git
----

. Change into the project directory.
+
[,sh]
----
cd fan-controller
----

. Install {just} by following the instructions in the https://github.com/casey/just?tab=readme-ov-file#installation[installation section].

. Hold down the button marked _bootsel_ on the QT Py RP2040 while plugging it in to your computer with a USB-C cable.
The RP2040 should automatically be mounted as a disk on your computer.

. To download and install CircuitPython, run `just install-circuitpython`.
+
[,sh]
----
just install-circuitpython
----

. Run `just init` to initialize the venv.
+
[,sh]
----
just init
----

. Mount the QT Py RP2040 if needed.
+
[,sh]
----
udisksctl mount --block-device /dev/sda1
----

. Run `just install` to install everything to the QT Py RP2040.
+
[,sh]
----
just install
----

== Development

. Run `just init-dev` to initialize the virtual environment for development.
This will install all of the necessary dependencies and the {pre-commit} hooks.
+
[,sh]
----
just init-dev
----

. To update dependencies, run `just update`.
+
[,sh]
----
just update
----

. Use `just --list` to list other available tasks.
+
[,sh]
----
just --list
----

== Documentation

.CircuitPython Documentation
* https://circuitpython.readthedocs.io/en/latest/shared-bindings/alarm/index.html[alarm]
* https://docs.circuitpython.org/projects/emc2101/en/latest/[emc2101]

== Contributing

Contributions in the form of issues, feedback, and even pull requests are welcome.
Make sure to adhere to the project's link:CODE_OF_CONDUCT.adoc[Code of Conduct].

== Open Source Software

This project is built on the hard work of countless open source contributors.
Several of these projects are enumerated below.

* https://asciidoctor.org/[Asciidoctor]
* {CircuitPython}
* https://git-scm.com/[Git]
* {pre-commit}
* {pipkin}
* https://www.python.org/[Python]

== Code of Conduct

Refer to the project's link:CODE_OF_CONDUCT.adoc[Code of Conduct] for details.

== License

This repository is licensed under the https://www.gnu.org/licenses/gpl-3.0.html[GPLv3], a copy of which is provided link:LICENSE.adoc[here].

© 2022-2024 Jordan Williams

== Authors

mailto:{email}[{author}]