Skip to main content

Smart

The Smart Fan unit utilizes the RP2040 microcontroller featured in the Raspberry Pi Pico 1. Using the RP2040's two UART connections, a link can be established to each blade using the fan connectors.

Hardware

Power Delivery

The Smart Fan Unit can be powered with +5V from both Blade Port A or Port B In addition to the USB Type-C for flashing. USB Type-C with not power the fan

LEDs

The Smart Fan Unit has 5 LEDs

LEDLocationType
LED1YellowProgrammable NeoPixel at index 0
LED2YellowProgrammable NeoPixel at index 1
LED3RedGreen Programmable at GPIO25
LED4GreenBlue Power indicator for Port A
LED5GreenBlue Power indicator for Port B

Button

A programmable button is located on on the rear of the Smart Fan Unit. It can be addressed at GPIO12

Fan control

The Smart Fan Unit uses the EMC2101 from Microchip/SMSC a fan controller with temperature monitoring. The EMC2101 is connected over the I2C bus to the RP2040

The EMC2101 has two temperature sensors. An internal sensors on the IC(Red) located next to Port A and an external sensors(Green) located next to Port B

Blade Fan unit connector

Additional information

Pin Out Guides

Smart Fan Unit

Smart Fan Unit blade connecter pin out

Fan Header

J5 Debug Header

RP2040 Pin Reference Table

Pins used by the Smart Fan Unit

Pins(RP2040)Functions
GPIO1UART0 RX
GPIO2UART0 TX
GPIO4I2C-SDA
GPIO5I2C-SCL
GPIO8UART1 TX
GPIO9UART1 RX
GPIO12Button
GPIO15Two NeoPixel LEDs
GPIO16Power to Fan
GPIO25LED3

Update Firmware

To start using the Smart Fan Unit, it should first be flashed with the latest firmware of your choice. This could be any custom firmware, or a pre-existing framework.

First, start by removing power from the Fan Unit. Then hold down the BOOT button and connect the USB Type-C to your computer.

The Fan Unit will now appear as a storage device labelled RPI-RP2 on your computer.

The firmware you are flashing should have the file extension .uf2 Move the *.uf2 file into RPI-RP2, it should disconnect after a few seconds and reboot to the newly installed firmware.

CircuitPython

We have prepared example code to help you get started with your Smart Fan unit. Using CircuitPython which is a programming language designed to simplify experimenting and learning to code on low-cost microcontroller boards.

The code has the following basic functionality example :

  • Button use
  • LED control both Green and NeoPixel
  • Fan control based on a simple fan curve
  • UART communication
Fan Curve Reference Table

Fan Curve used in example code

Temp RangePresent Fan Speed
t >= 40C100%
35C <= t < 40C70%
33C <= t < 35C60%
31C <= t < 33C40%
29C <= t < 31C30%
29C < t10%

Installing CircuitPython

  1. Download the latest version of CircuitPython 9
  2. With the Compute Blade connected from prior firmware flashing steps, move adafruit-circuitpython-raspberry_pi_pico-en_US-*.uf2 file into the RPI-RP2 storage device
  3. It will be disconnected and LED 3 will blink green
  4. The fan Unit with reconnect as CIRCUITPY will be connected

Deploying Code example

  1. Having installed CircuitPython and connecting the fan unit to your computer via USB-C
  2. Download the example code from GitHub
  3. The code should be placed in CIRCUITPY; if prompted to replace any files, click yes

Enable UART on CM4

To enable UART on the compute blade, open /boot/firmware/config.txt

sudo nano /boot/firmware/config.txt
info

Instead of the BIOS found on a conventional PC, Raspberry Pi devices use a configuration file called config.txt. The GPU reads config.txt before the ARM CPU and Linux are initialized. Raspberry Pi OS looks for this file in the boot partition, located at /boot/firmware/.

learn more about config.txt in Raspberry Pi Documentation

Then add the following lines:

[cm4]
enable_uart=1
dtoverlay=uart5

Reboot the the Compute Blade. When it has restarted, the UART connection will be available at /dev/ttyAMA5

Debugging

There is an unpopulated pin header labelled J5 located below the B port on the Fan Unit.

Debug pins
J5 Debug pins

These debug pins can be used with a tool like the Raspberry Pi Debug Probe to debug and program the RP2040.