I've made a circuit which is supposed to take the output of a Hall effect sensor and divide by 5, so that I get one pulse per revolution of a motor. The motor is a Nidec FY9S40 variant.

Since the current out of the Hall effect sensor is very low, I have used a HCPL-4701 optocoupler. I then feed the output of the optocoupler into a CD74HC4017 counter. I have read that CMOS chips are very sensitive and can trigger on unwanted pulses if you for instance use a breadboard for testing, so I soldered the following circuit on a experiment board:

enter image description here

This worked quite well. I had what appeared to be some false resets now and then, but I assumed this was due to long wires between input at HALL_1 and output 19(Rx1). I made a proper printed circuit board. The problem is that when I got this and assembled the parts, the dividing does not seem to work at all. It is off every 3-4 rotations of the motor.

Yesterday, I came across some posts about current transfer ratios and calculating the resistor values of optocouplers. Due to the low output current, I found that perhaps R27 should be higher. I went with about 40K. This produced a cleaner square wave out of the optocoupler when I also lowered the value of R22 to 2k and removed R9. I believe these two resistors are in parallel anyway.

Can anyone spot some obvious mistakes in my design?

Are there some special precautions I should have taken when laying out my board?

(C14 and C7 are placed right next to their corresponding integrated circuits.)


2 Answers 2


The optocoupler is probably doing more damage than good. It takes considerable current to drive the LED in the optocoupler. The 4017 is built in CMOS technology. Its inputs will draw virtually no current as compared to the optocoupler.

What you need is a Schmitt trigger to convert the most definitely not square wave output of the Hall effect sensor to a nice, neat square wave.

You might use something like the 74HC14. It is an inverter with Schmitt trigger inputs.

From the datasheet of the CD74HC4017:

enter image description here

That's 01. to 1 µA of current for the input of the CD74HC4017 versus 40µA for the optocoupler.

The leakage currennt for the 74HC14 is identical:

enter image description here

Both beat the pants off the optocoupler as far as input current is concerned.

The Schmitt trigger also has the advantage of being designed for what you really need - squaring up a squishy signal to be used as an input for the counter.

  • \$\begingroup\$ Which is why I used HCPL-4701, because the diode require as little as 40uA to drive the LED. But I will try your suggestion. \$\endgroup\$
    – Niclas
    Commented Jul 30, 2021 at 8:27
  • \$\begingroup\$ 40µA is still far more than the inputs of the 4017 wil draw. \$\endgroup\$
    – JRE
    Commented Jul 30, 2021 at 8:29
  • \$\begingroup\$ @Niclas I agree with the Schmitt trigger input suggestion. Most version of the 74xx17 do not have Scmitt inputs. I have used the 74HC14 extensively on slow rise clocks & noisy with good results. \$\endgroup\$
    – Russell McMahon
    Commented Jul 30, 2021 at 10:29
  • 1
    \$\begingroup\$ This was the solution that seemed the easiest to integrate into the pcb that I had already designed and received. It produced a good result. Thankyou for the quick replies. i.sstatic.net/jSCnM.jpg \$\endgroup\$
    – Niclas
    Commented Aug 5, 2021 at 7:01

Using an optocoupler to amplify the Hall output is a cardinal mistake. Optos are used for galvanic isolation, that you don't need it. You should use a comparator to buffer the hall output.

  • \$\begingroup\$ I initially thought I should separate the hall from the rest of the circuit. But I saw at a later stage that I needed to connect the hall gnd to the gnd of the rest of the circuit, so I agree that it sort of lost its purpose. I will check if I can use your solution as well. \$\endgroup\$
    – Niclas
    Commented Jul 30, 2021 at 8:32
  • \$\begingroup\$ @Niclas You could separate stages only with a separate galvanicaly isolated PSU with a kind of hall buffer (comparator with hystersis, schmitt trigger,...) and only then you can pass it to the optocoupler, once you already have a stable square wave. \$\endgroup\$ Commented Jul 30, 2021 at 9:22

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.