Source: https://mokxi.com/parts/pcfan
Updated: 2026-11-16

Part

# PC fan, 4-pin PWM

A 12 V computer fan you can slow down and read back: a duty cycle on PWM sets it, TACH pulses twice a turn.

See every part

- 4 pins
- 8 settings
- In 1 project

Drawn live by the editor's own code, at the size you see it.

At a glance

## The PC fan, 4-pin PWM in brief

What it is, and every setting the properties panel gives it.

A four-pin PC fan runs from its own 12 V and talks to a board on two wires of its connector: GND (black), +12V (yellow), TACH (green) and PWM (blue). TACH is an open collector that pulls low twice a turn, so rpm is falling edges a second times 30; give it INPUT_PULLUP on an Uno interrupt pin (2 or 3), or any ESP32 GPIO, which is safe because the fan only pulls it low. PWM is pulled up inside the fan, and open or high is full speed. The spec wants 25 kHz: Timer1 gives it on pin 9 of an Uno, and ledcAttach(pin, 25000, 8) on an ESP32. Mokxi models the duty-to-speed line (the default fan turns 600 rpm at 30 percent and under, 1800 at 100), Noctua and Arctic models that stop at the bottom of the range, a three-pin fan whose speed follows its supply, the 7 V starting voltage, a 1.5 second spin-up and a current that rises with the cube of the speed. The classic mistake is reading TACH with no pull-up and counting noise. The PWM frequency (any is averaged), the noise, the airflow and the start-up surge are not modeled.

Family

Outputs

Pins

4

model

custom (or Noctua NF-A12x25 PWM, Arctic P12 PWM PST, 3-pin 12V DC fan)

wires

4

max_rpm

1800

min_rpm

600

min_duty

30

stop_below

0

current

0.15

inertia

1500

Pins

## 4 pins

Named as the editor names them, so a wire lands where you expect it.

Pin

What it does

GND

black

+12V

yellow

TACH

green

PWM

blue

How to use it

## How to control a 4-pin PC fan with an Arduino

Only two of the fan’s wires go to the Uno: PWM (blue) to pin 9 and TACH (green) to pin 2, plus GND. The +12V wire goes to a 12 V adapter, whose minus meets the Uno’s ground. No transistor is needed, because the fan has its own controller.

Intel’s fan spec asks for 25 kHz, so the sketch sets Timer1 itself: ICR1 = 639 is 16 MHz / 640, and OCR1A sets the duty. TACH pulls low twice a turn, so count falling edges with attachInterrupt for a second and multiply by 30 for rpm. The Noctua in this project spins at 2000 rpm at 100 percent, holds 450 rpm down to 20 percent, and stops at 0.

Read TACH with INPUT_PULLUP. It is an open collector, and with no pull-up the pin floats and the count is noise. Leave PWM unwired and the fan runs flat out, as the spec requires.

Part pin

Board pin

PWM

Pin 9

TACH

Pin 2

GND

GND

+12V

12 V adapter

On an ESP32, ledcAttach(pin, 25000, 8) makes the 25 kHz without touching timers, and TACH is safe on a 3.3 V pin because the fan only ever pulls it low.

Click to open it in the editor

This is the simulator itself, running here. Click anything to open it in the editor.

Open this project in the editor Read the full tutorial

25 kHz on pin 9 and the tachometer, from the fan sketch

How it is modeled

## What is true about the PC fan, 4-pin PWM, here

In its help article’s own words: what the simulation gets right, and where it stops.

### Modeled

Open is full speed. Nothing on PWM runs it flat out, as the spec requires.

Two pulses a turn. 1800 rpm is 60 pulses a second on TACH.

The starting voltage. Under 7 V across it, the figure 12 V fan datasheets
print, it does not turn.

### Not modeled

The PWM frequency (any frequency is averaged), the noise, the air, the start-up
surge, and the exact current curve: the draw is 15 % of current for the
electronics plus the rest times the speed cubed, an approximation.

From PC fan, 4-pin PWM, in full.

Projects

## See the PC fan, 4-pin PWM in a project

One built-in project uses it. It opens in the editor, already wired.

Boards

## The boards it is shown on

This board has a built-in project with the PC fan, 4-pin PWM in it.

- Arduino Uno R3

More parts

## The rest of the bench

Every one of these is drawn and simulated the same way.

Full-size breadboard

A real 0.1 inch grid with the rails and the center channel, 63 columns wide.

Jumper wires

Drag from any pin or hole to any other. Corners snap, and you can drag them.

Power

A supply rail at the voltage you choose.

Ground

The other end of every circuit.

LED

Lights when current flows. Five colors, and the brightness is what your eye would see.

Filament lamp

A tungsten bulb in a holder: an inrush when it is switched on cold, tens of milliseconds to warm up, and dim on half its voltage.

Resistor

Any value you like, with the color bands drawn to match.

ESP32-C3-DevKitM-1

A RISC-V board that runs your firmware at 160 MHz on the real memory map.

Pushbutton

A 12 mm tactile switch. Hold it while the simulation runs.

Raspberry Pi Pico

The RP2040 board on our own Cortex-M0+ core. Pick a program and press Run.

Raspberry Pi Pico W

Raspberry Pi Pico W (RP2040). The same board and the same pinout as a Pico, with the CYW43439 on it. The WiFi is simulated (no radio; real internet through the Cloud panel’s switch), and the on-board LED, which hangs off that chip rather than off GP25, is driven through the same path. Everything else is the Pico.

Raspberry Pi 4 Model B

Raspberry Pi 4 Model B: the 40-pin header, driven by main.py with RPi.GPIO or gpiozero.

See every part

## Wire up the PC fan, 4-pin PWM

Open the editor and push it into the breadboard. It is free, and it runs on your own machine.

Start building free Open the editor
