It's days like this I need to remember that I'm a computer scientist, not an electrical engineer. On Fri, Jan 06, 2012 at 03:22:48PM -0200, Isaac Marino Bavaresco wrote: > Em 6/1/2012 12:28, Byron Jeff escreveu: > > On Fri, Jan 06, 2012 at 11:00:23AM -0200, Isaac Marino Bavaresco wrote: > >> Em 6/1/2012 10:26, Byron Jeff escreveu: > >>> On Fri, Jan 06, 2012 at 07:20:08AM -0200, Isaac Marino Bavaresco wrot= e: > >>>> Em 06/01/2012 06:34, William "Chops" Westfield escreveu: > >>>>>>> Is there anything I can add to protect the chip from unwanted neg= ative voltage? > >>>>> Well, to start with, there should be a substantial resistor; about = 10k. > >>>>> This will rely on the internal protection diodes to clamp the volta= ges to levels that won't cause problems. There is plenty of reason to assu= me that this is insufficient, but microchip does publish app notes where th= is is done (apparently successfully.) > >>>>> ... > >>>> I prefer to use an external Zener diode plus two resistors to clamp = the > >>>> voltages, forming a "T" with the Zener as the "leg" of the "T". > >>> What's the purpose of the resistor between the zener and the PIC inpu= t? > >> > >> If the RS-232 is connected when the PIC is not powered, the pin will > >> have 4.7V and the board will be powered by the PIC's internal parasiti= c > >> diode and large currents may flow through it, perhaps violating some > >> parameter. > > The series resistor will limit the incoming current. With a 4.7V zener = and > > a 4.7K series resistor, the maximum current the unpowered PIC will see = is 1 > > mA. All the rest of current from the higher incoming voltage will be > > shunted to ground by the zener. > > > If I understand it right, you use a resistor with one terminal connected > to the PC's RS-232 TX and its other terminal connected the the zener > cathode AND to the pin of the PIC, right? > > In this scenario your circuit may clamp the voltage below the zener > voltage and all the current will flow through the PIC's internal diode. > If the resistor is connected to a higher voltage then the current may be > much higher than your figures. I'm trying to work this through but I keep confusing myself. Let's share an example so that maybe I can lift the fog. Take a look at this simple zener regulator: http://en.wikipedia.org/wiki/Linear_regulator#Simple_Zener_regulator Fundamentally it's a resistor voltage divider with the zener as a shunt between the two resistors. In operation R1, the top resistor, limits the total current coming from the source, and the zener shunts current to keep the midpoint between the two resistors at the zener voltage. The way I've always thought about this circuit is that VS/R1 is the amount of current available to the zener and R2, and that since the zener is forcing the voltage between the two to the zener voltage, that the amount of current through R2 is fixed. But I'm realizing from your discussion that's only the case if R2 is fixed. If R2 is variable, then if it can accept more current, then it will regardless of the zener. Let me clarify with some numbers: VS =3D 14.1V (3 * 4.7V) R1 =3D 4.7k DZ =3D 4.7V R2 =3D variable The current available from R1 is 14.1V/4.7k =3D 3 mA. Now my (mistaken) thinking is that the zener would shunt 2 mA of that current and that a 4.7V/4.7K =3D 1mA supply would be available to R2. But that's only the case if the original voltage divider of R1/R2 develops a voltage above the knee of the zener, such as if R2 is not present. But if R2 is a dead short of 0 ohms, then it would draw all 3 mA across it and the zener would shunt no current since the voltage divider is 0V at the R1/R2 junction. That's the part I didn't see. So if R2 is the PIC, and it can draw 3 mA of power, it could certainly be powered through its inputs. So your T circuit splits R2 with a second resistor, say R2A and R2B and puts the zener between R1 and R2A which limits current to 1 mA. Makes sense now. > > Remember, the current through a resistor is proportional to the > difference of voltage between its two terminals. The only thing you are > guaranteeing is that the PIC's side terminal will never be higher than > 4.7V (probably), but you cannot control the voltage on the other side. But by added the second resistor, it guarantees enough resistance that R2 in total cannot sink all the current. > > > > > >> With the additional resistor (say 1K) the current will be limited to a > >> few mA, well inside the allowed range. In my example R2A would need to high enough to force the R1/R2A junction to br 4.7V or higher so that the zener kicks in. So for example a second 4.7K resistor creates a half voltage divider to 7V, the zener would lower the voltage to 4.7V and the maximum current would be 4.7V/4.7K =3D 1 mA even if the PIC (R2B) is a dead short. > > > >> > >>> For > >>> quick and dirty testing, I use a 4.7K resistor in series with the RS-= 232 > >>> output and a 4.7V zener. For more permanent circuits I use this as th= e base > >>> input to a NPN transistor inverter with a pullup resistor to protect = the > >>> PIC's input from the -0.7V the zener allows when the RS-232 output sw= ings > >>> negative. > >> > >> When using an NPN transistor I use a small signal diode from ground to > >> base to protect the base-emitter junction from reverse biasing. The PI= C > >> will never see the -0.7V because the base-collector junction will be > >> reverse biased, but the transistor's base-emitter junction may be > >> damaged as they are usually rated for -5V. > > The zener serves the purpose of that small signal diode with the input > > voltage is negative as the zener is now forward biased. So the base-emi= tter > > voltage is never more that -0.7V which is nowhere near the reverse bias > > breakdown voltage for the transistor. > > > My point is that in this situation the small signal diode will work the > same way as the zener, both will be forward biased and the base voltage > will never be less than -0.7V (or close to this). When the voltage on > the base is positive, the base-emitter junction will be forward biased > and the zener will never conduct, thus the use of a zener or a small > signal diode is indifferent. The advantage of the small signal diode is > that it may have a much lower capacitance, making switching faster. Got it. So a zener in a T configuration, or no zener, but a signal diode instead, with the transistor. BAJ > > > Isaac > > > > > > I haven't had any problems so far, and it's a heck of a lot easier than > > trying to track down a MAX232 or equivalent. I haven't seen a USB seria= l > > adapter yet that swings any more than +/- 5V, and every one so far work= s > > fine with 0-5V going into their inputs. With the near universal death o= f > > dedicated serial and parallel ports on PC's, USB serial adapters are my > > current bit wiggling interface. > > > > BAJ > > > >> > >> Best regards, > >> > >> Isaac > >> > >> > >> > >>> The last time this discussion came up, Russel noted to me that allowi= ng the > >>> negative voltage to the PIC input, even though it's clamped by the > >>> protection diodes, causes the part to operate outside of it's range > >>> specified in the datasheet (-0.3V minimum). Hence the transistor in t= he > >>> permanent circuit. I'm unsure what if any damage that 150 uA of curre= nt at > >>> -0.7V can do to the input. > >>> > >>> BAJ > >>> > >> -- > >> http://www.piclist.com PIC/SX FAQ & list archive > >> View/change your membership options at > >> http://mailman.mit.edu/mailman/listinfo/piclist > > -- > http://www.piclist.com PIC/SX FAQ & list archive > View/change your membership options at > http://mailman.mit.edu/mailman/listinfo/piclist -- Byron A. Jeff Department Chair: IT/CS/CNET College of Information and Mathematical Sciences Clayton State University http://cims.clayton.edu/bjeff -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist .