PWM controlled fan tacho wrong

maxus1998
Posts: 11
Joined: Tue Dec 31, 2019 4:08 pm

Re: PWM controlled fan tacho wrong

Postby maxus1998 » Mon Jan 06, 2020 9:42 pm

I discovered that using a longer cable from the pull up resistor to the reading pin seems to bring correct readings.
Because of this I tried using a 330 Ohm Resistor instead of the longer cable which also seemed to work...

My goal is to turn this into a PCB. Would I need to add those resistors there too? This would need addittional 8 resistors...
Any idea how that behavior works?

ESP_Sprite
Posts: 9730
Joined: Thu Nov 26, 2015 4:08 am

Re: PWM controlled fan tacho wrong

Postby ESP_Sprite » Tue Jan 07, 2020 2:25 am

Hard to say without scope readings... we have no clue what's going on on that line at the moment, especially because the fan electronics itself is more-or-less a black box. (On a side note, your worry about having to design in 8 resistors is... interesting. If I were in your position, I'd just design in the positions for those resistors regardless, and fill them with 0 ohm links if they turned out to be unnecessary.)

maxus1998
Posts: 11
Joined: Tue Dec 31, 2019 4:08 pm

Re: PWM controlled fan tacho wrong

Postby maxus1998 » Tue Jan 07, 2020 5:04 am

I am happy to use those additional 8 resistors, I am just not sure if it is the correct solution,

What exactly do you mean with scope readings? Did you just miss my post with the pictures or would you want to see something else?

ESP_Sprite
Posts: 9730
Joined: Thu Nov 26, 2015 4:08 am

Re: PWM controlled fan tacho wrong

Postby ESP_Sprite » Tue Jan 07, 2020 9:16 am

Ah, I'm sorry - I indeed missed the readings because of the pagination of the topic.

From what I can see, your issue may very well be that the ESP32 is triggering on noise induced by the regulation of the fan; adding a R in the line probably creates a RC-filter in combination with the implicit capacitance of your wiring and the ESP32 pin. Can you try removing the resistor and adding a capacitor of, say, 1nF from the tacho output to ground? In combination with the pullup, this sort-of makes the RC network more explicit and should filter out the spikes in a more deterministic way.

maxus1998
Posts: 11
Joined: Tue Dec 31, 2019 4:08 pm

Re: PWM controlled fan tacho wrong

Postby maxus1998 » Tue Jan 07, 2020 10:41 pm

Adding the 1nf capacitor did indeed help. The values seem quite realistic but a bit high now. I read 3000rpm ok my 400-2000 rpm fan, while the slower noctua one looked fine.
I will try to use a slightly higher value capacitor tomorrow and get some new measurements with the capacitors.

ESP_Sprite
Posts: 9730
Joined: Thu Nov 26, 2015 4:08 am

Re: PWM controlled fan tacho wrong

Postby ESP_Sprite » Wed Jan 08, 2020 2:57 am

Sure. If you want to go all-in, you can also have the series resistance in to create a 'proper' RC filter (so fan tacho out - resistor to 3.3V - series resistor - capacitor to gnd - esp32 input pin).

maxus1998
Posts: 11
Joined: Tue Dec 31, 2019 4:08 pm

Re: PWM controlled fan tacho wrong

Postby maxus1998 » Wed Jan 08, 2020 9:03 pm

I swapped the 1nf capacitor now for a 680pf and the values read by the ESP32 seems to be fine. The Corsair fan reaches right around 2000RPM and the noctua one about 1600RPM, both values are the manufacturer specifications for the maximum speed.

I can't spot any difference on the oscilloscope when using the capacitors. I don't know why but I guess I will take it as it is

So many thanks for your help!

I will ask back if I have any other awkward problems with this setup again

jelly32
Posts: 4
Joined: Wed Feb 19, 2020 8:30 am

Re: PWM controlled fan tacho wrong

Postby jelly32 » Wed Feb 19, 2020 7:25 pm

Just to let you know, I had exactly the same challenge and was very happy to find this thread.
I don't have an oscilloscope, but I tried a lot of combinations of pullup resistors and RC filters.
I got the best results with: fan tacho out - pullup resistor 10k to 3.3V - series resistor 3.3k - capacitor 100 pF to gnd - esp32 input pin
It works successfully with a noctua fan (max 1500 rpm) and a cpu fan (max 2400 rpm).

JohnnyG
Posts: 3
Joined: Tue Apr 28, 2020 2:56 pm

Re: PWM controlled fan tacho wrong

Postby JohnnyG » Fri May 08, 2020 2:20 am

I'm attempting to do the same thing. Is the code in the original post all that is needed?

I have a NF-A4x20 5V PWM fan. I am not even sure if the esp32 can drive that thing. I already have the temp code and webpage on/off swatch working so I want to stick with the esp32. If the esp32 won't drive it directly, I could switch over to an Arduino...I just like the esp32 a lot better.

You do you all think?

Thanks
JohnnyG

ShakataGaNai
Posts: 2
Joined: Thu Jun 25, 2020 5:25 pm

Re: PWM controlled fan tacho wrong

Postby ShakataGaNai » Thu Jun 25, 2020 5:26 pm

jelly32 wrote:
Wed Feb 19, 2020 7:25 pm
I got the best results with: fan tacho out - pullup resistor 10k to 3.3V - series resistor 3.3k - capacitor 100 pF to gnd - esp32 input pin
It works successfully with a noctua fan (max 1500 rpm) and a cpu fan (max 2400 rpm).
Jelly32 - Do you have a drawing of this? Even a quick sketch. I'm happened across this post and am trying to replicate your setup. My circuit design skills are only meh. Thank you so much!

Who is online

Users browsing this forum: Google [Bot] and 91 guests