# Electronic – Open Collector Circuit Needs Pull-Up Resistor to Measure Frequency

digital-logicencoderfrequencyopen-collectorpullup

I need a little help determining what I need in order to measure frequency from an Encoder containing the attached Open Collector Output. The 5 Volts will actually be 24 Volts in my scenario (this is just the datasheet).

The device reading the output will be a NI cDAQ DI 24V Sinking Module. According to the datasheet, the minimum "ON" Current and Voltage is 3mA/11V. My thoughts are that I need an External Pull-Up resistor for wire Z and just read the period to get the Frequency. From what I've read, I'll need 3939 Ohms to do what I want.

I_en = 3mA; I_lkg = 30mA; I_pullup = I_en + I_lkg = 33mA
V_out = 24V; V_IH = 11V; R_pullup = (V_out – V_IH)/I_pullup = 3939 ohms.

Am I doing this right or am I completely off and not understanding this at all?  simulate this circuit – Schematic created using CircuitLab

Figure 1. Likely schematic for one channel of encoder with current sinking NPN transistor output driving PLC with current sinking input. The buffer would likely be a Schmitt trigger to prevent chatter on transition.

As you have correctly alluded to in your question, the problem is that you are using a current sinking output to drive a current sinking input. The best way to do this would be to use a converter unit or industrial opto-isolator but your method is not uncommon.

R4 value

The PLC is guaranteed to turn on at 3 mA / 11 V on the input. Let's give it 12 V to make the maths easier. R4 then has to drop 12 V at 3 mA. \$R = \frac {V}{I} = \frac {12}{3m} = 4~k\Omega \$. The next lower value is 3k9.

Q2 current

Now check the max current through the encoder transistor shown as 30 mA max. When Q2 is on R4 will be have 24 V across it. \$I_{max} = \frac {V}{R} = \frac {24}{4k} = 6~mA \$. We're fine. In fact we could decrease R4 to 3k3 for extra PLC margin if we wanted.

R4 power dissipation

Finally check the power rating of R4. Worst case will be if the encoder stops with Q2 on. \$P = VI = 24 \cdot 6m = 150~mW \$. A 1/4 W resistor would suffice.

Am I doing this right or am I completely off and not understanding this at all?

Your final result for the resistor value was correct - although your calculations are a little difficult to read.

[From comment:] And just one other thing. In your diagram you have 5V Input. Although, yes, the circuit I have for my encoder says 5V, I am told that 24V there is acceptable. Would you agree?

The datasheet says, "5 ~ 12 V dc ± 10%, 24 V dc ± 10% (open collector output only)." I would read that as the 5 V power input could take up to 12 V (remember it's powering the LED and the logic so the max voltage is limited and a 5 to 12 V range suggests CMOS chips). The open-collector output is probably good to 50 V but the manufacturer has de-rated it to 24 V as it's a normal industrial supply.

So where are you going to get 5 to 12 V DC in your panel. Again, the right thing to do is get a small PSU but we may be able to cheat again. Looking at my "likely circuit" we can guess that the LED is going to account for the majority of the current. (The current through the open-collector transistor, Q2, doesn't affect the current drawn at the 5 V input.)

Let's take some measurements. If you have an adjustable bench power supply use that. If not get whatever you can - 5 V USB charger, 9 V battery, etc. and take some measurements. Connect the common to negative and +5 V to positive via your multimeter on 200 mA range. Measure and record the current in each case while turning the encoder, looking for changes in readings as segments turn on and off. (I wouldn't expect any changes.)

Let's say it takes 25 mA at 5 V and 35 mA at 9 V. We could use a simple Zener regulator to supply the correct voltage. simulate this circuit

Figure 2. Simple Zener regulator.

We'll set this up so that the encoder is powered with 9 V and the Zener is barely conducting so that its power dissipation is kept to a minimum.

\$R = \frac {V}{I} = \frac {24-9}{35m} = \frac {15}{35m} = 430~\Omega \$.

Now check what happens if the encoder gets disconnected. We'll have 9 V across the Zener and 15 across the resistor. \$I = \frac {V}{R} = \frac {15}{430} = 34~mA \$. This current will run through the Zener so the power dissipated in it will be \$P = VI = 9 \cdot 34m = 306~mW \$. A Zener rated at 0.5 W should be fine and will run very cool if the encoder remains connected and draws steady current.