0
\$\begingroup\$

I have a case type 12 V 3-pin fan and I would like to connect its tach signal wire to an ESP32 input pin. Power supplies to ESP32 and the fan are separate, but the ground wire is common.

Based on some posts in google, internally the tach wire gets connected to ground wire twice during each fan rotation cycle. If it is that simple, should I just connect this wire to an ESP32 input pin and have a pull up resistor connected to 3.3 V? If so, what is the minimal reliable current or range the resistor should be calculated for - is it 12 mA or less? Or can the ESP32 pin be configured to use an internal pull-up resistor so the external resistor is not required?

\$\endgroup\$
10
  • \$\begingroup\$ yeah, setting the gpio to INPUT_PULLUP should work to read open collector outputs. I would make sure that there's not ever 12v on the signal before connecting it to an esp, just in case the fan isn't like what you read or described. If it is 12v pulses, use a voltage divider to chip that to 3v, and set the GPIO as a normal INPUT \$\endgroup\$
    – dandavis
    Jan 22 at 8:56
  • \$\begingroup\$ Read the answers to electronics.stackexchange.com/questions/69613/…; the easiest solution is a resistor and a diode to ensure you don't get 12V on your ESP32. \$\endgroup\$
    – Paul
    Jan 24 at 15:32
  • \$\begingroup\$ @dandavis. Kind of same question with regards to the voltage divider - should there be some current consideration? For example, to get 3 / 12 division, I can use 3K + 9K resistors, but I can also use 3M + 9M resistors? \$\endgroup\$
    – Serge
    Jan 29 at 3:18
  • \$\begingroup\$ targeting 1ma should suffice. Use INPUT instead of INPUT_PULLUP in that case. \$\endgroup\$
    – dandavis
    Jan 29 at 6:18
  • \$\begingroup\$ @Paul. Being a person with some theoretical knowledge and virtually no practice, I found that solution elegant. But it helped me realize that, while I have some idea how to calculate resistors to connect MCU output pin to a transistor using load current, transistor current gain and Ohm's law, I have no idea how to calculate resistors for MCU input pin. That schematic shows 10K pullup resistor connected to the MCU's input pin, which should mean about: (5V - 0.6V) / 10K = 0.00044mA. \$\endgroup\$
    – Serge
    Jan 30 at 1:13

1 Answer 1

0
\$\begingroup\$

I don't have practical experience with the fan you're referring to but if what you say is correct, connect a multimeter to the tach o/p and gnd on the fan and power it up. If it uses an active internal pulse o/p you should see an AC signal on the tach o/p pin. https://www.petervis.com/electronics%20guides/cpu%20fan%20tacho/cpu%20fan%20tacho%20schematic.html Follow the link above.

If you have an oscilloscope, you will be able to see the signal, of course. For a simple answer to the resistor value, look at the sink current for the ESP i/p pins. Work on that current and use the fan supply voltage for a safe resistor value.

\$\endgroup\$
1
  • \$\begingroup\$ It looks like all messages here are that most fans will not have the tach wire just connected to ground as the fan rotates, but may supply some voltage so the input pin requires some protection. I also saw some mentioned hall sensor used. I have a few fans and I should be able to check them with oscilloscope. \$\endgroup\$
    – Serge
    Jan 29 at 3:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.