Electronics > Beginners
Different voltage inputs for switches - MCU protection
(1/3) > >>
MolsonB:
Hi everyone, first post on here.

I have a MCU (Teensy 3.6 = MK66FX1M0VMD18) that will have a whole range of on/off switches and sensors attached. They can either be ground, 5v or 12v. I'm looking for a circuit that can handle all the different kinds of inputs and level them to either 0v to 3.3v.

The circuit attached uses the BAT54s double Schottky diodes to clamp to the rails. When then input is higher then 3.3v, the schottky forward voltage 0.2v brings the input signal to 3.5v (3.3v + 0.2v) which is getting close to the max 3.6v of the MCU. Could I reduce the 3.3v rail to the schottky diodes, to say 3v, to help not go over the MCU voltage?

I don't really like the amount of current shunted to the power bus, but I'm open to ideas.
ataradov:
A classical MOSFET level shifter like shown here https://playground.arduino.cc/Main/I2CBi-directionalLevelShifter should work.
spec:
Hi MolsonB

Attached is a schematic for an MCU input translator/protector which puts no current into the 3V3 supply line:

With a high input or no input the circuit consumes 70.5uA and with a low input the circuit consumes 350uA.

If you can stand a logic inversion it can be done with one transistor.

You can also have a version without the input pull-up function if required.
spec:
+ MolsonB

Attached below is schematic for a general translator/protector with an inverting logic function:
Ian.M:
If you've got *lots* of inputs, active buffers like the replies above have excessive component counts and need too much board area compared to a simple Schottky clamped series R limiter with shunt C filtering.   However dumping current into the supply rail is a *BAD* idea, as if you dump in more than the rail's load current the rail voltage will rise and probably destroy whatever ICs it feeds (unless the rail is shunt regulated).

The solution to that problem is to provide a seperate shunt regulated clamping rail.  You *could* just use a Zener + a pullup resistor, but they typically have fairly poor tolerance, and highish slope resistance so its very easy to find the clamping voltage is actually over Vcc.  A TL431 shunt regulator is a better option, but it still doesn't track the Vcc rail so again, the tolerances can stack up unfavourably.

Here's a reasonably simple Vcc rail relative clamping circuit for multiple inputs.  The top section is the circuit for one input, repeat N times.  R2 provides additional protection to the MCU during ESD events or other transients that overload the clamping rail, by limiting the current into the MCU's internal input protection.   If you use a series Schottky pair (e.g. BAT54S) for the diodes, that's only four parts per input.  Further component count & board area savings for multiple inputs are possible if you use resistor arrays for R1 and R2 and a multi-channel clamping diode matrix.  C1 and R1 should be  chosen on per application basis for the desired low pass corner frequency and to limit the input current that has to be clamped. 
N.B. for large R1*C1 time constants the MCU pin should either be analog capable, in analog mode or be a Schmidt trigger input, as the time spent between Vil and Vih thresholds during transitions may be excessive for an ordinary digital input. 

The clamping rail is regulated to a voltage slightly below Vcc by Q1 and Q2. Vbe_Q2*R5/R4 sets the voltage below Vcc, and should be adjusted to suit the clamping diodes used.  R6 (in combination with Vcc and the drop across Q2)  sets the maximum base current available to Q1, which multiplied by its min. HFE sets the maximum current the clamping rail can sink, subject to Q1's max Ic and dissipation.   C2 and C3 improve its performance clamping fast transients.  R3 keeps the clamping rail biassed to minimise interaction between inputs.  Ideally Q1 and Q2 should be closely thermally coupled so their Vbe tracks.

LTsice sim attached.
Navigation
Message Index
Next page
There was an error while thanking
Thanking...

Go to full version
Powered by SMFPacks Advanced Attachments Uploader Mod