T
T
teleghost2016-03-06 14:37:56
Electronics
teleghost, 2016-03-06 14:37:56

What is the best way to make a multi-channel PWM (PWM) fan driver based on STM32?

Greetings, electronic monsters.
See below for a detailed description and a complete list of questions, but I ask the main question right away: is it possible to use one input of the STM32 microcontroller and a conventional 8-channel CD4051B type multiplexer for a tachometer (counter of digital pulses running at a frequency from 5Hz to 1000Hz)? I want to just switch every 5-10 seconds between 8 signals instead of piling up 8-channel capture and counting in the microcontroller itself. Multi-channel PWM eats up quite a lot of peripherals. I suppose it's better to get off with three or four legs to control the multiplexer (well, and the MK input measuring timer, of course).
Problem Statement
Build an 8-zone cooling controller for mini storage systems using PWM fans with feedback, for example,Arctic Cooling F12 PWM CO (500-1500 rpm). If one of the respected monsters is not quite in the subject: these fans are controlled by PWM (pin # 4), feedback (on actual speed) comes in pulses (pin # 3, tachometer).
More detailed description
BMP180 thermal sensors are used (this is I2C).
An SD card is added to store streaming telemetry (this is SPI) and a real-time clock for tagging (this is again I2C). A little more, and at least launch into space (just kidding).
Microcontroller architecture - STM32F103 (what was at hand).
Making 8-channel PWM on STM32, as I understand it, is not a problem at all (two timers with four channels each, the carrier frequency is the same). But adding an 8-channel tachometer there is already too bold. Moreover, the most interesting thing when working with STM32 begins when you study ERRATA SHEET, from which it turns out, for example, a conflict when I2C2 works together with SPI2 and USART3 ...
I tried to find an I2C PWM driver, but options for robots like PCA9685 have a PWM carrier frequency of the order 1.6kHz, while it was recommended for fans to go into the region of 20..100kHz in order to avoid unnecessary acoustic effects ...
Questions
1) Is it possible to use a conventional 8-channel CD4051B type multiplexer to count 5..1000Hz tachometer pulses by switching in turn, for example, every 5 seconds? Maybe take another multiplexer?
2) What is the recommended PWM frequency for civilian fans? Someone says 20kHz, someone says 100kHz, where is the truth?
3) Is it necessary to pull up the output of the tachometer in a circuit with a CD4051B multiplexer? If yes, it must be done before the multiplexer, right?
UPD
4) Do I understand correctly that for 4-wire fans (as opposed to 3-wire ones), the "tachometer" return signal is not modulated by the PWM signal itself in any way? You don't want to chase your own modulation tail like a dog.
thank you all in advance

Answer the question

In order to leave comments, you need to log in

3 answer(s)
V
Vasily, 2016-03-07
@teleghost

2) 25-35 kHz, it would be possible to look from the motherboard with an oscilloscope, but I'm too lazy, a small frequency - there will be a squeak, a large one - a little more loss in the transistor.
4) quite right, you can avoid it in 3 pins with the help of a file.

G
golf2109, 2016-03-28
@golf2109

timers in the STM32 are hardware adapted to solve the problems of counting input pulses and use a tachometer in the input multiplexing mode for this purpose - an unjustified complication of the task

T
Timur Khasanshin, 2016-10-18
@itxs

1. Let's do without multiplexers, I saw STM32 with 14 timers for example.
2. Timers can count the duration of the signal on the leg. Some timers have 4 channels, some have 2.
3. With the same time scale of signals, one timer can be used to count 4 (or 2) independent signals at once.
4. On the STM32F103RGT, you can make at least 24 independent hardware PWMs that do not require interrupts, just checked in the STM32CubeMX reference book. With interruptions - and even more so. Plus a leg kick - and even more.
5. The return signal of the tachometer is not modulated by the input PWM signal, otherwise why is it needed at all.
6. The frequency for the PWM of the fans is found in the documentation for them, or is selected experimentally, which is not difficult and does not take much time.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question