Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

Arduino Hall sensor (Pull up resistor)

Olaf6541
 Share

Hi all!

I have a question about connecting the Hall sensor of the tachometer of a 12V fan to the Arduino.

I understand how a Hall sensor works:

hall-effect.jpg

But I don't really understand if the Hall voltage is measured between two points there's only one wire coming out of the fan?

What voltage does the tacho wire of a fan read? Does it oscillate? 0-5V? 0-12V?

 

I've seen people use the following setup:

PF1mWzL.png

I don't understand what the point is of the 3.3V and the R1 resistor, the 20-50k pull up resistor itself  is already embedded in the board so why add a resistor/3.3V anyway?

 

I also saw this setup:

YAVE8y9.png

Would this work and why (not)? I cannot  send 12V into the input pin so how do I regulate that?

I found many examples but none that actually explains why it's wired in a certain way so if anyone could explain how a Hall sensor is hooked up to the Arduino I would appreciate that.

Thanks!

Link to comment
Share on other sites

Link to post
Share on other sites

Quote

Fan shall provide tachometer output signal with the following characteristics:
• Two pulses per revolution
• Open-collector or open-drain type output
• Motherboard will have a pull up to 12V, maximum 12.6V

source: Intel 4 pin fan spec

Top signal is the tachometer output. 

IMG_20181002_215202.thumb.jpg.9eeaa5e2faed2870ee578b55cb7ac616.jpg

The internal pull up can be used but using a external pull up also works. The benefit of a external pullup is you know the resistance/current of the pullup.

What i don't get why you use a 3.3V pull up and a 5v digital pin.

Link to comment
Share on other sites

Link to post
Share on other sites

13 hours ago, Olaf6541 said:

But I don't really understand if the Hall voltage is measured between two points there's only one wire coming out of the fan?

What voltage does the tacho wire of a fan read? Does it oscillate? 0-5V? 0-12V?

You're not accessing the fan's Hall sensor directly trough the tacho output, it is only used by the fan's controller internally. Instead the fan has a open collector output as such:

 

fan_oc.gif.795adafefbb12a09d89fa641db0a769c.gif

 

When the fan turns the transistor on, the signal line will be pulled to ground by the transistor. When the transistor is off, no current can flow and the line is floating, which can be seen as the line being disconnected. This is an important concept one must grasp in electronics: A connection to ground (0V) and no connection at all are 2 very different things. Thus, a pull-up resistor is required to pull the line up to a known voltage when the fan's transistor is off. The resistor also prevents a short circuit when the fan's transistor is on. The reason they use a setup like this is because it allows systems running on different voltage levels to easily communicate. You could make a 12V fan communicate with a 5V controller by simply connecting the pull-up resistor to 5V. As @James Evens has shown, the output is a square wave which pulses at a rate proportional to the fan's speed.

 

13 hours ago, Olaf6541 said:

I don't understand what the point is of the 3.3V and the R1 resistor, the 20-50k pull up resistor itself  is already embedded in the board so why add a resistor/3.3V anyway?

 

As explained above, the pull-up should be connected to the same power supply as the micro-controller itself. If the micro-controller on your arduino is running on 3.3V, the pull-up should be connected to 3.3V. Is the arduino running at 5V, then the pull-up should be connected to 5V.

A reason to use a external pull-up resistor, rather then the high value internal pull-up, is to have a stronger pull-up current. The lower the pull-up resistor's value, the more current it allows to flow and the stronger it pulls up. If you're going to connect to a fan, potentially trough some long wires, the wires parasitic capacitance together with the pull-up resistance can start to form a low pass filter. This can potentially distort the square wave you're trying to measure an screw up your readings. A lower pull-up value will increase the filter's cut-off frequency and thus mitigate the problem. However, there's a limit. When the fan is pulling the line low by enabling it's transistor, the only thing limiting the current is the pull-up resistor, too low a value can destroy the fan's transistor.

Link to comment
Share on other sites

Link to post
Share on other sites

11 hours ago, James Evens said:

source: Intel 4 pin fan spec

Top signal is the tachometer output. 

 

The internal pull up can be used but using a external pull up also works. The benefit of a external pullup is you know the resistance/current of the pullup.

What i don't get why you use a 3.3V pull up and a 5v digital pin.

 

51 minutes ago, Unimportant said:

You're not accessing the fan's Hall sensor directly trough the tacho output, it is only used by the fan's controller internally. Instead the fan has a open collector output as such:

 

When the fan turns the transistor on, the signal line will be pulled to ground by the transistor. When the transistor is off, no current can flow and the line is floating, which can be seen as the line being disconnected. This is an important concept one must grasp in electronics: A connection to ground (0V) and no connection at all are 2 very different things. Thus, a pull-up resistor is required to pull the line up to a known voltage when the fan's transistor is off. The resistor also prevents a short circuit when the fan's transistor is on. The reason they use a setup like this is because it allows systems running on different voltage levels to easily communicate. You could make a 12V fan communicate with a 5V controller by simply connecting the pull-up resistor to 5V. As @James Evens has shown, the output is a square wave which pulses at a rate proportional to the fan's speed.

 

As explained above, the pull-up should be connected to the same power supply as the micro-controller itself. If the micro-controller on your arduino is running on 3.3V, the pull-up should be connected to 3.3V. Is the arduino running at 5V, then the pull-up should be connected to 5V.

A reason to use a external pull-up resistor, rather then the high value internal pull-up, is to have a stronger pull-up current. The lower the pull-up resistor's value, the more current it allows to flow and the stronger it pulls up. If you're going to connect to a fan, potentially trough some long wires, the wires parasitic capacitance together with the pull-up resistance can start to form a low pass filter. This can potentially distort the square wave you're trying to measure an screw up your readings. A lower pull-up value will increase the filter's cut-off frequency and thus mitigate the problem. However, there's a limit. When the fan is pulling the line low by enabling it's transistor, the only thing limiting the current is the pull-up resistor, too low a value can destroy the fan's transistor. At 3.3 or 5V, a 1K resistor would result in 3.3 or 5 mA, which is well within safe limits and also a low enough resistor value that should work even with rather long wires going to the fan.

Thanks, that's really useful information! So if I understand correctly now, the tacho is either connected to the ground, or to an (external) voltage source? So by wiring it this way:

FnRWWWH.png

- When the transistor is on, both 12V and 5V are connected to the ground and the current from the 5V flow through the green wire into the fan to ground and the input pin (purple) is at 0V. So everything after the pull up transistor is grounded to 0V.

- When the transistor is off the resistor in the input pin (order of megaohms, not the kiloohm built-in pull up) is so much higher than the pull up resistor that all of the pull up 5V reaches the input pin.

Is this correct?

I got two 470 ohm resistors that I can use to make a ~1k ohm pull up resistor.

Link to comment
Share on other sites

Link to post
Share on other sites

5 hours ago, Olaf6541 said:

When the transistor is on, both 12V and 5V are connected to the ground and the current from the 5V flow through the green wire into the fan to ground and the input pin (purple) is at 0V. So everything after the pull up transistor is grounded to 0V.

The 12V just feeds the fan and has nothing else to do with it. Apart from that, yes, you are correct.

 

5 hours ago, Olaf6541 said:

When the transistor is off the resistor in the input pin (order of megaohms, not the kiloohm built-in pull up) is so much higher than the pull up resistor that all of the pull up 5V reaches the input pin.

Correct again.

 

5 hours ago, Olaf6541 said:

I got two 470 ohm resistors that I can use to make a ~1k ohm pull up resistor.

If you put them in series, yes, that should work.

Link to comment
Share on other sites

Link to post
Share on other sites

3 hours ago, Unimportant said:

The 12V just feeds the fan and has nothing else to do with it. Apart from that, yes, you are correct.

 

Correct again.

 

If you put them in series, yes, that should work.

Thanks, I added this to my fan controller.

Link to comment
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share


×