Electronics > Projects, Designs, and Technical Stuff

PIC inputs and diode clamps and switching regulators, oh my.

(1/3) > >>

asgard:
Greetings, Brue Telievers...

I have a project that requires me to present sensor data to a digital input pin.  The problem with that is the sensor presents a 5V signal, yet the input pin is only rated to 3.3 volts (Really 3.6v, but I don't want to push my luck).
Two methods of fixing this was presented by way of a Xilinx app note.  A FET with the gate to the 5v signal, source to the 3.3v supply, and the drain to the input pin is one method.  The other is a diode clamp with a resistor in series tied ot the 3.3v rail with the diode tied to the 5v signal and the 3.3v input pin.  That seemed like the best low-cost way
to get the circuit working.  I have been down the mill with level-shifters, so that is not the right way for me.
I was warned by somebody with way more brainpower than myself, that a diode clamp would cause the switching regulator (an LM3940) to shut down, since the load current would exceed the source.  I "think" I can put a parallel resister across the source on the regulator to increase the quiescent current across the source so that the regulator will continue to switch, but I only have a tenuous grasp of the math here.  Any tips?

J.R.


alm:
Clamping diodes can work if you include a series resistor to limit current. You need to make sure that your diodes conduct before the internal diodes, which are often not rated for any current (hence the absolute max. input voltage of Vcc+1 diode drop or so).

One solution that I like is to make it an open collector output with pull-up. Put a diode in series with the output, with the cathode facing the output. Put a pull-up resistor (few kohm or so) to 3.3V on the anode side, and connect the anode to your input. The diode will conduct if pulled low, and the output voltage will be one diode drop (use Schottky diode to limit this to 0.3V or so). If the output is high, the diode will be reverse biased, and the pull-up resistor will pull it to 3.3V. Disadvantage is that low is slightly above 0V (should be well within VIL of your input), and the rise time is limited by the RC time of the pull-up resistor plus the (parasitic) capacitance of the input. I've used this successfully for 115200 baud async serial (UART), if your sensors are much faster than that, you may need an active solution.

I think Sparkfun has a page with various options, and this is number three or so. The other options are either more complex or use undocumented specs of the part (eg. ESD clamping diodes, datasheets often state that they should not conduct any current, and rarely give safe limits).

TechGuy:

--- Quote from: asgard on November 23, 2010, 10:47:51 pm ---Greetings, Brue Telievers...

I have a project that requires me to present sensor data to a digital input pin.  The problem with that is the sensor presents a 5V signal, yet the input pin is only rated to 3.3 volts (Really 3.6v, but I don't want to push my luck).
Two methods of fixing this was presented by way of a Xilinx app note.  A FET with the gate to the 5v signal, source to the 3.3v supply, and the drain to the input pin is one method.  The other is a diode clamp with a resistor in series tied ot the 3.3v rail with the diode tied to the 5v signal and the 3.3v input pin.  That seemed like the best low-cost way
to get the circuit working.  I have been down the mill with level-shifters, so that is not the right way for me.
I was warned by somebody with way more brainpower than myself, that a diode clamp would cause the switching regulator (an LM3940) to shut down, since the load current would exceed the source.  I "think" I can put a parallel resister across the source on the regulator to increase the quiescent current across the source so that the regulator will continue to switch, but I only have a tenuous grasp of the math here.  Any tips?

J.R.




--- End quote ---


You use a 1K to 10K resistor so that the zener diode doesn't draw a lot of current.

Input ---> 1K Res -+---> MCU Pin (3.3)
                           |
                         Zener
                           |
                         GND

That said you should be able to use a 10K resistor without the zener since the resistor would limit the current to about 500 uA @5V. Which would prevent damage to the MCU pin. You can use an even larger Resistor if your sensor data output speed is low.

oPossum:
Many 74AHCxxx parts can accept inputs up to 5 volts while powered from a lower voltage (typ 2.5 to 3.3).
The 74AHC244 octal buffer is one such part.

http://www.nxp.com/documents/data_sheet/74AHC_AHCT244.pdf

asgard:
So you are saying a diode clamp, such as this, would not work for me?  Can a normal diode, such as a 1N4148, work?
I also am trying to figure out what the resistor values, especially R1, should be to ensure the regulator turns on.

J.R.

Navigation

[0] Message Index

[#] Next page

There was an error while thanking
Thanking...
Go to full version