BPI-R3 Non-PWM Fan

So first off, I’m loving the R3. Great bit of kit. That said, it’s getting a little warm and I don’t like the idea if parking it on top of a laptop cooler. The following is probably just me being super dumb and missing something really obvious, but:

I happened to have a couple of these lying around, so I hooked one up to CN22.

It spins up briefly at boot, but does nothing after that. I tried editing /sys/class/thermal/cooling_device0/type to “fan” instead of “pwm_fan” as mentioned here, but was denied permission.

So, is PWM mandatory, or do I have other options here?

Ideally, what I want is the fan to get 3.3V if the temperature is above 40 degrees, and 5V if the temperature exceeds 55 degrees.

normally you cannot edit in sysfs…this is filled by devicetree and drivers…only some specific endpoints defined as rw by the drivers (like gpio export, direction,value)

What: /sys/class/thermal/cooling_deviceX/type Description: String which represents the type of device, e.g:

  - for generic ACPI: should be "Fan", "Processor" or "LCD"
  - for memory controller device on intel_menlow platform:
    should be "Memory controller".

  RO, Required  <<<<<<< readonly ;)

afaik there is no adc which can set a specific voltage to anything…the 3pin socket for fan is pwm and here you have to define the pwm-settings (which are done by thermal-trips and pwm-fan node). basicly you can edit the temperature settings there or disable the pwm-node and set pwm-signal from userspace (only for testing)

1 Like

Appreciate the reply, but now I have to ask…

What is CN22 for?

At this point I’d settle for the fan running at full speed all the time.

where do you see this? do not see it in schematic. pwm control requires a pwm-capable fan (mostoly 4pin, and rare for 5v)

Apologies, I means CN22 as seen at the top right of page 5 here. Fixed that in previous posts.

It’s the 2 pin header right next to the 3 pin header on the board.

Seems the 2pin fan socket has its ground connected to pwm channel…but you still need a pwm capable fan for it. Theoretically you can use a capacitor to convert the pwm waves nearly flat to a lower voltage,but this can also damage your board if you make the circuit wrong

Haha, I’ll avoid that then. Ordered one of those cute little noctua fans for tomorrow, and will shove the rpi ones into my magic mirror or something.

Appreciate the help.

I’ve always just connected a simple 5V fan (with only two wires for + and -) to the 2-pin fan connector of the board. Worked fine. I don’t think you need capacitors as even the maximum voltage will never exceed 5V and the board schematics show another mosfet transistor which should not be too fragile and intended to handle a situation like that.

That’s what I’ve been doing, but it only comes on at boot for a few seconds.

It’s controlled by the devive temperature. You can check temperature via cat /sys/class/thermal/thermal_zone0/temp. Only if it gets beyond a threshold it will start the fan, first only little, then more if/once it gets hotter. You can check cat /sys/class/thermal/cooling_device0/cur_state to see on which level the fan should be operating.

I’ve already had a look in that area based on this thread, however

echo 3 > /sys/class/thermal/cooling_device0/cur_state

does not result in any fan activity, which I expected it to, even if only briefly.

cat /sys/class/thermal/cooling_device0/cur_state yields values of 0 and 1 variably (apart from when I’ve just used echo 3, of course), but the fan remains equally stationary between those two states.

I pulled the fan this morning and used my myDAQ to provide it with power between 3V and 5V, and it behaved as expected. At 3V exactly it needed a little poke to get moving, but from 3.3V it was fine.

I see that the max_state value is set at 3, but I’m struggling to find definitions of what these states are or where to configure them.

Just a quick note for using non pwm with cn22 connector. In v1.1 bpi-r3, the gnd pin connected to pwm1.

echo 0 > /sys/devices/platform/pwm-fan/hwmon/hwmon1/pwm1

hi :slightly_smiling_face: thank u for this. this solved my issue with the original banana 3 fan. i added the line to startup and it is working. i use open wrt 23.05.2. in open wrt 23.050-rc3 this line worked : echo 32000 > /sys/class/thermal/thermal_zone0/trip_point_1_temp