Close

Design thought process and ideas

A project log for CM5 IO Board Fan Halt

Automatically stop the fan when shutting down your Pi Compute Module 5. Finally some peace and quiet!

eontronicsEontronics 02/13/2025 at 23:320 Comments

Quick disclaimer: At the time of writing, I'm currently waiting on the 2nd iteration of the boards to be delivered, so these logs are mostly me trying to recall and write down what went into the design at the time!


Some Requirements

While the problem I'm trying to solve is simple enough - automatically turning off a fan when the Pi Compute Module is shutdown, there are a few specifics I want this design to achieve:

  1. Plug 'n' Play: I want installation of the module to be as simple as plug it into the Pi and the fan and it's good to-go. I don't want the functionality to depend on having software installed upon the Pi itself.
  2. Reside entirely within the Compute Module 5 IO Case: I would like it such that the add-on can be used with the official Compute Module 5 IO Case (the one included with the Compute Module 5 Development Kit), without impacting its overall geometry or appearance. Practically, it would therefore need to reside within the case with the IO board, and should not require connection to any external connectors, such as the USB ports
  3. Minimal Impact on compatibility with other hardware: The Compute Module 5 IO board provides connections for M.2 devices, standard Raspberry Pi Hats (including Power Over Ethernet) and there are also several third party cooling solutions for the Compute Module itself. This addon should not interfere electrically or mechanically with any of these components as far as reasonably possible.
  4. Make use of affordable, common components: In line with the Pi Compute Module 5's decade+ long obsolescence statement, this addon should remain accessible and easy to build so long as it remains useful for, which is essentially until the Pi CM5 becomes obsolete. A key part of ensuring this is avoiding the use of niche ICs that are unlikely to be succeeded by alternative parts after reaching end-of-life status. Plus as this should be a fairly simple circuit, they shouldn't be necessary in the first place.
  5. Minimal impact on idle current consumption: While the main reason to stop the fan after shutdown is to stop it from making annoying noise, it also reduces the overall power draw of the Pi in this state. This addon should really use less power than the fan (and much less than the idle Pi) so these power savings are not lost.

Mechanical sizing

To ensure mechanical compatibility with other addon hardware and the Compute Module 5 IO Case, it's necessary to determine where would be a suitable location for installation so that upper limits on the PCB size can be set. To this effect, I've had my eye on this particular spot on the IO board, in between the M.2 Socket and the Compute Module:

Fan halt addon location
3D render of Compute Module 5 IO board highlighting potential location for the fan halt addon board

This location seems fairly ideal as it's a fairly empty patch of board, with only two conflicting components to work around, it includes one of the IO Boards mounting holes, which could also be used to attach the addon, and it's right next to (well, encompasses) the normal fan header, which help keeps the length of loose wires needed to a minimum when plugging things in.


The downside is that this strip is still fairly narrow, limiting the overall board width to about 15mm to avoid conflicting with the adjacent sockets, which could make it challenging to try and fit everything on the PCB neatly. On the other hand, maybe the extra challenge will make designing the board a bit more 'interesting'? Is 'interesting' a good or a bad thing here?

Electrical operation

According to the Fan control section of the Compute Module 5 datasheet, (Section 2.15, p.16):

During CM5 shutdown, power supply shutdown includes Fan_PWM. If the PWM fan is powered from +5V, the fan will start or continue to run. To prevent the fan from running after power supply shutdown, turn off the supply to the fan. For example, you could use the same supply as the external USB ports use which is controlled by VBUS_EN. Alternatively, use an open collector buffer (e.g. 74LVC1G07) powered from +5V. Connect the input to CM5_3.3V. Connect the output in parallel with the PWM line.

The main options for detecting shutdown of the Pi appear to be either by tapping off VBUS from the USB ports, or using the CM5_3.3V rail to control some kind of load switch. I would like to avoid the former, as I don't want to have wires trailing outside the case to access the USB connectors, however neither of these signals appear to be made available on any internal connectors...

Conveniently, the datasheet also states the following (Section 2.15, p.15):

Fan_Tacho is an input with an internal pull-up to CM5_3.3V suitable for Tacho output from many PWM fans.

If the pull-up on the Fan_Tacho pin is driven by CM5_3.3V, then we can determine from the presence of a pull-up whether or not CM5_3.3V is powered or not, and hence whether or not the fan should be on.

This is doubly convenient in that we already need to connect to the fan header to access the power and PWM signals to drive the fan, so no other connection to the IO board is needed.

Knowing this, the next step is to devise a scheme for detecting whether a pull-up is present on Fan_Tacho or not, of which there are 2 main ways I can think of to achieve this:

  1. Add a small shunt between the Fan_Tacho pin and the open collector output of the fan tachometer, and measure if the voltage at the high side of the shunt is sufficiently above ground
  2. Construct something similar to a 'missing pulse detector' circuit, which generates a signal if the Fan_Tacho pin remains low for too long, while ignoring the short low pulses produced by the fan tachometers open collector output

After some thought I concluded that method 1. would be subject to too much uncertainty, as the input voltage thresholds (which may or may not be affected by the GPIO_VREF voltage), and pull-up resistance on the Fan_Tacho pin are not documented, and no partial schematic of the Compute Module 5 has been released. This makes selecting a suitable shunt voltage (and hence component, whether resistive or non-linear) difficult without experimentation, and since these parameters are not specified on the datasheet, they could even change between revisions of the CM5 IO Board without notice. I did consider simply using a forward biased Schottky diode for this and setting a low voltage threshold of 50mV or so, however I still would not be able to ensure the forward voltage would still be low enough (on top of the saturation voltage of the fan output) to reliably produce a 'low' signal on the Fan_Tacho input.

As a result I went with method 2. (the 'missing pulse detector') as a basis on which to design the shutdown detection circuit, which will be discussed more in another log describing the schematic layout of the addon.

Discussions