{"id":106,"date":"2023-08-05T08:04:49","date_gmt":"2023-08-05T08:04:49","guid":{"rendered":"http:\/\/it4home.dk\/?p=106"},"modified":"2023-08-06T09:13:54","modified_gmt":"2023-08-06T09:13:54","slug":"configuring-power-on-off-button-for-raspberry-pi-4b","status":"publish","type":"post","link":"https:\/\/it4home.dk\/index.php\/2023\/08\/05\/configuring-power-on-off-button-for-raspberry-pi-4b\/","title":{"rendered":"Configuring Power-On\/Off Button for Raspberry Pi 4B"},"content":{"rendered":"<div class=\"pdfprnt-buttons pdfprnt-buttons-post pdfprnt-top-right\"><a href=\"https:\/\/it4home.dk\/index.php\/wp-json\/wp\/v2\/posts\/106?print=pdf\" class=\"pdfprnt-button pdfprnt-button-pdf\" target=\"_blank\" ><\/a><a href=\"https:\/\/it4home.dk\/index.php\/wp-json\/wp\/v2\/posts\/106?print=print\" class=\"pdfprnt-button pdfprnt-button-print\" target=\"_blank\" ><img decoding=\"async\" src=\"https:\/\/it4home.dk\/wp-content\/plugins\/pdf-print\/images\/print.png\" alt=\"image_print\" title=\"Print Content\" \/><\/a><\/div>\n<p class=\"wp-block-paragraph\">Introduction:<br>Adding a power-on\/off button to your Raspberry Pi 4B can provide a convenient way to manage the device&#8217;s power state. In this guide, we&#8217;ll show you how to configure a power-on\/off button using the GPIO pins on the Raspberry Pi 4B.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Step 1: Edit the \/boot\/config.txt File<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">To configure the power-on\/off button, you need to edit the <code>\/boot\/config.txt<\/code> file on your Raspberry Pi. Open the file using the following command:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo vi \/boot\/config.txt<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Step 2: Enable Shutdown Functionality<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">To enable the shutdown functionality of the power button (green LED turns off when shutting down), add the following line to the config file:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>dtoverlay=gpio-shutdown<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Step 3: Enable Power-Off Functionality<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">To enable the power-off functionality of the power button (both green and red LEDs turn off when powered off), add the following lines to the config file:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>dtoverlay=gpio-shutdown,gpio_pin=3\ndtoverlay=gpio-poweroff,gpio_pin=24,active_low=0<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Explanation of options used:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>dtoverlay=gpio-shutdown<\/code>: Enables the GPIO shutdown overlay to manage the shutdown functionality.<\/li>\n\n\n\n<li><code>gpio_pin=3<\/code>: Specifies the GPIO pin (BCM numbering) to use for the shutdown function (default is GPIO3).<\/li>\n\n\n\n<li><code>dtoverlay=gpio-poweroff<\/code>: Enables the GPIO power-off overlay to manage the power-off functionality.<\/li>\n\n\n\n<li><code>gpio_pin=24<\/code>: Specifies the GPIO pin (BCM numbering) to use for the power-off function (default is GPIO24).<\/li>\n\n\n\n<li><code>active_low=0<\/code>: Sets the active_low parameter to 0, which means the GPIO pin is active high (low signal triggers the action).<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">Step 4: Save and Reboot<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Save the changes to the <code>\/boot\/config.txt<\/code> file, and then reboot your Raspberry Pi for the changes to take effect:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo reboot<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Conclusion:<br>By following these steps and editing the <code>\/boot\/config.txt<\/code> file, you can easily configure a power-on\/off button for your Raspberry Pi 4B. The power button will provide you with convenient control over the device&#8217;s power state, allowing for a smooth and efficient experience in managing your Raspberry Pi.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">For more detailed information and the source of this guide, you can visit the provided link: <a href=\"https:\/\/www.adeleda.com\/reviving-borkin-power-onoff-button-for-the-raspberry-pi-4b-en.html\">Reviving Borkin Power On\/Off Button for the Raspberry Pi 4B<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Introduction:Adding a power-on\/off button to your Raspberry Pi 4B can provide a convenient way to manage the device&#8217;s power state. In this guide, we&#8217;ll show you how to configure a power-on\/off button using the&#46;&#46;&#46;<\/p>\n","protected":false},"author":1,"featured_media":186,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"inline_featured_image":false,"footnotes":""},"categories":[7],"tags":[35],"class_list":["post-106","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-raspberry","tag-ok"],"_links":{"self":[{"href":"https:\/\/it4home.dk\/index.php\/wp-json\/wp\/v2\/posts\/106","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/it4home.dk\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/it4home.dk\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/it4home.dk\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/it4home.dk\/index.php\/wp-json\/wp\/v2\/comments?post=106"}],"version-history":[{"count":2,"href":"https:\/\/it4home.dk\/index.php\/wp-json\/wp\/v2\/posts\/106\/revisions"}],"predecessor-version":[{"id":126,"href":"https:\/\/it4home.dk\/index.php\/wp-json\/wp\/v2\/posts\/106\/revisions\/126"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/it4home.dk\/index.php\/wp-json\/wp\/v2\/media\/186"}],"wp:attachment":[{"href":"https:\/\/it4home.dk\/index.php\/wp-json\/wp\/v2\/media?parent=106"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/it4home.dk\/index.php\/wp-json\/wp\/v2\/categories?post=106"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/it4home.dk\/index.php\/wp-json\/wp\/v2\/tags?post=106"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}