Question 8.12: The Raspberry Pi operates at 3.3V, but you want to know how ......

The Raspberry Pi operates at 3.3V, but you want to know how to connect the 5V output of a module to a GPIO pin on the Pi without damaging it.

Step-by-Step
The 'Blue Check Mark' means that this solution was answered by an expert.
Learn more on how do we answer questions.

Use a pair of resistors as a potential divider to reduce the output voltage. Figure 8-7 shows how you might use the 5V serial connection of an Arduino to a Raspberry Pi.

To make this recipe, you will need:

• 270Ω resistor (“Resistors and Capacitors” on page 380)
• 470Ω resistor (“Resistors and Capacitors” on page 380)

The TXD signal from the Pi is a 3.3V output. This can be connected directly to a 5V input on the Arduino without any problem. The Arduino module will recognize anything over about 2.5V as being high.

The problem arises when you need to connect the 5V output of the Arduino module to the RXD pin of the Pi. This must not be connected directly to the RXD input. The 5V signal could damage the Pi. Instead, the two resistors shown in Figure 8-7 are used.

Discussion

The resistors used here will draw a current of 6mA. Given that the Pi uses a fairly hefty 500mA, this will not noticeably affect the current consumption of the Pi.

If you want to minimize the current used by the potential divider, then use larger value resistors, scaled proportionally—for example, 27kΩ and 47kΩ, which will draw a miserly 60 μA.

See Also

For more information on connecting Raspberry Pi to Arduino, see Chapter 14.

If you have multiple signals to convert between 3.3V and 5V, then it’s probably best to use a multichannel level converter module—see Recipe 8.13.

Table A-4. Resistors and capacitors
270Ω 0.25W resistor Mouser: 293-270-RC
470Ω 0.25W resistor Mouser: 293-470-RC
1kΩ 0.25W resistor Mouser: 293-1k-RC
3.3kΩ 0.25W resistor Mouser: 293-3.3k-RC
4.7kΩ 0.25W resistor Mouser: 293-4.7k-RC
10 kΩ trimpot Adafruit: 356, SparkFun: COM-09806, Mouser: 652-3362F-1-103LF
Photoresistor Adafruit: 161, SparkFun: SEN-09088
220nF capacitor MCM: 31-0610, Mouser: 80-C322C224M5U5HA
WhatsApp Image 2024-01-15 at 00.18.57_a91375d0

Related Answered Questions

Question: 8.16

Verified Answer:

The PiFace Digital (“Modules” on page 381) is an e...
Question: 8.15

Verified Answer:

Use a boost regulator module (Figure 8-10). The mo...
Question: 8.14

Verified Answer:

A typical project using a Raspberry Pi requires 5V...
Question: 8.11

Verified Answer:

Use a Pi Cobbler, a device consisting of a small p...
Question: 8.9

Verified Answer:

Install Minicom: $ sudo apt-get install minicom...
Question: 8.21

Verified Answer:

You can use the paddle terminal breakout board sho...
Question: 8.20

Verified Answer:

The Pi Plate (Figure 8-16) is a prototyping board ...
Question: 8.19

Verified Answer:

The Humble Pi (Figure 8-15) is a prototyping board...
Question: 8.17

Verified Answer:

Figure 8-13 shows a Gertboard attached to a Raspbe...