1
\$\begingroup\$

I have my circuit configured this way because I'll be hooking up my 8051 microcontroller GPIO pin to the point where three resistors (R2, R3, and R4) intersect, and the microcontroller only outputs my choice of high-impedance and ground, never VCC. The 500K was included in this circuit because I was simulating that the micro was producing a high-impedance output.

Other than 500K, what would be the absolute maximum resistor values I can use for R1, R2, and R3? The target device needs at least 3.5V input for a logic high and less than 3V for logic low.

Is my logic sort-of right if I did the following math?:

 Target voltage wanted for logic high (3.5V)
 divided by 
 Target device leakage current
 Then
 Result divided by sum of Result + R1 times 5V = Target voltage?

I ask because I'll be running this circuit off of a regulated 5V source which is powered by batteries.

circuit

\$\endgroup\$
1
\$\begingroup\$

Let's consider the case when the output from the MCU is LOW(ground) the base of the transistor is now at zero volt. Q1 is off now we can determine the value of R1.

R1 depends on how much current the device connected to the output draws since you Haven't specified any current i will assume the device draws 10 uA (for worst case scenario).

The output must be above 3.5 V for the device to interpret it as a HIGH level and of course we must leave a margin for error and higher current and i will keep it at least 4 V.

With my assumption only 1 V is left for R1 to drop (Vcc-4 V) = 1 V. Knowing the voltage and current through R1.

R1 can be calculated R1 = 1V/1uA = 100 kohms this value depends on the current may Be greater if the current is less than 10 uA but if it's not then increasing it above this value may result in undefined output logic level.

R2 must five or ten times less than the leakage resistance at high impedance input or 100-50k for the 500k shown in the schematic.

\$\endgroup\$
  • \$\begingroup\$ How did you arrive at the 5 or 10 times less rule? \$\endgroup\$ – Mike Apr 15 '18 at 16:09
  • \$\begingroup\$ The high impedance resistance(Ro) of the MCU is in parallel With R2 and the equivalent resistance will be Req = (R2*Ro)/(R1+Ro) If Ro is 10 times greater than R2 then R2+Ro term can be Simplified to just Ro and Req will be approx. R2*Ro/Ro = R2 So if Ro > 10R2 we can neglect the effect of Ro on the base Resistor R2 \$\endgroup\$ – Mohammed Hisham Apr 15 '18 at 17:16
  • \$\begingroup\$ The factor "10" I have used is just because if one quantity is added to another one engineers neglect the smaller quantity If the bigger quantity is roughly ten times or more greater Than the smaller one \$\endgroup\$ – Mohammed Hisham Apr 15 '18 at 17:20
1
\$\begingroup\$

R2 depends on the leakage of the controller when it is high impedance, as the divider created by them must surpass Vbe of Q1 (around 500mV). You model the controller as tied to 5V when high-Z, but leakage to ground is what matters in this scenario as leakage to the supply only helps in this situation since it is in parallel with R2. Roughly speaking resistance of R2 must be less than 5x the leakage resistance to ground to achieve this 500mV with a 5V supply.

R1 depends on the leakage of the target as it creates a voltage divider when going high. So it must be less than half of whatever the target leakage to GND is to achieve 3.5V from 5V supply.

Check datasheet for leakage estimation as 500k is probably a bit low. I'd guess it is a few megaohms at least. Below is a link to a live online simulation where you can see current flow and play around with values easily. Finally consider how much you care about a few extra uA's vs how much you care about the thing working 100% of the time.

Falstad simulation.

\$\endgroup\$
  • \$\begingroup\$ Forget to mention if your controller never goes high then R3 serves no purpose and I removed it from the linked sim. \$\endgroup\$ – lucky bot Apr 14 '18 at 6:53
  • \$\begingroup\$ The thing is my controller is an 8051 and its GPIO line only has two states. logic low, and high-impedance. High-impedance allows and external low signal to affect the results of that pin. Your simulation is giving me the assumption that the input you're using is low-impedance. \$\endgroup\$ – Mike Apr 15 '18 at 16:07
  • \$\begingroup\$ I don't understand your last sentence. The sim is modeled exactly as you describe. On the bottom left corner the control line is either high impedance to GND (500k provided by your original example) or the switch closes for logic low. GPIO Inputs are not usually low-impedance. \$\endgroup\$ – lucky bot Apr 15 '18 at 16:17
  • \$\begingroup\$ I have the 500K connected to VCC because thats close to how the microcontroller works when I try to use it as a normal output. As a concrete example, I once tried hooking up an LED and 330 ohm resistor in series with anode of LED connected to GPIO and resistor grounded. After powering with good power and running software to toggle the GPIO pin, I got either an ultra dim LED output or no output. For best bright output, I had to connect GPIO to LED cathode then LED anode to 330 ohm resistor then that resistor to VCC. \$\endgroup\$ – Mike Apr 15 '18 at 19:14
  • \$\begingroup\$ Your MCU has what is called and open drain output then, common to older MCUs because it is cheaper than modern push pull output. Regardless it still has leakage to ground since it has the capability to connect to ground and that leakage is what we are concerned with in this circuit. \$\endgroup\$ – lucky bot Apr 16 '18 at 21:27
1
\$\begingroup\$

I believe that simplifying the circuit will help in understanding what "matters."
1 - The input will be simulated by a switch to ground this way when it closes, it provides ground and when it opens it provides "high Z."
2 - The 500K is eliminated (R4 is not needed).
3 - The output load is assumed 10 ua.
4 - Power source 5V.
5 - Transistor gain = 10.

Under these conditions, the value for R1 is (5-3.8V)/10ua = 120K. With this resistor and collector at gnd, Ic = 5V/120k = 42ua. Assuming a gain of 10, makes the Ibe = 4.2ua and with Vbe = .65V, (R2 + R3) = (5 - .65V)/4.2ua = 1,036k.

You can now "play around" with the values for R2 and R3. You can make R3 = 36k and R2 = 1 meg, or R3 = 100K and R2 = 936K, etc.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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