{"id":95043,"date":"2023-04-13T12:36:19","date_gmt":"2023-04-13T12:36:19","guid":{"rendered":"https:\/\/randomnerdtutorials.com\/?p=95043"},"modified":"2023-07-20T09:15:41","modified_gmt":"2023-07-20T09:15:41","slug":"raspberry-pi-pinout-gpios","status":"publish","type":"post","link":"https:\/\/randomnerdtutorials.com\/raspberry-pi-pinout-gpios\/","title":{"rendered":"Raspberry Pi Pinout Guide: How to use the Raspberry Pi GPIOs?"},"content":{"rendered":"\n<p>The Raspberry Pi 4 Model B and most recent versions of the Raspberry Pi have a double row of 40 GPIOs (General Purpose Input\/Output Pins) that allow you to connect electronic components like LEDs and sensors. Some pins have specific functions like providing power, I2C, SPI, and UART communication protocols or PWM. In this guide, we&#8217;ll take a look at the Raspberry Pi GPIOs and their functions.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img data-recalc-dims=\"1\" fetchpriority=\"high\" decoding=\"async\" width=\"1200\" height=\"675\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2023\/03\/Raspberry-Pi-Pinout-Thumbnail.jpg?resize=1200%2C675&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"Raspberry Pi Pinout Guide How to use the Raspberry Pi GPIOs\" class=\"wp-image-129371\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2023\/03\/Raspberry-Pi-Pinout-Thumbnail.jpg?w=1280&amp;quality=100&amp;strip=all&amp;ssl=1 1280w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2023\/03\/Raspberry-Pi-Pinout-Thumbnail.jpg?resize=300%2C169&amp;quality=100&amp;strip=all&amp;ssl=1 300w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2023\/03\/Raspberry-Pi-Pinout-Thumbnail.jpg?resize=1024%2C576&amp;quality=100&amp;strip=all&amp;ssl=1 1024w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2023\/03\/Raspberry-Pi-Pinout-Thumbnail.jpg?resize=768%2C432&amp;quality=100&amp;strip=all&amp;ssl=1 768w\" sizes=\"(max-width: 1200px) 100vw, 1200px\" \/><\/figure><\/div>\n\n\n<p><strong>Table of Contents<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"#raspberry-pi-gpios\" title=\"\">Introducing the Raspberry Pi GPIOs<\/a><\/li>\n\n\n\n<li><a href=\"#raspberry-pi-pinout\" title=\"\">Raspberry Pi Pinout Guide<\/a><\/li>\n\n\n\n<li><a href=\"#raspberry-pi-peripherals-interface\" title=\"\">Raspberry Pi Peripherals Interface<\/a>\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"#raspberry-pi-power-pins\" title=\"\">Power Pins<\/a><\/li>\n\n\n\n<li><a href=\"#raspberry-pi-digital-inputs-and-outputs\" title=\"\">Digital Inputs and Outputs<\/a><\/li>\n<\/ul>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"#raspberry-pi-i2c-pins\" title=\"\">I2C Pins<\/a><\/li>\n\n\n\n<li><a href=\"#raspberry-pi-spi-pins\" title=\"\">SPI Pins<\/a><\/li>\n\n\n\n<li><a href=\"#raspberry-pi-serial\" title=\"\">UART Pins<\/a><\/li>\n\n\n\n<li><a href=\"#pwm-pins\" title=\"\">PWM Pins<\/a><\/li>\n\n\n\n<li><a href=\"#raspberry-pi-adc-pins\" title=\"\">ADC Pins<\/a><\/li>\n\n\n\n<li><a href=\"#raspberry-pi-pcm-pins\" title=\"\">PCM Pins<\/a><\/li>\n\n\n\n<li><a href=\"#i2c-eeprom\" title=\"\">I2C EEPROM<\/a><\/li>\n<\/ul>\n<\/li>\n<\/ul>\n\n\n\n<p class=\"rntbox rntclblue\">You may like reading: <a href=\"https:\/\/makeradvisor.com\/best-raspberry-pi-starter-kits\/\" target=\"_blank\" rel=\"noopener\" title=\"\"><strong>Best Raspberry Pi Getting Started Kits<\/strong><\/a>.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"raspberry-pi-gpios\">Introducing the Raspberry Pi GPIOs<\/h2>\n\n\n\n<p>The Raspberry Pi 4 Model B board has a double row of 40 GPIO pins. This layout is the same for the Pi 3 Model B and B+, Pi 2 Model B and B+, and Pi 1 Model B+, but slightly different from the Pi 1 Model A and B, which only have the first 26 pins.&nbsp;<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><a href=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2023\/03\/Raspberry-Pi-Pinout-Random-Nerd-Tutorials.png?quality=100&#038;strip=all&#038;ssl=1\"><img data-recalc-dims=\"1\" decoding=\"async\" width=\"1200\" height=\"675\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2023\/03\/Raspberry-Pi-Pinout-Random-Nerd-Tutorials.png?resize=1200%2C675&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"Raspberry Pi Random Nerd Tutorials\" class=\"wp-image-129396\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2023\/03\/Raspberry-Pi-Pinout-Random-Nerd-Tutorials.png?w=1280&amp;quality=100&amp;strip=all&amp;ssl=1 1280w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2023\/03\/Raspberry-Pi-Pinout-Random-Nerd-Tutorials.png?resize=300%2C169&amp;quality=100&amp;strip=all&amp;ssl=1 300w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2023\/03\/Raspberry-Pi-Pinout-Random-Nerd-Tutorials.png?resize=1024%2C576&amp;quality=100&amp;strip=all&amp;ssl=1 1024w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2023\/03\/Raspberry-Pi-Pinout-Random-Nerd-Tutorials.png?resize=768%2C432&amp;quality=100&amp;strip=all&amp;ssl=1 768w\" sizes=\"(max-width: 1200px) 100vw, 1200px\" \/><\/a><figcaption class=\"wp-element-caption\">Raspberry Pi Pinout (click on the image to see full-size)<\/figcaption><\/figure><\/div>\n\n\n<p>There are several ways to refer to a GPIO pin: its name (which is known as GPIO numbering or Broadcom numbering) or its corresponding pin physical number (which corresponds to the pin&#8217;s physical location on the header). For example, GPIO 18 corresponds to pin 12.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"raspberry-pi-pinout\">Raspberry Pi Pinout Guide<\/h2>\n\n\n\n<p>The following table shows the Raspberry Pi pinout, it shows all GPIOs, their corresponding physical pin numbers, their Broadcom numbering, and corresponding features.<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td class=\"has-text-align-right\" data-align=\"right\"><strong>Function<\/strong><\/td><td class=\"has-text-align-right\" data-align=\"right\"><strong>Name<\/strong><\/td><td class=\"has-text-align-right\" data-align=\"right\"><strong>Pin no.<\/strong><\/td><td><strong>Pin no.<\/strong> <\/td><td><strong>Name<\/strong><\/td><td><strong>Function<\/strong><\/td><\/tr><tr><td class=\"has-text-align-right\" data-align=\"right\">DC power<\/td><td class=\"has-text-align-right\" data-align=\"right\"><span class=\"rnthl rntcorange\">3.3 V<\/span><\/td><td class=\"has-text-align-right\" data-align=\"right\"><strong>1<\/strong><\/td><td><strong>2<\/strong><\/td><td><span class=\"rnthl rntcred\">5 V<\/span><\/td><td>DC power<\/td><\/tr><tr><td class=\"has-text-align-right\" data-align=\"right\"><span class=\"rnthl rntcgreen\">I2C (SDA)<\/span><\/td><td class=\"has-text-align-right\" data-align=\"right\"><span class=\"rnthl rntcgreen\">GPIO <strong>2<\/strong><\/span><\/td><td class=\"has-text-align-right\" data-align=\"right\"><strong>3<\/strong><\/td><td><strong>4<\/strong><\/td><td><span class=\"rnthl rntcred\">5 V<\/span><\/td><td>DC power<\/td><\/tr><tr><td class=\"has-text-align-right\" data-align=\"right\"><span class=\"rnthl rntcgreen\">I2C (SCL)<\/span><\/td><td class=\"has-text-align-right\" data-align=\"right\"><span class=\"rnthl rntcgreen\">GPIO <strong>3<\/strong><\/span><\/td><td class=\"has-text-align-right\" data-align=\"right\"><strong>5<\/strong><\/td><td><strong>6<\/strong><\/td><td><span class=\"rnthl rntcblack\">GND<\/span><\/td><td><\/td><\/tr><tr><td class=\"has-text-align-right\" data-align=\"right\">GPCLK0<\/td><td class=\"has-text-align-right\" data-align=\"right\">GPIO <strong>4<\/strong><\/td><td class=\"has-text-align-right\" data-align=\"right\"><strong>7<\/strong><\/td><td><strong>8<\/strong><\/td><td><span class=\"rnthl rntcblue\">GPIO <strong>14<\/strong><\/span><\/td><td><span class=\"rnthl rntcblue\">UART (TXD0)<\/span><\/td><\/tr><tr><td class=\"has-text-align-right\" data-align=\"right\"><\/td><td class=\"has-text-align-right\" data-align=\"right\"><span class=\"rnthl rntcblack\">GND<\/span><\/td><td class=\"has-text-align-right\" data-align=\"right\"><strong>9<\/strong><\/td><td><strong>10<\/strong><\/td><td><span class=\"rnthl rntcblue\">GPIO <strong>15<\/strong><\/span><\/td><td><span class=\"rnthl rntcblue\">UART (RXD0)<\/span><\/td><\/tr><tr><td class=\"has-text-align-right\" data-align=\"right\"><\/td><td class=\"has-text-align-right\" data-align=\"right\">GPIO <strong>17<\/strong><\/td><td class=\"has-text-align-right\" data-align=\"right\"><strong>11<\/strong><\/td><td><strong>12<\/strong><\/td><td>GPIO <strong>18<\/strong><\/td><td>PCM CLK (I2S)<\/td><\/tr><tr><td class=\"has-text-align-right\" data-align=\"right\"><\/td><td class=\"has-text-align-right\" data-align=\"right\">GPIO <strong>27<\/strong><\/td><td class=\"has-text-align-right\" data-align=\"right\"><strong>13<\/strong><\/td><td><strong>14<\/strong><\/td><td><span class=\"rnthl rntcblack\">GND<\/span><\/td><td><\/td><\/tr><tr><td class=\"has-text-align-right\" data-align=\"right\"><\/td><td class=\"has-text-align-right\" data-align=\"right\">GPIO <strong>22<\/strong><\/td><td class=\"has-text-align-right\" data-align=\"right\"><strong>15<\/strong><\/td><td><strong>16<\/strong><\/td><td>GPIO <strong>23<\/strong><\/td><td><\/td><\/tr><tr><td class=\"has-text-align-right\" data-align=\"right\">DC power<\/td><td class=\"has-text-align-right\" data-align=\"right\"><span class=\"rnthl rntcorange\">3.3 V<\/span><\/td><td class=\"has-text-align-right\" data-align=\"right\"><strong>17<\/strong><\/td><td><strong>18<\/strong><\/td><td>GPIO <strong>24<\/strong><\/td><td><\/td><\/tr><tr><td class=\"has-text-align-right\" data-align=\"right\"><span class=\"rnthl rntcyellow\">SPI (MOSI)<\/span><\/td><td class=\"has-text-align-right\" data-align=\"right\"><span class=\"rnthl rntcyellow\">GPIO <strong>10<\/strong><\/span><\/td><td class=\"has-text-align-right\" data-align=\"right\"><strong>19<\/strong><\/td><td><strong>20<\/strong><\/td><td><span class=\"rnthl rntcblack\">GND<\/span><\/td><td><\/td><\/tr><tr><td class=\"has-text-align-right\" data-align=\"right\"><span class=\"rnthl rntcyellow\">SPI (MISO)<\/span><\/td><td class=\"has-text-align-right\" data-align=\"right\"><span class=\"rnthl rntcyellow\">GPIO <strong>9<\/strong><\/span><\/td><td class=\"has-text-align-right\" data-align=\"right\"><strong>21<\/strong><\/td><td><strong>22<\/strong><\/td><td>GPIO <strong>25<\/strong><\/td><td><\/td><\/tr><tr><td class=\"has-text-align-right\" data-align=\"right\"><span class=\"rnthl rntcyellow\">SPI (CLK)<\/span><\/td><td class=\"has-text-align-right\" data-align=\"right\"><span class=\"rnthl rntcyellow\">GPIO <strong>11<\/strong><\/span><\/td><td class=\"has-text-align-right\" data-align=\"right\"><strong>23<\/strong><\/td><td><strong>24<\/strong><\/td><td><span class=\"rnthl rntcyellow\">GPIO <strong>8<\/strong><\/span><\/td><td><span class=\"rnthl rntcyellow\">SPI (CE0)<\/span><\/td><\/tr><tr><td class=\"has-text-align-right\" data-align=\"right\"><\/td><td class=\"has-text-align-right\" data-align=\"right\"><span class=\"rnthl rntcblack\">GND<\/span><\/td><td class=\"has-text-align-right\" data-align=\"right\"><strong>25<\/strong><\/td><td><strong>26<\/strong><\/td><td><span class=\"rnthl rntcyellow\">GPIO <strong>7<\/strong><\/span><\/td><td><span class=\"rnthl rntcyellow\">SPI (CE1)<\/span><\/td><\/tr><tr><td class=\"has-text-align-right\" data-align=\"right\"><span class=\"rnthl rntclgray\">I2C EEPROM<\/span> <\/td><td class=\"has-text-align-right\" data-align=\"right\"><span class=\"rnthl rntclgray\"><strong>GPIO 0<\/strong><\/span><\/td><td class=\"has-text-align-right\" data-align=\"right\"><strong>27<\/strong><\/td><td><strong>28<\/strong><\/td><td>GPIO<strong> 1<\/strong><\/td><td><span class=\"rnthl rntclgray\">I2C EEPROM<\/span><\/td><\/tr><tr><td class=\"has-text-align-right\" data-align=\"right\"><\/td><td class=\"has-text-align-right\" data-align=\"right\">GPIO <strong>5<\/strong><\/td><td class=\"has-text-align-right\" data-align=\"right\"><strong>29<\/strong><\/td><td><strong>30<\/strong><\/td><td><span class=\"rnthl rntcblack\">GND<\/span><\/td><td><\/td><\/tr><tr><td class=\"has-text-align-right\" data-align=\"right\"><\/td><td class=\"has-text-align-right\" data-align=\"right\">GPIO <strong>6<\/strong><\/td><td class=\"has-text-align-right\" data-align=\"right\"><strong>31<\/strong><\/td><td><strong>32<\/strong><\/td><td>GPIO <strong>12<\/strong><\/td><td> PWM0<\/td><\/tr><tr><td class=\"has-text-align-right\" data-align=\"right\">PWM1<\/td><td class=\"has-text-align-right\" data-align=\"right\">GPIO <strong>13<\/strong><\/td><td class=\"has-text-align-right\" data-align=\"right\"><strong>33<\/strong><\/td><td><strong>34<\/strong><\/td><td><span class=\"rnthl rntcblack\">GND<\/span><\/td><td><\/td><\/tr><tr><td class=\"has-text-align-right\" data-align=\"right\">PCM FS (I2S)<\/td><td class=\"has-text-align-right\" data-align=\"right\">GPIO <strong>19<\/strong><\/td><td class=\"has-text-align-right\" data-align=\"right\"><strong>35<\/strong><\/td><td><strong>36<\/strong><\/td><td>GPIO <strong>16<\/strong><\/td><td><\/td><\/tr><tr><td class=\"has-text-align-right\" data-align=\"right\"><\/td><td class=\"has-text-align-right\" data-align=\"right\">GPIO <strong>26<\/strong><\/td><td class=\"has-text-align-right\" data-align=\"right\"><strong>37<\/strong><\/td><td><strong>38<\/strong><\/td><td>GPIO <strong>20<\/strong><\/td><td>PCM DIN (I2S)<\/td><\/tr><tr><td class=\"has-text-align-right\" data-align=\"right\"><\/td><td class=\"has-text-align-right\" data-align=\"right\"><span class=\"rnthl rntcblack\">GND<\/span><\/td><td class=\"has-text-align-right\" data-align=\"right\"><strong>39<\/strong><\/td><td><strong>40<\/strong><\/td><td>GPIO <strong>21<\/strong><\/td><td>PCM Dout (I2S)<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p class=\"rntxbox rntclgray\"><strong>Note: <\/strong> <em>the Raspberry Pi 1 Model B Rev. 1 was the very first Raspberry Pi board released and has a slightly different pinout from all the other boards. This pinout doesn&#8217;t apply to that board.<\/em><\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"raspberry-pi-peripherals-interface\">Raspberry Pi Peripherals Interface<\/h2>\n\n\n\n<p>The Raspberry Pi GPIOs provide the following peripheral interface options:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>3.3V (on 2 pins)<\/li>\n\n\n\n<li>5V (on 2 pins)<\/li>\n\n\n\n<li>Ground (on 8 pins)<\/li>\n\n\n\n<li>General purpose input and output<\/li>\n\n\n\n<li>PWM (pulse width modulation)<\/li>\n\n\n\n<li>I2C<\/li>\n\n\n\n<li>PCM<\/li>\n\n\n\n<li>SPI<\/li>\n\n\n\n<li>Serial (UART)<\/li>\n<\/ul>\n\n\n\n<p>The Raspberry Pi doesn\u2019t have an analog-to-digital converter (ADC) interface to read analog sensors. However, you can use an external analog-to-digital converter like the <a href=\"https:\/\/makeradvisor.com\/tools\/mcp3008-analog-to-digital-converter\/\" target=\"_blank\" rel=\"noopener\" title=\"\">MCP3008 <\/a>to read analog signals with the Raspberry Pi.<\/p>\n\n\n\n<p class=\"rntbox rntcred\"><strong>Important: <\/strong> The Raspberry Pi GPIOs support voltages only up to 3.3V. If you attach a higher voltage, you may permanently damage your Raspberry Pi.  <\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"raspberry-pi-power-pins\">Raspberry Pi Power Pins<\/h2>\n\n\n\n<p>The Raspberry Pi comes with two <span class=\"rnthl rntcorange\">3.3V<\/span> pins (pins number 1 and 17) and two <span class=\"rnthl rntcred\">5V pins<\/span> (pins 2 and 4). <\/p>\n\n\n\n<p>Additionally, there are eight <span class=\"rnthl rntcblack\">GND<\/span> pins (pins number: 6, 9, 14, 20, 25, 30, 34, and 39).<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"raspberry-pi-digital-inputs-and-outputs\">Raspberry Pi Digital Inputs and Outputs<\/h2>\n\n\n\n<p>Out of the 40 Raspberry Pi GPIOs, 11 are power or GND pins. Besides that, there are two reserved pins (pins 27 and 28) for I2C communication with an EEPROM (<a href=\"#i2c-eeprom\" title=\"\">learn more about this<\/a>). So, this left us with 16 GPIOs that you can use to connect peripherals. These GPIOs can be used either as inputs or outputs. Additionally, some of them support specific communication protocols.<\/p>\n\n\n\n<p>Learn more about digital inputs and outputs with the Raspberry Pi:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/randomnerdtutorials.com\/raspberry-pi-digital-inputs-python\/\">Raspberry Pi: Read Digital Inputs with Python (Buttons and Other Peripherals)<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/randomnerdtutorials.com\/raspberry-pi-digital-outputs-python\/\">Control Raspberry Pi Digital Outputs with Python (LED)<\/a><\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"raspberry-pi-i2c-pins\">Raspberry Pi I2C Pins<\/h2>\n\n\n\n<p>I\u00b2C means Inter-Integrated Circuit, and it is a synchronous, multi-master, multi-slave communication protocol. It allows you to establish communication with other microcontroller devices, sensors, or displays, for example. You can connect multiple I2C devices to the same pins as long they have a unique I2C address.<\/p>\n\n\n\n<p>The Raspberry Pi I2C pins are <strong>GPIO 2<\/strong> and <strong>GPIO 3<\/strong>:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>SDA: <strong>GPIO 2<\/strong><\/li>\n\n\n\n<li>SCL: <strong>GPIO 3<\/strong><\/li>\n<\/ul>\n\n\n\n<p>If you want to use I2C, you need to enable the I2C communication interface first.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"raspberry-pi-spi-pins\">Raspberry Pi SPI Pins<\/h2>\n\n\n\n<p>SPI stands for Serial Peripheral Interface, and it is a synchronous serial data protocol used by microcontrollers to communicate with one or more peripherals. This communication protocol allows you to connect multiple peripherals to the same bus interface, as long as each is connected to a different chip select pin.<\/p>\n\n\n\n<p>For example, your Raspberry Pi board can communicate with a sensor that supports SPI, another Raspberry Pi, or a different microcontroller board. These are the Raspberry Pi SPI pins:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>MOSI: <strong>GPIO 10<\/strong><\/li>\n\n\n\n<li>MISO: <strong>GPIO 9<\/strong><\/li>\n\n\n\n<li>CLOCK: <strong>GPIO 11<\/strong><\/li>\n\n\n\n<li>CE0 (chip select): <strong>GPIO 8<\/strong><\/li>\n\n\n\n<li>CE1 (chip select): <strong>GPIO 7<\/strong><\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"raspberry-pi-serial\">Raspberry Pi Serial (UART) Pins<\/h2>\n\n\n\n<p>The UART pins can be used for Serial communication. The Raspberry Pi Serial (UART) pins are:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>TX: <strong>GPIO 14<\/strong><\/li>\n\n\n\n<li>RX: <strong>GPIO 15<\/strong><\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"pwm-pins\">Raspberry Pi PWM Pins<\/h2>\n\n\n\n<p>PWM stands for Pulse Width Modulation and it is used to control motors, define varying levels of LED brightness, define the color of RGB LEDs, and much more.<\/p>\n\n\n\n<p>The Raspberry Pi has 4 hardware PWM pins: <strong>GPIO 12<\/strong>, <strong>GPIO 13<\/strong>, <strong>GPIO 18<\/strong>, <strong>GPIO 19<\/strong>.<\/p>\n\n\n\n<p>You can have software PWM on all pins.<\/p>\n\n\n\n<p>Learn how to generate PWM signals with the Raspberry Pi:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/randomnerdtutorials.com\/raspberry-pi-pwm-python\/\">Raspberry Pi: PWM Outputs with Python (Fading LED)<\/a><\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"raspberry-pi-adc-pins\">Raspberry Pi ADC Pins<\/h2>\n\n\n\n<p>The Raspberry Pi <strong>doesn\u2019t have any ADC pins<\/strong>\u2014it doesn\u2019t include an analog-to-digital converter. So, you need to convert the analog signal to a digital signal using an analog-to-digital-converter like the <a href=\"https:\/\/makeradvisor.com\/tools\/mcp3008-analog-to-digital-converter\/\" target=\"_blank\" rel=\"noopener\" title=\"\">MCP3008 chip<\/a>.<\/p>\n\n\n\n<p>Being able to read analog signals is useful to read varying voltage levels from a potentiometer or sensors, for example.<\/p>\n\n\n\n<p>Learn how to read analog signals with the Raspberry Pi with the following tutorial:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/randomnerdtutorials.com\/raspberry-pi-analog-inputs-python-mcp3008\/\">Raspberry Pi: Read Analog Inputs with Python (MCP3008)<\/a><\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Raspberry Pi One-Wire Pins<\/h2>\n\n\n\n<p>The Raspberry Pi supports one-wire on all GPIOs, but the<strong> default is GPIO4<\/strong>.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"raspberry-pi-pcm-pins\">Raspberry Pi PCM Pins<\/h2>\n\n\n\n<p>The Raspberry Pi comes with PCM (pulse-code Modulation) pins for digital audio output. These are the PCM pins:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Din: <strong>GPIO 20<\/strong><\/li>\n\n\n\n<li>Dout: <strong>GPIO 21<\/strong><\/li>\n\n\n\n<li>FS: <strong>GPIO 19<\/strong><\/li>\n\n\n\n<li>CLK: <strong>GPIO 18<\/strong><\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"i2c-eeprom\">I2C EEPROM<\/h2>\n\n\n\n<p>Pins 27 and 28 (GPIO 0 and GPIO 1) are reserved for connecting a HAT ID EEPROM. Do not use these pins unless you&#8217;re using an I2C ID EEPROM. Leave unconnected if you&#8217;re not using an I2C EEPROM.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"wrapping-up\">Wrapping Up<\/h2>\n\n\n\n<p>We hope you&#8217;ve found this guide about the Raspberry Pi GPIOs useful. <\/p>\n\n\n\n<p>One of the easiest ways to control the Raspberry Pi GPIOs is using Python and the <span class=\"rnthl rntliteral\">gpiozero<\/span> library. We&#8217;ll create some tutorials about how to use the GPIOs soon. So, stay tuned.<\/p>\n\n\n\n<p>You may also like: <\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/randomnerdtutorials.com\/projects-raspberry-pi\/\">Raspberry Pi Projects<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/makeradvisor.com\/best-raspberry-pi-starter-kits\/\" target=\"_blank\" rel=\"noopener\" title=\"\">Get a Raspberry Pi Starter Kit<\/a><\/li>\n<\/ul>\n\n\n\n<p>You can check all our Raspberry Pi projects on the following link:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/randomnerdtutorials.com\/projects-raspberry-pi\/\" title=\"\">Free Raspberry Pi Projects and Tutorials<\/a><\/li>\n<\/ul>\n\n\n\n<p>We have other guides about the ESP32, ESP8266 and ESP32-CAM GPIOs:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/randomnerdtutorials.com\/esp32-pinout-reference-gpios\/\">ESP32 Pinout Reference: Which GPIO pins should you use?<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/randomnerdtutorials.com\/esp8266-pinout-reference-gpios\/\">ESP8266 Pinout Reference: Which GPIO pins should you use?<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/randomnerdtutorials.com\/esp32-cam-ai-thinker-pinout\/\">ESP32-CAM AI-Thinker Pinout Guide: GPIOs Usage Explained<\/a><\/li>\n<\/ul>\n\n\n\n<p>Thanks for reading.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>The Raspberry Pi 4 Model B and most recent versions of the Raspberry Pi have a double row of 40 GPIOs (General Purpose Input\/Output Pins) that allow you to connect &#8230; <\/p>\n<p class=\"read-more-container\"><a title=\"Raspberry Pi Pinout Guide: How to use the Raspberry Pi GPIOs?\" class=\"read-more button\" href=\"https:\/\/randomnerdtutorials.com\/raspberry-pi-pinout-gpios\/#more-95043\" aria-label=\"Read more about Raspberry Pi Pinout Guide: How to use the Raspberry Pi GPIOs?\">CONTINUE READING \u00bb<\/a><\/p>\n","protected":false},"author":5,"featured_media":129371,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[301],"tags":[],"class_list":["post-95043","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-0-raspberrypi"],"aioseo_notices":[],"jetpack_featured_media_url":"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2023\/03\/Raspberry-Pi-Pinout-Thumbnail.jpg?fit=1280%2C720&quality=100&strip=all&ssl=1","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/posts\/95043","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/comments?post=95043"}],"version-history":[{"count":24,"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/posts\/95043\/revisions"}],"predecessor-version":[{"id":133418,"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/posts\/95043\/revisions\/133418"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/media\/129371"}],"wp:attachment":[{"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/media?parent=95043"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/categories?post=95043"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/tags?post=95043"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}