{"id":3001,"date":"2021-06-28T17:01:29","date_gmt":"2021-06-28T17:01:29","guid":{"rendered":"https:\/\/roboticsbackend.com\/?p=3001"},"modified":"2021-12-30T17:22:50","modified_gmt":"2021-12-30T17:22:50","slug":"raspberry-pi-gpios-default-state","status":"publish","type":"post","link":"https:\/\/roboticsbackend.com\/raspberry-pi-gpios-default-state\/","title":{"rendered":"Raspberry Pi&#8217;s GPIOs Default State"},"content":{"rendered":"<p>So, you&#8217;ve been playing with your Raspberry Pi and the GPIO panel, and you&#8217;ve noticed that when you read the GPIOs, some of them give you the value HIGH (or 1) by default, some of them give you the value LOW (0). Why is that?<\/p>\n<p>In this tutorial I will show you what is the default state for each GPIO on the Raspberry Pi, why it&#8217;s like this, and also what you can do if you want to &#8220;override&#8221; that default state.<\/p>\n<p>To control the GPIOs we will use the RPi.GPIO Python module.<\/p>\n<p>What you&#8217;ll see here applies for Raspberry Pi 4, but also for Raspberry Pi 3 and 2 (using the 40 GPIOs panel).<\/p>\n<p>&gt;&gt; Here is a video version of this tutorial, as an additional resource:<\/p>\n<p><iframe loading=\"lazy\" title=\"Raspberry Pi - GPIOs Default State - And How to Fix!\" width=\"1200\" height=\"675\" src=\"https:\/\/www.youtube.com\/embed\/kstFtHlJf2M?feature=oembed\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture\" allowfullscreen><\/iframe><\/p>\n<p>After watching the video, <a href=\"https:\/\/www.youtube.com\/c\/RoboticsBackEnd?sub_confirmation=1\">subscribe to the Robotics Back-End Youtube channel<\/a> so you don\u2019t miss the next tutorials!<\/p>\n<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_81 counter-hierarchy ez-toc-counter ez-toc-grey ez-toc-container-direction\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">Table of Contents<\/p>\n<label for=\"ez-toc-cssicon-toggle-item-69fcc92548660\" class=\"ez-toc-cssicon-toggle-label\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #999;color:#999\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #999;color:#999\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/label><input type=\"checkbox\"  id=\"ez-toc-cssicon-toggle-item-69fcc92548660\"  aria-label=\"Toggle\" \/><nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/roboticsbackend.com\/raspberry-pi-gpios-default-state\/#GPIOs_default_state_for_Raspberry_Pi\" >GPIOs default state for Raspberry Pi<\/a><ul class='ez-toc-list-level-3' ><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/roboticsbackend.com\/raspberry-pi-gpios-default-state\/#The_concerned_GPIOs\" >The concerned GPIOs<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/roboticsbackend.com\/raspberry-pi-gpios-default-state\/#When_the_default_states_apply\" >When the default states apply<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/roboticsbackend.com\/raspberry-pi-gpios-default-state\/#Default_states_for_Raspberry_Pis_GPIOs\" >Default states for Raspberry Pi&#8217;s GPIOs<\/a><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/roboticsbackend.com\/raspberry-pi-gpios-default-state\/#Code_to_test_GPIO_default_states\" >Code to test GPIO default states<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-6\" href=\"https:\/\/roboticsbackend.com\/raspberry-pi-gpios-default-state\/#Why_is_the_GPIO_default_state_like_that\" >Why is the GPIO default state like that?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-7\" href=\"https:\/\/roboticsbackend.com\/raspberry-pi-gpios-default-state\/#How_to_%E2%80%9Coverride%E2%80%9D_the_default_state_for_Raspberry_Pis_GPIOs\" >How to &#8220;override&#8221; the default state for Raspberry Pi&#8217;s GPIOs<\/a><ul class='ez-toc-list-level-3' ><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-8\" href=\"https:\/\/roboticsbackend.com\/raspberry-pi-gpios-default-state\/#Override_the_default_state_with_the_code\" >Override the default state with the code<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-9\" href=\"https:\/\/roboticsbackend.com\/raspberry-pi-gpios-default-state\/#Override_the_default_state_with_an_external_pull_updown_resistor\" >Override the default state with an external pull up\/down resistor<\/a><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-10\" href=\"https:\/\/roboticsbackend.com\/raspberry-pi-gpios-default-state\/#Conclusion_%E2%80%93_Raspberry_Pis_GPIOs_default_state_%E2%80%93_What_to_do\" >Conclusion &#8211; Raspberry Pi&#8217;s GPIOs default state &#8211; What to do<\/a><\/li><\/ul><\/nav><\/div>\n<h2><span class=\"ez-toc-section\" id=\"GPIOs_default_state_for_Raspberry_Pi\"><\/span>GPIOs default state for Raspberry Pi<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<h3><span class=\"ez-toc-section\" id=\"The_concerned_GPIOs\"><\/span>The concerned GPIOs<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>For this tutorial I will use the Raspberry Pi&#8217;s pins whose primary function is the &#8220;standard GPIO&#8221; function.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-391 aligncenter\" src=\"https:\/\/roboticsbackend.com\/wp-content\/uploads\/2019\/05\/raspberry-pi-3-pinout.jpg\" alt=\"Raspberry Pi 4 Pinout\" width=\"800\" height=\"844\" srcset=\"https:\/\/roboticsbackend.com\/wp-content\/uploads\/2019\/05\/raspberry-pi-3-pinout.jpg 800w, https:\/\/roboticsbackend.com\/wp-content\/uploads\/2019\/05\/raspberry-pi-3-pinout-284x300.jpg 284w, https:\/\/roboticsbackend.com\/wp-content\/uploads\/2019\/05\/raspberry-pi-3-pinout-768x810.jpg 768w\" sizes=\"auto, (max-width: 800px) 100vw, 800px\" \/><\/p>\n<p>Basically I&#8217;m talking about the pins you can see in orange in the previous image, with a GPIO number. We will use this GPIO number and not the pin number (white text on grey background). For example, GPIO 26 and not pin 37. If you want a complete overview, check out this <a href=\"https:\/\/roboticsbackend.com\/raspberry-pi-3-pins\/\">Raspberry Pi pin-out guide<\/a>.<\/p>\n<h3><span class=\"ez-toc-section\" id=\"When_the_default_states_apply\"><\/span>When the default states apply<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>First, let&#8217;s define exactly what is the &#8220;default state&#8221;. The default state for GPIO applies with the following conditions. You&#8217;ve:<\/p>\n<ol>\n<li>Boot the Raspberry Pi.<\/li>\n<li>Set a GPIO as input.<\/li>\n<li>Read the GPIO&#8217;s state.<\/li>\n<\/ol>\n<p>And you&#8217;ve not:<\/p>\n<ul>\n<li>Added any external pull up\/down resistor.<\/li>\n<li>Used the GPIO.cleanup() before.<\/li>\n<li>Configured the pin as output before setting it as input.<\/li>\n<\/ul>\n<p>If you&#8217;ve done any of the previous things, you&#8217;ll have to reboot your Pi in order to get the default states again.<\/p>\n<h3><span class=\"ez-toc-section\" id=\"Default_states_for_Raspberry_Pis_GPIOs\"><\/span>Default states for Raspberry Pi&#8217;s GPIOs<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>So, provided that you&#8217;ve followed the 3 steps and not done any of the &#8220;don&#8217;t do&#8221; steps, you will see the following:<\/p>\n<ul>\n<li>GPIOs up to 8: default state is 1 (HIGH, or close to 3.3V).<\/li>\n<li>GPIOs 9 to 27: default state is 0 (LOW, or close to 0V).<\/li>\n<\/ul>\n<h2><span class=\"ez-toc-section\" id=\"Code_to_test_GPIO_default_states\"><\/span>Code to test GPIO default states<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>Here&#8217;s a Python code you can run on your Raspberry Pi to test yourself. If you don&#8217;t know how to run a Python script on your Pi, check out this <a href=\"https:\/\/roboticsbackend.com\/thonny-ide-raspberry-pi-os\/\">intro to Thonny IDE<\/a> (for Raspberry Pi OS), or <a href=\"https:\/\/roboticsbackend.com\/raspberry-pi-run-python-script-in-the-terminal\/\">how to run a Python program in the terminal<\/a>.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"python\">import RPi.GPIO as GPIO\r\n\r\nGPIO.setmode(GPIO.BCM)\r\n\r\nGPIOs = [2, 3, 4, 5, 6, 7, 8, 9, 10, 11,\r\n         12, 13, 16, 17, 18, 19, 20, 21,\r\n         22, 23, 24, 25, 26, 27]\r\n\r\n# Setup all GPIOs to input\r\nfor gpio in GPIOs:\r\n    GPIO.setup(gpio, GPIO.IN)\r\n    \r\n# Read state for each GPIO\r\nfor gpio in GPIOs:\r\n    print(\"GPIO no \" + str(gpio) + \": \" + str(GPIO.input(gpio)))\r\n    \r\n# Cleanup all GPIOs - state will be different after that!\r\nGPIO.cleanup()\r\n<\/pre>\n<p>In this code you can see an array containing all the GPIOs we are using (from the previous pins image).<\/p>\n<p>Then, we set the mode for each GPIO to input &#8211; GPIO.IN, and we read the state for the GPIO with GPIO.input(gpio). We print that state along with the GPIO number.<\/p>\n<p>So, the first time we run this program, we get:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-linenumbers=\"false\">GPIO no 2: 1\r\nGPIO no 3: 1\r\nGPIO no 4: 1\r\nGPIO no 5: 1\r\nGPIO no 6: 1\r\nGPIO no 7: 1\r\nGPIO no 8: 1\r\nGPIO no 9: 0\r\nGPIO no 10: 0\r\nGPIO no 11: 0\r\nGPIO no 12: 0\r\nGPIO no 13: 0\r\nGPIO no 16: 0\r\nGPIO no 17: 0\r\nGPIO no 18: 0\r\nGPIO no 19: 0\r\nGPIO no 20: 0\r\nGPIO no 21: 0\r\nGPIO no 22: 0\r\nGPIO no 23: 0\r\nGPIO no 24: 0\r\nGPIO no 25: 0\r\nGPIO no 26: 0\r\nGPIO no 27: 0<\/pre>\n<p>As you can see, GPIOs up to 8 get the state 1 (HIGH, or close to 3.3V), and GPIOs from 9 to 27 get the state 0 (LOW, or close to 0V).<\/p>\n<p>And then, one thing we do at the end of the program is to call the GPIO.cleanup() function. This function will reset the mode of all pins to input, to avoid letting some pins as output, which can be dangerous for the Pi. And &#8211; warning! &#8211; this will also alter the future state (which will not be &#8220;default&#8221; anymore) of the GPIOs in input mode.<\/p>\n<p>So, if you run this program a second time, you will get:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-linenumbers=\"false\">GPIO no 2: 1\r\nGPIO no 3: 1\r\nGPIO no 4: 1\r\nGPIO no 5: 1\r\nGPIO no 6: 1\r\nGPIO no 7: 1\r\nGPIO no 8: 1\r\nGPIO no 9: 1\r\nGPIO no 10: 1\r\nGPIO no 11: 1\r\nGPIO no 12: 1\r\nGPIO no 13: 1\r\nGPIO no 16: 1\r\nGPIO no 17: 1\r\nGPIO no 18: 1\r\nGPIO no 19: 1\r\nGPIO no 20: 1\r\nGPIO no 21: 1\r\nGPIO no 22: 1\r\nGPIO no 23: 1\r\nGPIO no 24: 1\r\nGPIO no 25: 1\r\nGPIO no 26: 1\r\nGPIO no 27: 1<\/pre>\n<p>This is because the function GPIO.cleanup() was executed during the first program run. Now if you want to get the default states again, you&#8217;ll have to reboot your Pi. Also note that if you only plan to use GPIOs as input, you don&#8217;t need to call GPIO.cleanup(). This function is only useful when you have GPIOs set as output mode.<\/p>\n<p>Another thing: if you have set your GPIOs to output mode, and then to input, chances are that you&#8217;re going to read 1 (HIGH) for all GPIOs.<\/p>\n<p>As you can see, the default state is only after you boot your Pi, under a certain set of circumstances. Then, it&#8217;s quite probable that this &#8220;default&#8221; state will be modified in your future programs.<\/p>\n<h2><span class=\"ez-toc-section\" id=\"Why_is_the_GPIO_default_state_like_that\"><\/span>Why is the GPIO default state like that?<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>First, on <a href=\"https:\/\/www.raspberrypi.org\/app\/uploads\/2012\/02\/BCM2835-ARM-Peripherals.pdf#page=102\" target=\"_blank\" rel=\"noopener\">page 102 of the Broadcom 2835 datasheet<\/a> (Broadcom 2835 is the more technical name for the GPIO header), check the second column named &#8220;Pull&#8221;. In this column, for each GPIO, you will see either HIGH or LOW.<\/p>\n<p>This value is also the same you found when running the code: HIGH for GPIOs up to 8, and LOW for GPIOs starting from 9.<\/p>\n<p>Here, HIGH means that there is a default pull up resistor on the pin, and LOW means there is a default pull down resistor on the pin. I&#8217;m not going to explain everything about pull up and down resistors, just this:<\/p>\n<ul>\n<li>When you add a resistor between a component and the ground, this is a pull down resistor, which will make sure the default voltage you read is close to 0V.<\/li>\n<li>When you add a resistor between a component and Vcc (power supply), this is a pull up resistor, which will make sure the default voltage you read is close to Vcc (3.3V for the Raspberry Pi)<\/li>\n<\/ul>\n<p>So, what this tells you is that for GPIOs 0 to 8, there is an internal pull up resistor, which will make you read 1 (HIGH) by default. For GPIOs 9+, there is an internal pull down resistor, which will make you read 0 (LOW) by default.<\/p>\n<p>Now, what is the value of this pull up\/down resistor?<\/p>\n<p>Unfortunately, it&#8217;s not possible to know exactly. The actual Raspberry Pi hardware is not open source (most of the software is, not the hardware), so there is no way to know directly from the Raspberry Pi Foundation. However, with some tests published by users on the Internet, we can approximate this internal resistor to be 50kOhm.<\/p>\n<h2><span class=\"ez-toc-section\" id=\"How_to_%E2%80%9Coverride%E2%80%9D_the_default_state_for_Raspberry_Pis_GPIOs\"><\/span>How to &#8220;override&#8221; the default state for Raspberry Pi&#8217;s GPIOs<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>Now let&#8217;s have a look at 2 different ways you can override this default state for the GPIOs. You may be fine with the default state, but you could also want to set the default state to something else (all HIGH, all LOW, or a mix of both).<\/p>\n<h3><span class=\"ez-toc-section\" id=\"Override_the_default_state_with_the_code\"><\/span>Override the default state with the code<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>Using the RPi.GPIO Python module, you can choose to make the internal resistor as a pull up, or a pull down resistor, for any given GPIO.<\/p>\n<p>Here&#8217;s a code example with just one GPIO.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"python\">import RPi.GPIO as GPIO\r\n\r\nGPIO.setmode(GPIO.BCM)\r\n\r\ngpio_number = 8\r\n\r\nGPIO.setup(gpio_number, GPIO.IN, pull_up_down=GPIO.PUD_UP)\r\n\r\nprint(\"GPIO no \" + str(gpio_number) + \": \" + str(GPIO.input(gpio_number)))<\/pre>\n<p>To choose what is going to be the internal resistor, you have to add the option &#8220;pull_up_down=&#8221; to the GPIO.setup() function, with:<\/p>\n<ul>\n<li>GPIO.PUD_UP for pull up.<\/li>\n<li>GPIO.PUD_DOWN for pull down.<\/li>\n<\/ul>\n<p>If you run this code (using GPIO.PUD_UP), you&#8217;ll get the result: <code class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">GPIO no 8: 1<\/code>.<\/p>\n<p>And if you change the code (using GPIO.PUD_DOWN instead of GPIO.PUD_UP), you&#8217;ll get: <code class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">GPIO no 8: 0<\/code>.<\/p>\n<p>This way, with just one small addition in your code, you can decide yourself of the default state for any GPIO.<\/p>\n<h3><span class=\"ez-toc-section\" id=\"Override_the_default_state_with_an_external_pull_updown_resistor\"><\/span>Override the default state with an external pull up\/down resistor<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>This method requires you to add a resistor to your circuit, for each GPIO you want to use. So basically you&#8217;ll have both the internal pull up\/down resistor, and your own external pull up\/down resistor. To make your external resistor &#8220;take over&#8221;, you just have to provide a stronger value, for example 10kOhm. 10kOhm is stronger than 50kOhm, it works in reverse for the resistors.<\/p>\n<p>Here is an example with a circuit containing a push button and an LED.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"size-large wp-image-894 aligncenter\" src=\"https:\/\/roboticsbackend.com\/wp-content\/uploads\/2019\/08\/raspberry_pi_led_push_button-1024x812.png\" alt=\"Raspberry Pi LED and Push Button\" width=\"1024\" height=\"812\" srcset=\"https:\/\/roboticsbackend.com\/wp-content\/uploads\/2019\/08\/raspberry_pi_led_push_button-1024x812.png 1024w, https:\/\/roboticsbackend.com\/wp-content\/uploads\/2019\/08\/raspberry_pi_led_push_button-300x238.png 300w, https:\/\/roboticsbackend.com\/wp-content\/uploads\/2019\/08\/raspberry_pi_led_push_button-768x609.png 768w, https:\/\/roboticsbackend.com\/wp-content\/uploads\/2019\/08\/raspberry_pi_led_push_button.png 1755w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/p>\n<p>For the LED, you have a resistor, but this is different. The GPIO for the LED will be configured as output, and the resistor is here simply to limit the current that goes through the LED. As we&#8217;ve seen before, the default state issue is only when you read a GPIO in input mode.<\/p>\n<p>For the push button, you can see a 10kOhm resistor between one leg (same side as the connection with a GPIO), and the ground (GND). This pull down resistor will make sure that when you read the value from the push button, you will get 0 (LOW) when the push button is not pressed, and 1 (HIGH) when the button is pressed.<\/p>\n<p>With this external pull down resistor, you are sure to get the same value every time. The internal pull up\/down resistor is too weak compared to this external resistor, it won&#8217;t have any effect. So, in this case using the option pull_up_down=GPIO.PUD_UP or GPIO.PUD_DOWN will have no effect.<\/p>\n<h2><span class=\"ez-toc-section\" id=\"Conclusion_%E2%80%93_Raspberry_Pis_GPIOs_default_state_%E2%80%93_What_to_do\"><\/span>Conclusion &#8211; Raspberry Pi&#8217;s GPIOs default state &#8211; What to do<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>As you&#8217;ve seen in this tutorial, each GPIO on the Raspberry Pi has a 50kOhm internal resistor, which can be used as a pull up or pull down resistor in your code.<\/p>\n<p>And by default, before you set anything, the resistors for GPIOs up to number 8 will automatically be set as pull up, and for GPIOs after number 9, pull down.<\/p>\n<p>This default state will only be activated after you boot the Pi. If you use the GPIOs in your code you might change that &#8220;default&#8221; state for any other program you run after that. The only way to come back to the &#8220;true&#8221; default state is by rebooting your Raspberry Pi.<\/p>\n<p>So, a recommendation here is to choose yourself (or &#8220;override&#8221;) the default state when you use a GPIO as input. You don&#8217;t want to get values that are hard to predict.<\/p>\n<p>The first option is to set the internal pull up\/down resistor in your code, for example with the RPi.GPIO module. But this option is not optimal. The value of the resistor &#8211; 50kOhm &#8211; is quite weak actually, and if you have longer wires, you might experience weird behaviors.<\/p>\n<p>The best option is to add an external 10kOhm resistor by yourself, either in pull up (connected to Vcc) or pull down mode (connected to ground). This is a bit more work, but with this you will be sure to get predictable and stable results when you read data from a component.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>So, you&#8217;ve been playing with your Raspberry Pi and the GPIO panel, and you&#8217;ve noticed that when you read the GPIOs, some of them give you the value HIGH (or 1) by default, some of them give you the value LOW (0). Why is that? In this tutorial I will show you what is the &#8230; <a title=\"Raspberry Pi&#8217;s GPIOs Default State\" class=\"read-more\" href=\"https:\/\/roboticsbackend.com\/raspberry-pi-gpios-default-state\/\" aria-label=\"Read more about Raspberry Pi&#8217;s GPIOs Default State\">Read more<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5],"tags":[],"class_list":["post-3001","post","type-post","status-publish","format-standard","hentry","category-raspberry-pi"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.1.1 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Raspberry Pi&#039;s GPIOs Default State - The Robotics Back-End<\/title>\n<meta name=\"description\" content=\"Get to know the default state for each GPIO of the Raspberry Pi. Also learn how to set yourself a default state for GPIOs.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/roboticsbackend.com\/raspberry-pi-gpios-default-state\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Raspberry Pi&#039;s GPIOs Default State - The Robotics Back-End\" \/>\n<meta property=\"og:description\" content=\"Get to know the default state for each GPIO of the Raspberry Pi. Also learn how to set yourself a default state for GPIOs.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/roboticsbackend.com\/raspberry-pi-gpios-default-state\/\" \/>\n<meta property=\"og:site_name\" content=\"The Robotics Back-End\" \/>\n<meta property=\"article:published_time\" content=\"2021-06-28T17:01:29+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2021-12-30T17:22:50+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/roboticsbackend.com\/wp-content\/uploads\/2019\/05\/raspberry-pi-3-pinout.jpg\" \/>\n<meta name=\"author\" content=\"ed\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@RoboticsBackend\" \/>\n<meta name=\"twitter:site\" content=\"@RoboticsBackend\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"ed\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"9 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/roboticsbackend.com\/raspberry-pi-gpios-default-state\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/roboticsbackend.com\/raspberry-pi-gpios-default-state\/\"},\"author\":{\"name\":\"ed\",\"@id\":\"https:\/\/roboticsbackend.com\/#\/schema\/person\/a20832f15e39847d8eea5be981767353\"},\"headline\":\"Raspberry Pi&#8217;s GPIOs Default State\",\"datePublished\":\"2021-06-28T17:01:29+00:00\",\"dateModified\":\"2021-12-30T17:22:50+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/roboticsbackend.com\/raspberry-pi-gpios-default-state\/\"},\"wordCount\":1740,\"publisher\":{\"@id\":\"https:\/\/roboticsbackend.com\/#organization\"},\"image\":{\"@id\":\"https:\/\/roboticsbackend.com\/raspberry-pi-gpios-default-state\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/roboticsbackend.com\/wp-content\/uploads\/2019\/05\/raspberry-pi-3-pinout.jpg\",\"articleSection\":[\"Raspberry Pi Tutorials\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/roboticsbackend.com\/raspberry-pi-gpios-default-state\/\",\"url\":\"https:\/\/roboticsbackend.com\/raspberry-pi-gpios-default-state\/\",\"name\":\"Raspberry Pi's GPIOs Default State - The Robotics Back-End\",\"isPartOf\":{\"@id\":\"https:\/\/roboticsbackend.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/roboticsbackend.com\/raspberry-pi-gpios-default-state\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/roboticsbackend.com\/raspberry-pi-gpios-default-state\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/roboticsbackend.com\/wp-content\/uploads\/2019\/05\/raspberry-pi-3-pinout.jpg\",\"datePublished\":\"2021-06-28T17:01:29+00:00\",\"dateModified\":\"2021-12-30T17:22:50+00:00\",\"description\":\"Get to know the default state for each GPIO of the Raspberry Pi. Also learn how to set yourself a default state for GPIOs.\",\"breadcrumb\":{\"@id\":\"https:\/\/roboticsbackend.com\/raspberry-pi-gpios-default-state\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/roboticsbackend.com\/raspberry-pi-gpios-default-state\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/roboticsbackend.com\/raspberry-pi-gpios-default-state\/#primaryimage\",\"url\":\"https:\/\/roboticsbackend.com\/wp-content\/uploads\/2019\/05\/raspberry-pi-3-pinout.jpg\",\"contentUrl\":\"https:\/\/roboticsbackend.com\/wp-content\/uploads\/2019\/05\/raspberry-pi-3-pinout.jpg\",\"width\":800,\"height\":844,\"caption\":\"Raspberry Pi 4 Pinout\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/roboticsbackend.com\/raspberry-pi-gpios-default-state\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/roboticsbackend.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Raspberry Pi&#8217;s GPIOs Default State\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/roboticsbackend.com\/#website\",\"url\":\"https:\/\/roboticsbackend.com\/\",\"name\":\"The Robotics Back-End\",\"description\":\"Program Robots, Step by Step\",\"publisher\":{\"@id\":\"https:\/\/roboticsbackend.com\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/roboticsbackend.com\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/roboticsbackend.com\/#organization\",\"name\":\"Robotics Back-End\",\"url\":\"https:\/\/roboticsbackend.com\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/roboticsbackend.com\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/roboticsbackend.com\/wp-content\/uploads\/2020\/02\/logo_hd.png\",\"contentUrl\":\"https:\/\/roboticsbackend.com\/wp-content\/uploads\/2020\/02\/logo_hd.png\",\"width\":2500,\"height\":1875,\"caption\":\"Robotics Back-End\"},\"image\":{\"@id\":\"https:\/\/roboticsbackend.com\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/x.com\/RoboticsBackend\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/roboticsbackend.com\/#\/schema\/person\/a20832f15e39847d8eea5be981767353\",\"name\":\"ed\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/roboticsbackend.com\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/7b666620f11fb12df5674e1e1ee525afe3d4ceecdaa57f8c60f6a937a33e3427?s=96&d=identicon&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/7b666620f11fb12df5674e1e1ee525afe3d4ceecdaa57f8c60f6a937a33e3427?s=96&d=identicon&r=g\",\"caption\":\"ed\"}}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Raspberry Pi's GPIOs Default State - The Robotics Back-End","description":"Get to know the default state for each GPIO of the Raspberry Pi. Also learn how to set yourself a default state for GPIOs.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/roboticsbackend.com\/raspberry-pi-gpios-default-state\/","og_locale":"en_US","og_type":"article","og_title":"Raspberry Pi's GPIOs Default State - The Robotics Back-End","og_description":"Get to know the default state for each GPIO of the Raspberry Pi. Also learn how to set yourself a default state for GPIOs.","og_url":"https:\/\/roboticsbackend.com\/raspberry-pi-gpios-default-state\/","og_site_name":"The Robotics Back-End","article_published_time":"2021-06-28T17:01:29+00:00","article_modified_time":"2021-12-30T17:22:50+00:00","og_image":[{"url":"https:\/\/roboticsbackend.com\/wp-content\/uploads\/2019\/05\/raspberry-pi-3-pinout.jpg","type":"","width":"","height":""}],"author":"ed","twitter_card":"summary_large_image","twitter_creator":"@RoboticsBackend","twitter_site":"@RoboticsBackend","twitter_misc":{"Written by":"ed","Est. reading time":"9 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/roboticsbackend.com\/raspberry-pi-gpios-default-state\/#article","isPartOf":{"@id":"https:\/\/roboticsbackend.com\/raspberry-pi-gpios-default-state\/"},"author":{"name":"ed","@id":"https:\/\/roboticsbackend.com\/#\/schema\/person\/a20832f15e39847d8eea5be981767353"},"headline":"Raspberry Pi&#8217;s GPIOs Default State","datePublished":"2021-06-28T17:01:29+00:00","dateModified":"2021-12-30T17:22:50+00:00","mainEntityOfPage":{"@id":"https:\/\/roboticsbackend.com\/raspberry-pi-gpios-default-state\/"},"wordCount":1740,"publisher":{"@id":"https:\/\/roboticsbackend.com\/#organization"},"image":{"@id":"https:\/\/roboticsbackend.com\/raspberry-pi-gpios-default-state\/#primaryimage"},"thumbnailUrl":"https:\/\/roboticsbackend.com\/wp-content\/uploads\/2019\/05\/raspberry-pi-3-pinout.jpg","articleSection":["Raspberry Pi Tutorials"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/roboticsbackend.com\/raspberry-pi-gpios-default-state\/","url":"https:\/\/roboticsbackend.com\/raspberry-pi-gpios-default-state\/","name":"Raspberry Pi's GPIOs Default State - The Robotics Back-End","isPartOf":{"@id":"https:\/\/roboticsbackend.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/roboticsbackend.com\/raspberry-pi-gpios-default-state\/#primaryimage"},"image":{"@id":"https:\/\/roboticsbackend.com\/raspberry-pi-gpios-default-state\/#primaryimage"},"thumbnailUrl":"https:\/\/roboticsbackend.com\/wp-content\/uploads\/2019\/05\/raspberry-pi-3-pinout.jpg","datePublished":"2021-06-28T17:01:29+00:00","dateModified":"2021-12-30T17:22:50+00:00","description":"Get to know the default state for each GPIO of the Raspberry Pi. Also learn how to set yourself a default state for GPIOs.","breadcrumb":{"@id":"https:\/\/roboticsbackend.com\/raspberry-pi-gpios-default-state\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/roboticsbackend.com\/raspberry-pi-gpios-default-state\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/roboticsbackend.com\/raspberry-pi-gpios-default-state\/#primaryimage","url":"https:\/\/roboticsbackend.com\/wp-content\/uploads\/2019\/05\/raspberry-pi-3-pinout.jpg","contentUrl":"https:\/\/roboticsbackend.com\/wp-content\/uploads\/2019\/05\/raspberry-pi-3-pinout.jpg","width":800,"height":844,"caption":"Raspberry Pi 4 Pinout"},{"@type":"BreadcrumbList","@id":"https:\/\/roboticsbackend.com\/raspberry-pi-gpios-default-state\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/roboticsbackend.com\/"},{"@type":"ListItem","position":2,"name":"Raspberry Pi&#8217;s GPIOs Default State"}]},{"@type":"WebSite","@id":"https:\/\/roboticsbackend.com\/#website","url":"https:\/\/roboticsbackend.com\/","name":"The Robotics Back-End","description":"Program Robots, Step by Step","publisher":{"@id":"https:\/\/roboticsbackend.com\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/roboticsbackend.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/roboticsbackend.com\/#organization","name":"Robotics Back-End","url":"https:\/\/roboticsbackend.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/roboticsbackend.com\/#\/schema\/logo\/image\/","url":"https:\/\/roboticsbackend.com\/wp-content\/uploads\/2020\/02\/logo_hd.png","contentUrl":"https:\/\/roboticsbackend.com\/wp-content\/uploads\/2020\/02\/logo_hd.png","width":2500,"height":1875,"caption":"Robotics Back-End"},"image":{"@id":"https:\/\/roboticsbackend.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/x.com\/RoboticsBackend"]},{"@type":"Person","@id":"https:\/\/roboticsbackend.com\/#\/schema\/person\/a20832f15e39847d8eea5be981767353","name":"ed","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/roboticsbackend.com\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/7b666620f11fb12df5674e1e1ee525afe3d4ceecdaa57f8c60f6a937a33e3427?s=96&d=identicon&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/7b666620f11fb12df5674e1e1ee525afe3d4ceecdaa57f8c60f6a937a33e3427?s=96&d=identicon&r=g","caption":"ed"}}]}},"_links":{"self":[{"href":"https:\/\/roboticsbackend.com\/wp-json\/wp\/v2\/posts\/3001","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/roboticsbackend.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/roboticsbackend.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/roboticsbackend.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/roboticsbackend.com\/wp-json\/wp\/v2\/comments?post=3001"}],"version-history":[{"count":0,"href":"https:\/\/roboticsbackend.com\/wp-json\/wp\/v2\/posts\/3001\/revisions"}],"wp:attachment":[{"href":"https:\/\/roboticsbackend.com\/wp-json\/wp\/v2\/media?parent=3001"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/roboticsbackend.com\/wp-json\/wp\/v2\/categories?post=3001"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/roboticsbackend.com\/wp-json\/wp\/v2\/tags?post=3001"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}