Reading "open collector output" safely with MCU? (Faulty Noctua fan) - Page 1
Forum section: electronics / projects

author: sequoia
author_rank: Unknown
timestamp: January 11, 2022, 11:07:07 pm
content: I recently came across a faulty(?) Noctua PWM fan (12V) that seems to have it's Tachometer output pin pulled up to about 7-8V inside the fan.Since PWM controlled (PC) fans have open collector output for the tachometer signal, I have been monitoring the fan directly with a MCU input(using 10k pull-up to MCU Vcc rail and connecting waveform output to input pin):But this doesn't seem safe? As potentially this MCU pin could see 12V, assuming its a 12V fan that has developed a ​fault shorting motor power to tachometer output, etc...I ended up adding a diode (and 1k resistor) as shown belowDoes this seem adequate protection against failure of a fan? Or is there perhaps better ways to do this?

author: thm_w
author_rank: Super Contributor
timestamp: January 12, 2022, 12:32:24 am
content: Looks good to me.The second post here has the same schematic as yours, just omitting the 1k series resistor:https://electronics.stackexchange.com/questions/69613/how-to-read-rpm-from-3-wire-fan-pic18f4550/214082I see a few using a voltage divider, but, I prefer the diode idea. Would also work with a 24V or 5V fan.

author: sequoia
author_rank: Unknown
timestamp: January 12, 2022, 12:53:26 am
content: Yes, the R2 (1k) resistor is not really needed, but definitely won't hurt having it in 'front' of a MCU i/o pin (?)I hooked the FAN up to a scope directly and it seems to output 12V peak-to-peak waveform on the tacho output pin.Seems faulty (?), as any other PC PWM fan I've come across outputs nothing (without a pull-up).With 3.3V pull-up I was seeing that around 7.5V peak to peak waveform, and then after adding diode get 'proper' waveform...Side-effect from the Diode seems to be that it shifts V_min of the waveform up for the diode forward voltage (drop) amount, seems to still go low enough for the MCU, but likely better use a schottky diode (etc.) with very low forward voltage drop...

author: thm_w
author_rank: Super Contributor
timestamp: January 12, 2022, 01:01:52 am
content: 1k won't hurt.Depending on the MCU, you might have a input threshold voltage of ~0.3 x Vcc. So for a 5V micro, voltage below 1.5V, or for a 3.3V micro, below 1.0V.1N4148 at 1mA should be under 0.8V. No harm to use a schottky if the withstand voltage is adequate.

author: sequoia
author_rank: Unknown
timestamp: January 12, 2022, 06:47:01 pm
content: It seems Noctua doesn't seem to quite follow their own 'specifications', since it seems that at least some of their fans (like "NF R-8 redux - 1800 PWM") have internal pull-up to 12V for the tachometer signal.While diagram from "Noctua PWM specifications white paper" doesn't show it:This seems to also contradict Intel specification that says:QuoteBut since (PC) motherboards are supposed to have 12V pull-ups these should work fine for their intended purpose though....It doesn't seem "open-collector output" to me if there is built-in pull-up...Isn't the whole purpose of this style of outputs to allow interfacing between logic levels that operate on different voltages?

author: thm_w
author_rank: Super Contributor
timestamp: January 12, 2022, 11:25:54 pm
content: Thats usually one of the main purposes yeah.If the internal pullup resistance is high enough, say 100k, then its usually going to be safe, even if hooked up to a 3.3V input. Still not ideal. Can you measure the resistance externally?I checked a generic PC fan here and there was no pullup.

author: sequoia
author_rank: Unknown
timestamp: January 13, 2022, 08:24:47 am
content: I measured between the Vcc and Tacho pins on the fan connector: 10k ohms.(This was the NF R-8 redux - 1800 PWM model.)So looks like like Noctua is including pull-up inside the fan...

author: 2N3055
author_rank: Super Contributor
timestamp: January 13, 2022, 09:13:04 am
content: All digital circuits have input diode clamps like one in diagram attached. They have to have it of ESD purposes, if nothing else. Datasheets will specify max internal current clamp on a pin that is allowed. So in theory, all you need is to check if current into pin will be too much. This is what at the moment was protecting your MCU input pin.To be sure, you can make a discrete clamp like that from two diodes and a resistor and connect it before input pin on a MCU. Two 1N4148 will do excellent job, and calculate resistor to fit the bill.There are also ready made dual diodes for this purpose only but not important here.This way you don't have diode drop, and all extra current will be shunted into power rails. Of course, make sure that input clamp doesn't inject more current into power rails than they can absorb.

author: ajb
author_rank: Super Contributor
timestamp: January 13, 2022, 04:52:56 pm
content: Quote from: 2N3055 on January 13, 2022, 09:13:04 amNot "all"! Many, yes, but a common exception are 5V tolerant inputs on many MCUs. Since those have to be allowed to go above the positive supply it's not possible to use a steering diode to Vdd. I would assume these use a TVS diode or similar in the ESD protection block instead, but the STM32 datasheet I looked at says that positive current injection is "not possible" on FT pins, so I don't know how that works. Active clamp I guess?An external steering diode or two is generally a good idea anyway because they'll have better specified behavior, and you can insert additional filtering/current limiting resistance in between to further protect MCU pins from really nasty events on those inputs if necessary.

author: 2N3055
author_rank: Super Contributor
timestamp: January 13, 2022, 05:35:16 pm
content: Quote from: ajb on January 13, 2022, 04:52:56 pmWell you are right, not "all" have this exact configuration. 5V tolerant GPIO pins on MCUs have only bottom diode. But it is common for standard logic chips not meant to be tolerant to higher level logic, and many analog chips too. Atmel AVRs have it, ST ARMs that are not 5V tolerant have it..etc. etc.I didn't want to go into details and I didn't explain well. It would be better that I sad "this is the common circuit inside chips for protection".But point is, that is why, especially in that case, putting this kind of clamp is perfect for this application.as for ST this is their explanation for 5V tolerant MCUs in AN4899:Caution: A TT or FT GPIO pin has no internal protection diode connected to supply (VDD). There isno physical limitation against over-voltage. Therefore, for applications requiring a limitedvoltage threshold, it is recommended to connect an external diode to VDDI guess that "positive current injection is "not possible" on FT pins" means we shouldn't do it...

author: DavidAlfa
author_rank: Super Contributor
timestamp: January 13, 2022, 08:03:20 pm
content: Given the the input impedance, you can skip the diode, use 10K pullup and 100K for the input.Even in the worst case (short to 12V), the current going into the input would be minimal, handled by the ESD diodes.I used a pic in capture mode, 100K worked perfectly to read the signal from an IR receiver.