0% found this document useful (0 votes)
156 views

CD4049/CD4050: 7400 V 7400 Inputs 7400 Output CD4050 V CD4050 in CD4050 Out

The document discusses using CMOS and TTL devices to interface 3V and 5V signals. It describes using CD4049/4050 CMOS devices and 74HCT245 devices to convert signal levels between 3V and 5V domains. The key aspect is that 74HCT devices accept lower input voltages than regular CMOS, allowing them to interface 3V and 5V signals.

Uploaded by

Boby
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
156 views

CD4049/CD4050: 7400 V 7400 Inputs 7400 Output CD4050 V CD4050 in CD4050 Out

The document discusses using CMOS and TTL devices to interface 3V and 5V signals. It describes using CD4049/4050 CMOS devices and 74HCT245 devices to convert signal levels between 3V and 5V domains. The key aspect is that 74HCT devices accept lower input voltages than regular CMOS, allowing them to interface 3V and 5V signals.

Uploaded by

Boby
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 11

Chapter 2 ■ 3V/5V Signal interfaCing

CD4049/CD4050
You might use the CD4049 or CD4050 CMOS devices if you don’t need high switching
speed (these have a worst-case rise/fall time as high as 120ns). The CD4049 is a hex
inverter, while the CD4050 has six noninverting buffers. These CMOS devices can be
supplied with VDD=+3.3V to match the Raspberry Pi yet accept an input signal as high
as +18 volts. When operating at +3.3 V, the VIL maximum is approximately 1.0 volts (30
percent VDD), and the VIH minimum is +2.3 volts (70 percent VDD). Given that the 7400
datasheet lists a VOH minimum of +2.7 volts, this meets the CMOS input requirements (the
VOL/VIL parameters are also met).
Repeating the experiment using the 7400 quad NAND gate to drive a CD4050, you
get the DC readings shown in Table 2-11. The schematic is the same as Figure 2-5, except
that IC1 is the CD4050 and IC2A is one of the 7400 NAND gate outputs (with inputs wired
together, to behave as an inverter).

Table 2-11. Measured CD4050 DC Voltages

7400 VCC 7400 Inputs 7400 Output CD4050 VDD CD4050 In CD4050 Out
+5.01 volts Gnd +4.65 volts +3.30 volts +4.65 volts +3.30 volts
+5.00 volts +0.036 volts +0.036 volts +0.012 volts

Once again, you can see that the CD4050 happily accepts a high input voltage of
+4.65 volts. Had a protection (clamping) diode been involved, this voltage would be
lowered to about +3.9 volts or a little more. Because the CD4050, however, does not do
this kind of limiting, it works well as a level converter. Its main disadvantages are lower
speed and the fact that you get only six buffers instead of eight.

Input Protection Diodes


The 74LVC245 and 74LVC244 devices were special devices because they allowed a 5V
signal into an input, even when that device was operating at VDD=+3.3 volts. Let’s take a
moment to understand why this is special.
The CMOS gate is a metal oxide that is deposited on a thin layer above the silicon
channel where current flows. Any small voltage change exerted on that insulated gate
causes a larger change in electron flow in the channel beneath. But if the electric charge
is high enough, the metal oxide can be punctured and shorted out. This damage is
permanent and destroys Field Effect Transistor (FET) operation.
To protect the gate from static electricity, protective diodes are built into the
device. There are different ways this is accomplished, but it is frequently done as shown
in Figure 2-8. Diodes D1 and D2 are reversed biased in a way that causes them not to
interfere with normal input signals.

16
Chapter 2 ■ 3V/5V Signal interfaCing

VDD

D2
Q2
R1
Input Output
D1

Q1

GND
Figure 2-8. Inverter equivalent circuit

The inverter circuit shown has the FET transistors Q1 and Q2 arranged in the typical
CMOS configuration. When one transistor is on, the complementary transistor is off. The
input is usually guarded by a low-valued resistance R1 to limit the current flow when a
static discharge occurs. Since the metal-oxide gates do not conduct electricity, the diodes
D1 or D2 are designed to bleed the static charge away. By bleeding the charge away, the
voltage levels are kept low enough to prevent gate puncture damage.
For the student, schematic diagrams are drawn so that diodes form an arrow of
conventional current flow. That is, the current is shown flowing from plus to minus even
though physicists have long ago proven that electrons flow from minus to plus. If you
pretend conventional flow is correct while we look at the diagram, you can visualize
the fact that no current flows from plus to minus through the diodes because they are
reversed in polarity.
If you pet a cat and then come in contact with (or close to) this gate’s input, static
electric current will flow from the input through D2 or D1, depending upon whether the
electric charge is positive or negative. I have not been able to determine which charge it
is though I have regularly snapped sparks to our cat’s ears. If you shuffle your feet on a
carpet, the generated charge may be positive or negative depending upon the materials
involved.
The protection diodes work rather well for static charges under normal handling
conditions. The problem occurs when you want to do something like feed a 5V signal
into a CMOS input when the device is operating at a supply voltage of +3.3 volts. Examine
Figure 2-9, which is rearranged slightly to illustrate the high voltage flowing into a lower-
voltage device’s input.

17
Chapter 2 ■ 3V/5V Signal interfaCing

+5V Input
R1

D2
VDD

+3.3 V
Figure 2-9. Current through protection diode D2

If the input pin of the inverter is raised to +5 volts, then the input voltage is above the
chip’s own supply VDD=+3.3 volts. This difference is as follows:

5volts - 3.3volts = 1.7volts

The voltage that develops across a silicon diode is usually about 0.6 volts, so you
need to subtract that to arrive at the voltage across R1.

VR1 = 1.7volts - 0.6volts = 1.1volts

The resistance value isn’t normally provided in the datasheets but may be near 200
ohms [4]. This means that when the input signal is provided at +5 volts, the current flow
through R1 is as follows:

1.1volts
I R1 = 5.5mA
200W

The difficulty is that you have no guarantee that the protection diode can sustain
5.5mA of current. The protection diodes are designed to discharge weak currents for brief
periods of time. For this reason, you shouldn’t design a circuit to rely on its use. A similar
problem exists when the input is made less than -0.6 volts (negative), causing current to
conduct through D1 instead.
The special feature that permits you to provide a higher-than VDD input voltage is a
protection circuit that depends upon a Zener diode for D1, as shown in Figure 2-10.

18
Chapter 2 ■ 3V/5V Signal interfaCing

VDD

Q2
R1
Input Output

BV=30V Q1
D1

GND
Figure 2-10. Inverter with Zener input protection

Diode D2 is no longer required because D1 is a Zener diode, which has a designed


breakdown voltage in the reverse direction. The exact voltage where the Zener action
occurs is not usually specified but guaranteed to occur above some absolute high value.
The Fairchild Semiconductor datasheet for the CD4049UBC or CD4050BC lists the
absolute maximum voltage for the inputs at +18 volts [5]. So, the Zener action must occur
somewhere above that.
D1 is a Zener diode when reversed biased. It otherwise conducts current like a
normal diode when forward biased. This means that if the input signal goes negative, the
Zener diode starts conducting at about -0.6 volts like the normal protection diode. Thus,
the single Zener diode protects against both positive and negative static charges.
From this, I hope that you can see that there is a need for this special feature. Without
this adaptation to allow an input signal to exceed the +3.3V VDD level, you risk burning out
a protection diode in the chip. In the datasheet, look for special mention of the ability to
operate input signals above their supply voltage. The CMOS chips CD4049UBC (inverter)
and CD4050BC (buffer) both possess this talent, along with the previously discussed
74LVC244 and 74LVC245 devices.

Converting 3 Volts to 5 Volts with the HCT Family


Now you can turn your attention to converting a 3V signal into the higher-level 5V signal.
Here you turn to a different series family member. Previously the LVC family was used,
but here you must use an HCT family.

19
Chapter 2 ■ 3V/5V Signal interfaCing

The main reason for this is that you must power the device from 5 volts in order for
it to have an output swing from 0 to 5 volts. Its outputs must match the receiving TTL
input levels (VIL of 0.8 volts maximum and VIH of 2.0 volts minimum). Let’s first review the
74HCT245 device.

74HCT245
The main trick, however, is that the 74HCT245 device itself must accommodate a low
enough input VIH for the driving Raspberry Pi. Normally the CMOS high level (70 percent
of 5 volts) would mean a VIH of 3.5 volts. This is higher than the Pi can produce! But
because the HCT family is designed to accept TTL input levels, you can count on its VIH to
be 2.0 volts instead. This is the special talent of the HCT family.
To make this easier to visualize, examine Figure 2-11. Notice that the 74HCT245 is
being supplied by 5 volts this time, allowing its output to range from 0 to 5 volts. Even
though the input to the 74HCT245 can go as high as 5 volts, the Pi will never deliver more
than +3.3 volts. This is why it is important that the VIH of the 74HCT245 is as low as 2 volts.
Notice from the CMOS device on the left, sending to the '245 in the center and driving
the TTL device at the right, the signal parameters are exceeded at every turn. By having
this “noise margin,” a small noise blip on the signal won’t push it out of spec and cause
erroneous readings.

74HCT245 TTL
+5.0V
Raspberry
3.2-3.3V

Pi
(CD4001)
2.7 – 5V

2.0-5.0V

+3.3V
VOH VOH
2.0-3.3V

VIH VIH
0 - .5V

VIL VIL
0-.03V

0-.8V
0-.8V

VOL VOL
Gnd Gnd
Figure 2-11. 3V CMOS to 5V TTL conversion

20
Chapter 2 ■ 3V/5V Signal interfaCing

A couple of notes about Figure 2-11 are in order.


• The VOL and VIL were estimated values for the CD4001 operating at
+3.3 volts (Fairchild lists only the values for 5V operation).
• The Raspberry Pi’s output parameters are expected to be
similar to the CD4001, though they are not actually provided by
Broadcom.
To test this in a simple manner, the circuit in Figure 2-12 was breadboarded to
illustrate the signal conversion from the Pi GPIO to the TTL signal. The output of the
two-input NOR gate (IC2A) is used to simulate the output of the Raspberry Pi in this
experiment. IC2A is supplied by a +3.3V power supply like the Pi would supply.
IC1 is the 74HCT245 device, which is powered from +5.0 volts in this circuit. This
allows the output of the device to swing between 0 volts and 5 volts to drive the TTL
device. The TTL input would be connected to the terminal “OUTPUT” in Figure 2-12.

1 IC2A Raspberry Pi (GPIO Out)


INPUT 3
2
4001N 3 Volt Signal
IC1
2 18
A1 B1
3 A2 B2 17
4 16
A3 B3
5 15
OUTPUT A4 B4
6 A5 B5 14
7 13
A6 B6
5 Volt Signal 8 A7 B7 12
9 11
A8 B8
1 DIR
19 G
(/OE)
74HCT245

GND
Figure 2-12. 3V to 5V conversion circuit

Table 2-12 summarizes the experimental measurements. When the CD4001 supplied


a 3V system high (+3.30 volts), the output of the 74HCT245 was +5.03 volts. When the
CD4001 supplied a logic 0, the 74HCT245 supplied a low of +0.004 volts. These represent
excellent results.

21
Chapter 2 ■ 3V/5V Signal interfaCing

Table 2-12. Measured 74HCT245 Voltages

CD4001 VDD CD4001 CD4001 74HCT245 VDD 74HCT245 In 74HCT245 Out


Inputs Output

+3.30 volts Gnd +3.30 volts +5.03 volts +3.30 volts +5.03 volts
+5.03 volts +0.0010 volts +0.0010 volts +0.004 volts

74HCT244
The 74HCT244 is a simpler part because it is unidirectional and may be lower in cost.
Again, this part must operate from +5 volts like the 74HCT245 discussed earlier. If you’re
squeezing the last few microamps out in power savings, the '244 device is feeding fewer
transistors internally.
The pinout is the same as the LVC part shown earlier in Figure 2-7. Simply supply
your Pi inputs to the 75HCT244 inputs, and the 5V logic outputs will appear at the device
outputs. Make sure that the OE pin is grounded to enable the outputs.

Switching Speed
One parameter that I have avoided discussing is the switching speed of various devices.
For driving LEDs and motors, speed may not be critical. You might desire higher data
rates for SPI interfaces, on the other hand. The question naturally arises, how fast can my
device go?
The datasheets won’t answer this directly. They do, however, provide the following
parameters:
• tPHL: Propagation delay time, high to low
• tPLH: Propagation delay time, low to high
The Fairchild CD4001 datasheet lists these values, as shown in Table 2-13.

Table 2-13. Fairchild CD4001 Datasheet

Parameter Description Value


tPHL Propagation delay time, high to low 250ns
tPLH Propagation delay time, low to high 250ns

For this device, both parameters have the same times, but they need not be identical
(these are the values listed for 5V operation). So, the absolute maximum speed these
devices can signal from low to high and low again can be calculated as follows:

1 1
F= = = 2 MHz
t PHL + t PLH 250 ns + 250 ns

22
Chapter 2 ■ 3V/5V Signal interfaCing

But this is not all there is to it because the signal must usually hold for a time in one
state or the other. The actual rate could easily be half or less. If, for example, the high state
hold time is 50ns, the rate reduces to the following:

1
F= = 1.82 MHz
250 ns + 50 ns + 250 ns

The NXP 74LVC244 datasheet specifies in a small print note that “tpd is the same as
tPHL and tPLH.” They list tpd with a maximum of 7.5ns for this device at 3.3 volts. So, what is
the absolute maximum frequency for this device?

1
F= = 66.7 MHz
7.5ns + 7.5ns

Notice the difference in signal rate. Again, this does not take hold times into account,
but knowing the absolute limit is helpful in planning. As Clint Eastwood said (as Harry
Callahan), “A man’s got to know his limitations.”

Summary
This chapter has been a little intense about signals, levels, voltages, and parameters.
This was designed to help you understand the critical issues involved. If you don’t yet
have a mastery of digital electronics, then you’d still be well served with the following
simple advice:
• When converting from 5 volts down to 3 volts, use the 74LVC244
device (or 74LVC245), powered by +3.3 volts.
• When converting from a 3V signal up to 5 volts, use the 74HCT244
device (or 74HCT245), powered by the 5V supply.
• When considering alternative devices, don’t forget to evaluate
their switching speeds. Many older devices are much slower than
today’s devices.
• Never connect a 5V device directly to a 3V device.
The knowledgeable electronics practitioner will know some other alternatives. But
the LVC and HCT family solutions presented are simple, economical, and reliable for the
Raspberry Pi enthusiast. For each '244 you get eight level shifters in one chip.

23
Chapter 2 ■ 3V/5V Signal interfaCing

Bibliography
[1] “Logic Voltage Levels.” Wikipedia. Wikimedia Foundation,
n.d. Web. 17 Apr. 2016. <https://en.wikipedia.org/wiki/
Logic_level>.
[2] Lancaster, Don, and Howard M. Berlin. CMOS Cookbook. 2nd
ed. Indianapolis, IN: Sams, 1988. Print. p19.
[3] “7400 Series.” Wikipedia. Wikimedia Foundation, n.d. Web. 02
Apr. 2016. <https://en.wikipedia.org/wiki/7400_series>.
[4] Lancaster, Don, and Howard M. Berlin. CMOS Cookbook. 2nd
ed. Indianapolis, IN: Sams, 1988. Print. p21.
[5] “CD4049UBC – CD4050BC Hex Inverting Buffer – Hex
Non-Inverting Buffer.” Fairchild Semiconductor, n.d. Web. 18
Apr. 2016. <https://www.fairchildsemi.com/datasheets/
CD/CD4049UBC.pdf>.

24
CHAPTER 3

VGA LCD Monitors

Most Raspberry Pi projects need a display of some kind, unless it is being used as an
embedded system. These days there are nice HDMI monitors and nice touch screens
available. But these displays still command a fair investment. This chapter will explore
inexpensive, used VGA monitors. With the correct type of adapter and Pi configuration,
you can repurpose some used VGA LCD screens. VGA monitors will eventually become
scarce, but while they last, they are a boon to the maker.

VGA Converters
One of the great things about the Raspberry Pi Zero is that you get a video interface for
free (or split the Zero’s price of $5 in two: $2.50 for the Broadcom video core and $2.50 for
the CPU). This is a spectacular feature that cannot be matched in the Arduino world.
Using the Pi’s video interface naturally requires a monitor. This chapter explores how
to use a VGA monitor on a Raspberry Pi using a VGA converter. VGA monitors can be a bit
finicky, however, so I’ll also discuss video settings to allow you tune your Pi to match the
monitor.
I purchased an HDMI to VGA converter on eBay for the unbelievable price of $2.80.
My own experience with it so far has been very good. There doesn’t seem to be any
manufacturer information on the outside. It is possible that it has not been tested against
the North American and European radio emissions standards, so buyer beware.

■ Warning When shopping on eBay, be careful not to buy a simple cable adapter. You
need more than a cable/adapter to make this work, so check the description carefully.
Usually the cable/adapter auction information will include a warning that “converter is
needed when connected to the PC and TV.”

The unit I purchased includes an electronic converter circuit, which obtains its
power from the HDMI cable. The only suitable unit that I am aware of looks like the one
in Figure 3-1.

© Warren Gay 2017 25


W. Gay, Custom Raspberry Pi Interfaces, DOI 10.1007/978-1-4842-2406-9_3
ChaPTer 3 ■ VGa LCD MoniTors

Figure 3-1. HDMI to VGA adapter

I already owned several VGA monitors, but I wondered about general VGA monitor
availability. They are bound to be more plentiful presently given that everyone is
switching to HDMI monitors. A search on Kijiji quickly confirmed that they can be had
for as little as $20 (and probably less by the time you read this). For example, one $20
monitor I found being sold was a Samsung SyncMaster 193V 19-inch LCD monitor. The
native resolution was 1280×1024. Such a deal!
With a VGA converter and a cheap VGA monitor, you can strap the Pi on the back of
the monitor and have a cheap self-contained display terminal. With the Pi 3, you could
have a self-contained Linux terminal with WiFi and Bluetooth.

Resolution and Refresh Rates


Despite that the converter does the heavy lifting, you may need to make some
adjustments to the Pi’s display mode to be compatible with your VGA prize. Consider the
following monitor spec-related items:

• Native and supported resolutions (for example, 1280×1024)


• Vertical refresh rate (for example, 75Hz)
• Horizontal refresh rate (for example, 81kHz)

If your monitor supports 1024×768 or greater resolution, you may find that you can
use the default Pi settings. Install the adapter and boot up the Pi to see whether it works.
If not, don’t give up yet—you may be able to reconfigure the Pi for a lower resolution.
The flexibility of Broadcom VideoCore is amazing when you consider the price of the $5
Raspberry Pi Zero or other Pi model.

26

You might also like