# Different logic levels on single input

I have a circuit that has about a 1V input that gets boosted to 3.3V.

To enable the boost converter IC, a switch is pressed which causes the enable signal [EN] of the converter to go high (and stay high, there is more circuitry to latch the signal that is not shown).

After this, I'd like to be able to sample the push button presses with a microcontroller [SW_IN], but the 1V logic level is too low; it needs to be around 3.3V, the boosted voltage.

simulate this circuit – Schematic created using CircuitLab

I am considering just putting a diode at the output of V1 to prevent any back feeding, but I am a little worried about the signal integrity due to forward voltage drop. The minimum enable voltage for my boost controller is 0.8V, so I'd have to get a pretty low voltage drop diode and am wondering if there's a better solution.

simulate this circuit

I also considered a tri-state buffer where the boosted voltage turns off V1 and is connected to the switch input.

simulate this circuit

I'd like the solution to be as inexpensive as possible, so I'm wondering what the optimal and simplest solution would be and if there's options I'm missing.

• Reading this I am completely confused about what you are trying to achieve, after the first diagram. You want to use the same switch that turns on the 3V3 regulator to be readable by the microcontroller? Is that the issue? – danmcb Jun 30 '18 at 14:13
• Yes, that's correct. Is there a way I can clarify that in my diagram or explanation? – BTPankow Jun 30 '18 at 14:56
• Possible duplicate of electronics.stackexchange.com/questions/382486/… – Elliot Alderson Jun 30 '18 at 18:59
• Don't you have an analog input or comparator input on your microcontroller? – Dorian Jul 3 '18 at 15:58

## 2 Answers

simulate this circuit – Schematic created using CircuitLab

Figure 1. An innocent bystander's interpretation of the question.

It seems that you are trying to describe something as shown in Figure 1. If you can clarify in your question we can proceed from there.

simulate this circuit

Figure 2. A possible solution.

If V1 is high enough to turn on Q1 then the circuit of Figure 2 might suffice. The switch logic will be inverted but this should be easily handled in software.

• Yes, Figure 1 is a good way of showing what I'm describing. I'm going to edit my schematics to clarify that. Also, your solution is very helpful to me as well. I was stuck thinking I somehow needed both voltages on the same input, but it makes sense just to use a transistor with a low turn on voltage. – BTPankow Jun 30 '18 at 19:10
• Try it out and see if it works. I recommend that you unaccept my answer for a day or two to encourage others to answer. You may get other, better answers. – Transistor Jun 30 '18 at 19:22
• Okay, that makes sense; I'll unaccept for now and do some testing with this. – BTPankow Jun 30 '18 at 19:42
• Looks great. +1. I think I will add another answer that doesn't invert the sense. Worth a look, anyway. Just a supplementary answer to yours. Not a replacement. – jonk Jul 1 '18 at 4:51

You can avoid the inverted sense in the software using the following schematic:

simulate this circuit – Schematic created using CircuitLab

The above keeps the sense of the switch.

When the switch is open, the emitter of $Q_1$ is pulled down by $R_1$, causing the collector of $Q_1$ to also be pulled down towards ground. The emitter voltage will be about $1\:\text{v}-V_\text{BE}\approx 300\:\text{mV}$. So the collector will be about the same, or perhaps $400\:\text{mV}$. This should be well below the input threshold of $SW_\text{IN}$ for a LOW result.

The main criteria here is that $R_2 \ge R_1\frac{3.3\:\text{V}-800\:\text{mV}}{1\:\text{V}-V_\text{BE}}$. So plug in your value for $R_1$ and work out the value for $R_2$, if you like. (The value for $800\:\text{mV}$ comes from whatever you find in the datasheet for your MCU as the worst case LOW voltage value.)

When the switch is closed, the emitter of $Q_1$ is at $1\:\text{V}$ and $Q_1$ is therefore off. So, then $R_2$ pulls the input up to the $3.3\:\text{V}$ rail.

That's it, really. This keeps the sense the same (HIGH IN = HIGH OUT), etc. (It even has one fewer part than Transistor suggested.)

I'd recommend adding a small base resistor for $Q_1$. Something on the order of $220\:\Omega$ to perhaps $1\:\text{k}\Omega$. But the above schematic is simpler to explain and probably will work okay for your needs.

• @BTP: Despite my username, transistor theory isn't actually my strong point and jonk is much better at it (as well as doing MathJAX instead of sleeping). This is a common base configuration and although common emitter is much more, um, common it would be worth your while studying this and understanding jonk's maths - if you don't already. – Transistor Jul 1 '18 at 8:35