# Shifting a 2.7V digital signal to Arduino logical levels?

I'm pretty much a beginner in electronics and I'm currently working on a personal project, where I have a device, that is putting out a digital signal (square wave) that goes from 0V - 2.7V and I need to read that signal with my Arduino. That, unfortunatelly, isn't enough for the Arduino Mega 2560 since the minimum voltage to turn the digital pin high is at least 3V.

I've been doing some "research" and came across the MC14504B hex level shifter which seemed like the perfect solution for my problem. However... I'm having some trouble interpreting the datasheet...

TL;DR: I need to level shift my 2.7V signal to at least 3V or more.

This is the logic diagram of the level shifter: And this are the characteristics: I'm not exactly sure how to interpret these numbers. I plan to use the TTL-CMOS mode.

From what I can tell, as long as input is considered 1 (high) my voltage at output will be ~5V if Vdd is 5V, which is perfect. Would a 3.3V Vdd be okay since Arduino needs at least 3V to turn a pin high?

Now to my real question... I don't get the Vcc and Vin (Vol, Voh) part.

From the table, we can see, that if Vcc is 5V and Vdd is 10V, the Vin will be a logical 0 if the voltage applied to the input is <= 0.8V, same goes for if Vcc is 5V and Vdd is 15V.

Now, from what I can tell, the input will be considered high if at least 2V or more is applied to the input when Vcc = 5V and Vdd = 10V/15V, but both the Voh and Vol change depending on the Vdd? What does this mean for my use case?

What if I use 5V for Vcc and Vdd both? What if I use 3.3V for Vcc and Vdd both? What if I use 3.3V for Vcc and 5V for Vdd and vice-versa. What happens in these scenarios? Could someone explain this in a very simple way please? I seem to be missing something here as my interpretation doesn't make sense to me.

Thank you!

• Is there a reason why you don't want to run the Mega at 2.7V? Feb 9, 2018 at 22:39
• Can you confirm that the Arduino is running at 5V? Feb 9, 2018 at 22:50
• Why wouldn't he run at 5V? And what exactly do you mean with why I don't want to run the Mega at 2.7V? Mega uses 5V logic? Feb 9, 2018 at 23:05
• Just wanted to be totally sure :) Typically you would use the same rails for each side of the level shifter as the logic chips that connect to each side. Feb 9, 2018 at 23:13
• I seem to be missing something here, I'm a beginner. :) What made you think that the Arduino isn't running at 5V and what would be the cause that it isn't? By your last comment, you mean that Vcc and Vdd on the level shifter should be both connected to the 5V pin on the Arduino? :) Feb 9, 2018 at 23:33

TL;DR: Use Vcc = 5V, Vdd = 5V, TTL-CMOS mode, and you should be fine.

"From what I can tell, as long as input is considered 1 (high) my voltage at output will be ~5V if Vdd is 5V, which is perfect. Would a 3.3V Vdd be okay since Arduino needs at least 3V to turn a pin high?"

Correct, you will get ~5V output if you use Vdd = 5V. However, in TTL-CMOS mode, Vdd and Vcc must both be at least 5V (Figure 4 of the datasheet). Since the input logic switchpoint is 1.5V for Vcc = Vdd = 5V, that will work totally fine with your 2.7V logic input.

"Now to my real question... I don't get the Vcc and Vin (Vol, Voh) part."

This datasheet lists its data in a pretty odd way, and it's not actually totally clear what it means. My interpretation is that "VOL = 1.0VDC" means when operating in this condition, the output voltage is guaranteed to be less than 1VDC. Fortunately, I don't think it's really an issue for your application.

"input will be considered high if at least 2V or more is applied to the input when Vcc = 5V and Vdd = 10V/15V, but both the Voh and Vol change depending on the Vdd? What does this mean for my use case?"

Yes, you are interpreting this correctly. For your use case, ignore the "Voh and Vol" numbers in the "Input Voltage" section and instead pay more attention to the top-most section labelled "Output voltage", which just says that if you use Vdd = 5V you'll get ~5V output.

"What if I use 5V for Vcc and Vdd both? What if I use 3.3V for Vcc and Vdd both? What if I use 3.3V for Vcc and 5V for Vdd and vice-versa."

Again, see Figure 4. In TTL-CMOS mode, you need to use 5V for Vcc and Vdd. I would say using 5V for both is the correct solution for your application.

• Thanks for the answer to my original question. :) I'll try this out tommorow and see how it goes. Feb 10, 2018 at 1:20
• Shouldn't "TL;DR:" be at the bottom? Feb 10, 2018 at 4:34
• And how is that relevant? Feb 10, 2018 at 10:23

So long as you don't mind a logic inversion, you can use something simple like a transistor and two resistors. simulate this circuit – Schematic created using CircuitLab

Sensor output voltages above about 0.8 V switch Q1 on. R2 pulls the Arduino input up to its supply rail when Q1 is off. If you use an I/O pin input with a programmable pull-up resistor, you can omit R2. Most small-signal NPN BJTs will do for Q1.

• I've been thinking of this before however I chose to go with the level shifter instead because it wasn't inverting my signal, well, an inverted signal wouldn't really pose a problem. Anyways, the R2 was bothering me... As far as I've read, Arduino pins have a 100kOhm impedance and connecting an input pin to this circuit would create a voltage drop on R2... isn't the internal pin resistance of an input enough to pull the pin high, why is the R2 neccessary? Thanks. :) Feb 10, 2018 at 1:17
• @0xd4v3, please check the datasheet for your device rather than use second-hand info'. Input leakage current of +/-10uA is more typical, so R2 value is fine...but check the datasheet rather than 'AFAIK'. I'll note that you can use the programmable pull-up, R2 simply made the circuit universal for non-Arduino MCUs etc. Feb 10, 2018 at 1:26

Arduino inputs must meet the specified logic levels for margin.

VIL <= 0.3Vcc max
VIH >= 0.7Vcc min

Thus the input square wave must be >= 0.4Vcc and for 5V , or 0.4 * 5 = 2.0 Vpp and you have 2.7V with 0.7V margin.

Alternatively you may AC couple to input with R bias to Vcc/2.

There are lots of level shifter solutions for 2.7V to 5V.

Rev B. simulate this circuit – Schematic created using CircuitLab

• assuming noise free supply and signal.
• Thanks for replying but as a beginner, I'm not sure I follow what you're trying to explain here. :) 0.3*5V = 1.5V and 0.7*5V = 3.5V. How come that the digital signal would still turn the pin high if the pin needs at least 0.7*Vcc to turn on? Mega uses 5V logical levels, right? Feb 9, 2018 at 23:36
• Logic levels are defined with adequate noise margins over temperature and mfg tolerances, but nominally the threshold is Vcc/2. It assumes the signal is always there. For an active non-inverting buffer translater see my link in blue (?) Feb 9, 2018 at 23:50
• Thanks for posting the circuit. :) I checked out your link but it leads to a page that gives me an error. Feb 10, 2018 at 0:21
• Given that OP didn't mention the frequency of the square wave, I would recommend against using this approach. Feb 10, 2018 at 1:41
• sorry about link try digikey.com/products/en/integrated-circuits-ics/… and use the filters for cheapest part that fits V1=2.7 V2=5 Feb 10, 2018 at 1:57

TTL input voltage levels are >=0.8V low and >=2.0V high. The MC14504B accepts these logic levels when in TTL mode with Vcc = +5V. Your signal levels are 0V and 2.7V, so it's all good.

The MC14504B has CMOS outputs which go from 0V to Vdd. The Arduino works at 5V so you should also set Vdd to +5V.