User Guide

169
To connect 5 V outputs to an input on the Pi, you will need to
convert the voltage levels so that high signals are only 3.3 V.
If you need to convert more than a two or three signals, then a
bi-directional logic level converter chip is a useful purchase. But
if you only need to convert one or two signals then there several
methods you can use. Two are shown here.
1. Using a Voltage Divider
In the example below, the two resistors form a potential divider.
This divides the voltage and allows enough of it to pass to
ground so that the GPIO pin only receives around 3.3 V. The
exact resistor values are not too important – but the first resistor
must be slightly over half the value of the second resistor or the
divider does not work correctly.
Figure 8. Using resistors for 5 V to 3.3 V interfacing
2. Using a Diode and Pull-Up Resistor
Diodes are passive components that only allow electricity to flow
in one direction. On schematics, they resemble an arrow and this
indicates the direction in which electricity can flow. On an actual
diode, there is a thick line that corresponds to the vertical line on
the schematic symbol.
In Figure 9, when the output on the 5 V device is low then it is
actually connected to ground. This means that the electricity
The high signal from the Pi is usually enough to ensure that the 5
V device detects the line as high. This section is primarily
concerned with protecting the Pi’s input pins.