I have a 3-wire 12v DC fan (Sanyo Denki 9S1212M4011). It's actually getting 15V because my "12V" wall wart isn't accurate.

When the fan is not running my multimeter tells me there is 14V on the yellow sensor wire. When the fan is running the sensor presents approx 1.7V. I don't have a oscilloscope, but I guess this represents 3.3V at a 50% duty cycle as generated by the sensor.

I'm successfully measuring the fan speed with a Raspberry Pi. I connect the sensor to a GPIO pin, pull it high, and then run a little C code to count each time the pin is pulled low by the fan sensor.

My problem is that I have to connect the sensor directly to the GPIO to be able to read the speed. This feels very wrong because when the fan is not running there are 14V on the pin. I tried using a voltage divider so that the pin never sees more than 3.3V, but when I do that the GPIO never gets pulled high.

So I haven't blown the pin yet on Pi, but I half expect that I will. What's the right way to connect the sensor to the Pi?


Sadly my Pi is now dead! There's no power - the red LED doesn't even come on. The configuration was as described above and nothing unusual happened - I just came home to find it dead. I assume it is related to the 14V on the pin, but I don't know what lesson to learn from this. Bummer!

  • Oh dear. That's bad. You weren't using the fan in situ on a motherboard were you? PC fans are meant to have output pin pull-ups on the motherboard, not in the fan.
    – joan
    Nov 22, 2014 at 20:58

2 Answers 2


The yellow wire would normally be an open collector/open drain output which reads low as the magnet nears the Hall effect sensor and reads high otherwise. As an open collector the yellow wire will pull down to ground, never push up to a high voltage.

If that's the case it is quite safe to connect it to a Pi gpio. Pull the gpio up to 3V3 using the internal pull-up or an external resistor. The gpio will then normally read high but will read low once per revolution (or more if more magnets are connected to the fan).

The fact you haven't already destroyed the gpio/Pi seems to support this view.

I don't know how you could verify this though.

  • Thanks Joan. You've supported what I was thinking, and this was my best attempt at verification - ask someone else! :)
    – TrevorJ
    Nov 17, 2014 at 20:05
  • @TrevorJ I suppose you could keep the fan in one position so that it stays high and then measure the voltage at the gpio. If it reads 3V3 you should be safe.
    – joan
    Nov 17, 2014 at 20:13

Just wanted to mention that your pi may not be completely dead. I was running my old Model B on solar and had some sort of power failure or spike and my pi stopped turning on, the red light didn't even come on just like yours, and I thought I had destroyed it. It sat for most of the summer and then I decided to try and figure out what happened to it. I discovered that all Pi boards (I think) have a polyfuse in the power supply circuit that will blow in the event of a overvoltage caused by overloading a GPIO or something else. Turns out that these are basically self-healing fuses and given enough time will usually heal and pass current again. So I grabbed my old pi and plugged it in and sure enough, after sitting all summer, it worked! Even if you tossed your pi and got a new one, hope this can be used in the event of a future pi failure.

  • I did indeed bin the Pi so I'll never know, but thanks for sharing your experience David.
    – TrevorJ
    Nov 10, 2015 at 22:38

Your Answer

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

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