Sunday, 10 April 2016

amplifier - Logic level converter using Transistors


I am trying to make a logic level converter using transistor BC547. This is to convert Voltage level of Rpi Gpio from 3.3 to 5V. I have wired the circuit according to this diagram: enter image description here



I have done this to convert 3.3V to 5V for PWM application. I have connected the circuit to GPIO no 17 and set it high


Questions :


1) why is there no ground in the circuit?


2)I tried to measure voltage at the other end wrt ground, does not show anything.what is the problem?


Thankyou.



Answer



I hate adding an answer here, especially since the OP doesn't even need bidirectional operation. But the circuit is laid out terribly (for understanding it.) And the description about dogs and tails does not help, excepting perhaps alchemists trying to write down allegorical and mystifying bits of their "art."


(There are shared terms, developed over time and used in electronics to help communicate. A "pull-down" might be such an example. But they have survived the test of time and they do communicate using the general idea of pulling at a node, which isn't difficult to communicate when someone asks and is trying to learn the term. And it can be adapted easily to discuss "pulling harder", for example, without a loss of meaning. The idea of weak and strong are commonly held, as is the idea of pulling, and these are easily applied once someone has acquired the ideas of Ohm's law, voltage, current, and resistance.)


One way to use a BJT for level shifting is to use it in a common-base mode. Just wire the base to a rail and "pull down" on its emitter. You can place the resistor either at the base or at the emitter. All that's left to do is to use a pull-up on the collector. Given that we hope to achieve bidirectional use, the resistor will be placed at the base.


Here's an example when going from a \$3\:\textrm{V}\$ logic output towards a \$5\:\textrm{V}\$ logic input:



schematic


simulate this circuit – Schematic created using CircuitLab


Going in the the other direction it is very tempting to use a symmetrical approach:


schematic


simulate this circuit


But that doesn't work. Why? Because the base has \$5\:\textrm{V}\$ available to it and the collector's pull-up is hooked towards a lower voltage, \$3\:\textrm{V}\$. This means that the base-collector diode (no longer commonly shown on the symbol, though it once was when BJTs were themselves made more symmetrically) can be (and will be) forward biased. So when the BJT is supposed to be turned off, it actually isn't. Instead, there's a forward biased diode caught between \$5\:\textrm{V}\$ and \$3\:\textrm{V}\$ with two resistors to limit the current. So the output will be at some middling value above \$3\:\textrm{V}\$ but also not quite \$5\:\textrm{V}\$.


The symmetry fails.


It's easy to fix. We can just change the base voltage back to \$3\:\textrm{V}\$:


schematic


simulate this circuit



And that works.


Suppose you want to make this bidrectional. Could you just use two of these circuits, one for each direction?


schematic


simulate this circuit


And the answer is, yes you can. In fact, what I did is simply reproduce that dog-eating-tail circuit that the OP presented. It's the same thing. But now you can see the progression that led to it. And it's not as confusing as some odd, cross-wired dog-tail thing anymore. It's just two individually worked out circuits put together into one larger one.


But do you remember the earlier problem with the wrong circuit? The fact that there is sneaky base-collector diode that caused the circuit to operate incorrectly? This fact should remind us that all BJTs can also be operated in a reverse-active mode. Doing so, especially with the modern asymmetrical designs for their collectors and emitters, means that the \$\beta\$ in one mode will be different than the other (among some other differences.) But it does not mean they don't work.


So what if we just returned to our first circuit and merely add that extra pull-up:


schematic


simulate this circuit


Would this work? The answer is yes, it will indeed work. The only remaining question might be about which way to point the emitter. And this is where a good answer "depends." There are issues of charge storage to take into account, for example. (And this is a reason why there is a difference in behavior for the rising edge vs falling edge behavior shown in the graph by the OP.) The answer will depend on what you care about as there will be rising edge vs falling edge considerations and no one particular answer is always right. For my purposes here, I'm going to avoid dragging this out any further and instead leave that question as something to ponder. It's enough that this circuit works, regardless.





Note: The actual value of the resistors used in the above circuits isn't meant to imply that these are the only right values to use in some particular circumstance. Typically, digital outputs can sink more than \$1\:\textrm{mA}\$ of drive current and, typically, digital inputs will sink significantly less than \$100\:\mu\textrm{A}\$. But these assumptions may be wrong for specific cases. It's not hard to adjust the details, though. So the basic idea may still apply, though with reasoned changes in the resistor values.




There are more steps one might take, now. And Trevor found a nice example of where one might head. I'm going to include it here in order to capture that result. It's worth having. Those interested can consider the whys and wherefores. Without further explanation from me, enjoy Trevor's addition below:


enter image description here


No comments:

Post a Comment

arduino - Can I use TI's cc2541 BLE as micro controller to perform operations/ processing instead of ATmega328P AU to save cost?

I am using arduino pro mini (which contains Atmega328p AU ) along with cc2541(HM-10) to process and transfer data over BLE to smartphone. I...