Reading the Hall sensor of a 3 wire Fan - Success and Failures - Page 1
Forum section: electronics / beginners

author: castingflame
author_rank: Regular Contributor
timestamp: October 07, 2018, 09:44:33 pm
content: I have been designing a '3 wire fan' control as part of my uC project. My latest revision is using MOSFET high side switching and is working as expected without issue.I am also using the uC to read the hall sensor of the fan to get the rotational speed. The fans are just the standard 12v type and my uC is 3.3v.The schematic attached is just a section of the full circuit for the fan(s) and does not include a small filter capacitor.Using aNoctua NF A4X20 FLXfan, the scope shows a clean square waveform and the uController reads the speeds correctly.If I then switch to various other budget fans like the these...https://www.ebay.co.uk/itm/3Pcs-DC12V-3-Wire-Pin-8015-80mm-15mm-PC-Computer-Case-CPU-Cooler-Cooling-Fan/263957874785?_trkparms=aid%3D555017%26algo%3DPL.CASSINI%26ao%3D1%26asc%3D20151005190540%26meid%3Dca7102f05eac4a3297dde3b6809d8aff%26pid%3D100505%26rk%3D1%26rkt%3D1%26%26itm%3D263957874785&_trksid=p2045573.c100505.m3226... I get a much noisier signal. I have used a 100nf to filter some of it out and the waveform looks much better (signal to noise wise). Where the Noctua has a rising edge, on time, falling edge type square wave, the cheap eBay type fans do not (seem to). The signal just looks like spikes of a rising/falling edge without the 'on' period. If I drag my finger on the running fan I can see the frequency change so it is working after a fashion.I am aware that most fans have 2 pulses per revolution but they can be 1,2 or even 4.Tomorrow I will take some scope pictures to flesh this out a bit.Additionally, LEDs flashing in my circuit can be seen on the waveform of the hall sensor with the cheap fans. I have not checked this with the Noctua yet.It maybe that I will have to use higher quality fans for the project but I would be interested to hear other peoples experience with these hall sensors and any suggestions for things to try or changes to help improve my circuit.I did think about using the 'spike' to trigger a logic gate, flip flop, etc which I imagine would work but I would like to learn a little about 'conditioning' the signal if it is a possible fix.Update to follow.

author: ggchab
author_rank: Frequent Contributor
timestamp: October 08, 2018, 09:53:09 am
content: You simply need the 10K resistor between the yellow cable and the +3.3V as this is an open collector output.That's what I am doing and it works perfectly.

author: castingflame
author_rank: Regular Contributor
timestamp: October 08, 2018, 12:29:15 pm
content: UpdateNow back at it and found the issue.The Hall sensor on the cheap eBay fans (various types) have a very low voltage level output, or if it is 'open collector', not going to GND when the signal has been 'pulled up' to VCC/VDD.1. The reason I am using the 10k pull up to 12v and voltage divider to scale to approx 3v is because the fans are/will be 'Isolated' from the uController. There will probably be a clamping Zener too but it is not shown in the original image.2. All GNDs for the scope, Fan and components shown share the 12vGND.3. I am not using PWM for fan control, Just standard switching from the uController at the moment.4. I am using a MOSFET in a 'high side' switching design for the fan power so that the fan always has a path to GND and keeps EMI down to a minimum.This shows the position of the scope probes.Using a Noctua 12v DC Brushless Fan.A little bit of noise but everything looks good. The scaling of the voltage divider is fine and a good looking waveform. This also works correctly and the uController reads the fan rotations correctly.A cheap eBay (Chinese) 12v DC Brushless Fan (Using the same setup as before).You can see the 'Spikes' of the hall sensor output on the DC bias. Very small butnot going to GND!ggchab Suggested circuit. (thanks!)and the results ...no surprise there.No components ...and zoomed in to see the waveformlooks usable, maybe with an OpAmp ... but,every few seconds there is an additional signal being picked up by the hall sensor...Manually stopping the fan I can see that same 'interference' signal repeat at regular intervals. I have not looked at any cause for this at the moment as it may be a mute point. The Noctua fan does not suffer with the issue. This maybe because the hall sensor signal levels are much stronger/ 'emitter' going to GND, on the Noctua and the 'interference' is in the millivolt range. Maybe it is there but not too noticeable?My personal conclusionThese cheap Chinese fans from eBay are not outputting a very strong (or not going to GND with pull up resistor) or clean signal in comparison to a Noctua. I have tried various models of thesecheap fans that I have lying around and most have low voltage hall sensor output and are picking up additional 'noise'. The noise may not be too much of an issue if it were at least giving a better output.Obviously I could just buy better quality fans, but I am a little confused why other people are not having the same issues.I moved to a MOSFET highside fan switching design so that there is a path to GND all of the time for the MOSFET.I am not using PWM for fan control at the moment either so no noise is being created by that to the hall sensor.If I want to get this working I guess I could track down what is causing the additional spikes, remove them somehow. If this hall output is indeed 'Open Collector' then I do not understand why, after pulling the signal up to VCC/VDD via a resistor, it does not get the 'emitter' to GND.This is where it is failing.Additionally, I would also like to learn about removing 'noise' from a signal but I imagine that is a bit of a black art. Any helpful 'novice' info on this subject would be appreciated. At least my LC meter from Japan arriving tomorrow made it through the Typhoon!I think I will now rebuild the fans on a new clean breadboard and go from there.All suggestions welcome.

author: castingflame
author_rank: Regular Contributor
timestamp: October 09, 2018, 09:01:37 am
content: After a fresh build on a new Breadboard I still have the same results from 3 types of cheap Chinese fans.I have purchased a few decent quality used fans from eBay and I will try those next.I will post my results.

author: aheid
author_rank: Regular Contributor
timestamp: October 12, 2018, 11:24:28 am
content: Not sure about 3-wire fans, but the 4-wire spec says the following:QuoteThough with open-collector/drain I suppose it shouldn't matter much that you only pull up to 3.3V?From the Noctua fans I've measured, which have a similar nice pulse to what your higher-quality fans, I presume they have a comparator and a small RC circuit as "debouncer". The cheap ones probably just have the Hall sensor directly hooked up to the output transistor?In any case, please post a follow-up

author: castingflame
author_rank: Regular Contributor
timestamp: October 12, 2018, 01:32:37 pm
content: I am actually pulling up to 12v then scaling back the pulse to approx 3v. I am doing this because the fans are on the 'isolated' side of the microcontroller.What you say about the difference in fans makes sense. I now have some other fans to try so I'll report back in a few hours.Thanks for taking the time answer.

author: castingflame
author_rank: Regular Contributor
timestamp: October 12, 2018, 02:13:41 pm
content: I have 3 new(Used) fans to try. They are ;Intel CPU fan (4 wire), Foxconn 60mm (4 wire), BGears 30mm(3 wire).All fans were used in the 3 wire mode. The yellow wire was pulled up to 12v via a resistor in all cases.ResultsIntel CPU fan (4 wire)Foxconn 60mm (4 wire)BGearsConclusionAs expected, all the higher quality fans are completely fine and will work without issue. I am more surprised really that this 'issue' is not all over the internet.While I was going to buy the better quality fans for my project anyway, I will still spend some time to make the cheap Chinese fans usable; albeit at a much lower priority. It seems like a good opportunity to learn. I will investigate the guesstimate/fact, kindly mentioned byaheid,that they may 'have a comparator and a small RC circuit as "debouncer" '.I will leave the post open still to report back the results with the Chinese fans in a few days or so.