{"id":2824,"date":"2022-07-19T12:43:06","date_gmt":"2022-07-19T12:43:06","guid":{"rendered":"https:\/\/picockpit.com\/raspberry-pi\/?p=2824"},"modified":"2023-08-22T14:46:06","modified_gmt":"2023-08-22T14:46:06","slug":"diy-wireless-servo-switch-controller-with-raspberry-pi-pico-w","status":"publish","type":"post","link":"https:\/\/picockpit.com\/raspberry-pi\/diy-wireless-servo-switch-controller-with-raspberry-pi-pico-w\/","title":{"rendered":"DIY wireless servo switch controller with Raspberry Pi Pico W"},"content":{"rendered":"\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"576\" src=\"https:\/\/picockpit.com\/raspberry-pi\/wp-content\/uploads\/2022\/07\/featured-image-4-1024x576.jpg\" alt=\"Pico W Servo Switch Controller Title image\" class=\"wp-image-2854\" srcset=\"https:\/\/picockpit.com\/raspberry-pi\/wp-content\/uploads\/2022\/07\/featured-image-4-1024x576.jpg 1024w, https:\/\/picockpit.com\/raspberry-pi\/wp-content\/uploads\/2022\/07\/featured-image-4-300x169.jpg 300w, https:\/\/picockpit.com\/raspberry-pi\/wp-content\/uploads\/2022\/07\/featured-image-4-768x432.jpg 768w, https:\/\/picockpit.com\/raspberry-pi\/wp-content\/uploads\/2022\/07\/featured-image-4-1536x864.jpg 1536w, https:\/\/picockpit.com\/raspberry-pi\/wp-content\/uploads\/2022\/07\/featured-image-4-18x10.jpg 18w, https:\/\/picockpit.com\/raspberry-pi\/wp-content\/uploads\/2022\/07\/featured-image-4.jpg 1778w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>One of the biggest problems I have is getting up from bed to turn off the bedroom&#8217;s light. It&#8217;s very difficult to do so when you&#8217;re cozy in bed. And so here, I want to tell you how to solve that problem with a Pico W Servo switch controller.<\/p>\n\n\n\n<p>You see, a few years ago, I built a wireless solution with an Arduino and an IR remote. It worked out pretty well because it was reliable and it solved my problem. It wasn&#8217;t without its downsides though.<\/p>\n\n\n\n<p>For one, the Arduino Uno was massive as compared to the Raspberry Pi Pico W.<\/p>\n\n\n\n<p>Secondly, it depended on an IR signal, which meant I needed to know where my IR remote was when I wanted to turn the light off.<\/p>\n\n\n\n<p>And this is where the Raspberry Pi Pico W has its advantage. You can control the servo directly from your phone.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/picockpit.com\/raspberry-pi\/wp-content\/uploads\/2022\/07\/diy-wireless-switch-control-project.jpg\" alt=\"Pico W Servo Switch Controller\" class=\"wp-image-2853\" style=\"width:519px;height:386px\" width=\"519\" height=\"386\" srcset=\"https:\/\/picockpit.com\/raspberry-pi\/wp-content\/uploads\/2022\/07\/diy-wireless-switch-control-project.jpg 1000w, https:\/\/picockpit.com\/raspberry-pi\/wp-content\/uploads\/2022\/07\/diy-wireless-switch-control-project-300x223.jpg 300w, https:\/\/picockpit.com\/raspberry-pi\/wp-content\/uploads\/2022\/07\/diy-wireless-switch-control-project-768x571.jpg 768w, https:\/\/picockpit.com\/raspberry-pi\/wp-content\/uploads\/2022\/07\/diy-wireless-switch-control-project-16x12.jpg 16w\" sizes=\"auto, (max-width: 519px) 100vw, 519px\" \/><figcaption class=\"wp-element-caption\">Overview of the DIY wireless switch control project<\/figcaption><\/figure>\n<\/div>\n\n\n\n\n<h2 class=\"wp-block-heading\">Why bother with this DIY project?<\/h2>\n\n\n\n<p>It&#8217;s ugly. It&#8217;s tedious.<\/p>\n\n\n\n<p>But it also involves the joy and fun of crafting your own solution to your problems.<\/p>\n\n\n\n<p>Modern problems require modern solutions, and <a href=\"https:\/\/picockpit.com\/raspberry-pi\/raspberry-pi-project-ideas-modern-solutions-require-more-modern-solutions\/\">you can see how people solve their problems with the Raspberry Pi here<\/a>.<\/p>\n\n\n\n<p>Furthermore, you might need to do this because you aren&#8217;t allowed to modify the electrical setup in your home. <\/p>\n\n\n\n<p>Or you don&#8217;t want to go through the expense of hiring a professional to do it.<\/p>\n\n\n\n<p>Another reason is because this project is so extensible and portable. You don&#8217;t have to use it on a light switch, you can use it on a keyboard, to stop screensavers, for example.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Video<\/h2>\n\n\n\n<div class=\"wp-block-columns is-layout-flex wp-container-core-columns-is-layout-9d6595d7 wp-block-columns-is-layout-flex\">\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\"><\/div>\n\n\n\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\">\n<iframe loading=\"lazy\" width=\"225\" height=\"400\" src=\"https:\/\/www.youtube.com\/embed\/g2T8vYcRi1Y\" title=\"DIY wireless servo switch controller with Raspberry Pi Pico W #shorts\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture\" allowfullscreen=\"\"><\/iframe>\n<\/div>\n\n\n\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\"><\/div>\n<\/div>\n\n\n\n<h2 class=\"wp-block-heading\">Two-way switch control possible, but one way easiest<\/h2>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/picockpit.com\/raspberry-pi\/wp-content\/uploads\/2022\/07\/20220718_184642-1000px-edited.jpg\" alt=\"Pico W Servo Switch Controller\" class=\"wp-image-2847\" style=\"width:545px;height:409px\" width=\"545\" height=\"409\" srcset=\"https:\/\/picockpit.com\/raspberry-pi\/wp-content\/uploads\/2022\/07\/20220718_184642-1000px-edited.jpg 769w, https:\/\/picockpit.com\/raspberry-pi\/wp-content\/uploads\/2022\/07\/20220718_184642-1000px-edited-300x225.jpg 300w, https:\/\/picockpit.com\/raspberry-pi\/wp-content\/uploads\/2022\/07\/20220718_184642-1000px-edited-16x12.jpg 16w\" sizes=\"auto, (max-width: 545px) 100vw, 545px\" \/><figcaption class=\"wp-element-caption\">Servo primed to turn off light switch<\/figcaption><\/figure>\n<\/div>\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/picockpit.com\/raspberry-pi\/wp-content\/uploads\/2022\/07\/20220718_184650-1000px-edited.jpg\" alt=\"Pico W Servo Switch Controller\" class=\"wp-image-2848\" style=\"width:539px;height:404px\" width=\"539\" height=\"404\" srcset=\"https:\/\/picockpit.com\/raspberry-pi\/wp-content\/uploads\/2022\/07\/20220718_184650-1000px-edited.jpg 667w, https:\/\/picockpit.com\/raspberry-pi\/wp-content\/uploads\/2022\/07\/20220718_184650-1000px-edited-300x225.jpg 300w, https:\/\/picockpit.com\/raspberry-pi\/wp-content\/uploads\/2022\/07\/20220718_184650-1000px-edited-16x12.jpg 16w\" sizes=\"auto, (max-width: 539px) 100vw, 539px\" \/><figcaption class=\"wp-element-caption\">Servo at full rotation, turning off the switch<\/figcaption><\/figure>\n<\/div>\n\n\n<p>If there&#8217;s one thing you can definitely do with all switches in the world, whether European or North American, you can always using a servo to switch it OFF or ON.<\/p>\n\n\n\n<p>But if you want to control the switch both ways, it becomes a bigger engineering challenge because the servo might get in the way.<\/p>\n\n\n\n<p>For example, if you need to be able to manually turn the switch on or off, you might find the servo arms to be in the way. You can&#8217;t force it out of the way without destroying the motor as the servo is programmed to keep itself in place with all its might.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Broadcast network or connect to a network?<\/h2>\n\n\n\n<p>The Raspberry Pi Pico W can connect to your home network or it can broadcast its own network.<\/p>\n\n\n\n<p>I have tried both and found some pros and cons of both methods.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">As a station (i.e. connects to a network)<\/h3>\n\n\n\n<p>In the initial design, I made my Pico W connect to my home network and it served a HTML file with a button on its IP address 192.168.0.70.<\/p>\n\n\n\n<p>The benefit of this was that I was easily able to boot up my browser and press the button that turned off the light.<\/p>\n\n\n\n<p>However, the downside is that anyone on the network was also able to do that, unless you implemented some form of authentication.<\/p>\n\n\n\n<p>Another downside is that, if your home network lost power, the Raspberry Pi Pico W won&#8217;t re-connect to the network, unless you have implemented code that restarts your Pico W or reconnects it to the network.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">As an access point<\/h3>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"358\" height=\"172\" src=\"https:\/\/picockpit.com\/raspberry-pi\/wp-content\/uploads\/2022\/07\/image-57.png\" alt=\"\" class=\"wp-image-2851\" srcset=\"https:\/\/picockpit.com\/raspberry-pi\/wp-content\/uploads\/2022\/07\/image-57.png 358w, https:\/\/picockpit.com\/raspberry-pi\/wp-content\/uploads\/2022\/07\/image-57-300x144.png 300w, https:\/\/picockpit.com\/raspberry-pi\/wp-content\/uploads\/2022\/07\/image-57-18x9.png 18w\" sizes=\"auto, (max-width: 358px) 100vw, 358px\" \/><figcaption class=\"wp-element-caption\">Upon connecting to this, the servo will rotate, turning off the switch<\/figcaption><\/figure>\n<\/div>\n\n\n<p>Currently, I am using my Pico W as an access point, though I am not saying that it&#8217;s the best way forward.<\/p>\n\n\n\n<p>It broadcasts a network which I have to connect to separately in order for me to control the servo. This is an inconvenient downside.<\/p>\n\n\n\n<p>The upside to this is, unlike the station method, you have a password on the network so only you can connect to it.<\/p>\n\n\n\n<p>Initially, I had an access point which served a webpage with a button to trigger the servo. I found this to be too cumbersome because you will need to 1) connect to the network, 2) go to the Pico W&#8217;s IP address and 3) press the button<\/p>\n\n\n\n<p>I found the best solution is to trigger the servo once the Pico W detects a client connecting to the access point. This way, all you have to do is to connect any device to the Pico W and your lights (or switch) will be off.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Connecting the Pico W to a servo<\/h2>\n\n\n\n<p>This is a simple project and you should be able to find parts in a beginner&#8217;s kit. If not, here&#8217;s a parts list.<\/p>\n\n\n\n<div class=\"wp-block-columns is-layout-flex wp-container-core-columns-is-layout-9d6595d7 wp-block-columns-is-layout-flex\">\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\"><div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/picockpit.com\/raspberry-pi\/wp-content\/uploads\/2021\/03\/Raspberry-Pi-Pico-Video-Output-DVI-Sock-withPicoComfort-1024x683.jpg\" alt=\"Raspberry-Pi-Pico-Video-Output-DVI-Sock\" class=\"wp-image-768\" style=\"width:287px;height:191px\" width=\"287\" height=\"191\" srcset=\"https:\/\/picockpit.com\/raspberry-pi\/wp-content\/uploads\/2021\/03\/Raspberry-Pi-Pico-Video-Output-DVI-Sock-withPicoComfort-1024x683.jpg 1024w, https:\/\/picockpit.com\/raspberry-pi\/wp-content\/uploads\/2021\/03\/Raspberry-Pi-Pico-Video-Output-DVI-Sock-withPicoComfort-300x200.jpg 300w, https:\/\/picockpit.com\/raspberry-pi\/wp-content\/uploads\/2021\/03\/Raspberry-Pi-Pico-Video-Output-DVI-Sock-withPicoComfort-768x512.jpg 768w, https:\/\/picockpit.com\/raspberry-pi\/wp-content\/uploads\/2021\/03\/Raspberry-Pi-Pico-Video-Output-DVI-Sock-withPicoComfort-1536x1024.jpg 1536w, https:\/\/picockpit.com\/raspberry-pi\/wp-content\/uploads\/2021\/03\/Raspberry-Pi-Pico-Video-Output-DVI-Sock-withPicoComfort.jpg 1600w\" sizes=\"auto, (max-width: 287px) 100vw, 287px\" \/><\/figure>\n<\/div><\/div>\n\n\n\n<div class=\"wp-block-column is-vertically-aligned-center is-layout-flow wp-block-column-is-layout-flow\">\n<p class=\"has-text-align-center\"><strong><a href=\"https:\/\/buyzero.de\/products\/raspberry-pi-pico-w-h-konfigurator-pico-pico-w-pico-h-pico-wh\">Pico W (plus headers)<\/a><\/strong><\/p>\n<\/div>\n<\/div>\n\n\n\n<div class=\"wp-block-columns is-layout-flex wp-container-core-columns-is-layout-9d6595d7 wp-block-columns-is-layout-flex\">\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\"><div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full is-resized\"><a href=\"https:\/\/buyzero.de\/products\/zerocam-camera-for-raspberry-pi-zero?_pos=1&amp;_sid=9d7b61947&amp;_ss=r\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/picockpit.com\/raspberry-pi\/wp-content\/uploads\/2022\/07\/image-52.png\" alt=\"\" class=\"wp-image-2834\" style=\"width:283px;height:212px\" width=\"283\" height=\"212\" srcset=\"https:\/\/picockpit.com\/raspberry-pi\/wp-content\/uploads\/2022\/07\/image-52.png 600w, https:\/\/picockpit.com\/raspberry-pi\/wp-content\/uploads\/2022\/07\/image-52-300x225.png 300w, https:\/\/picockpit.com\/raspberry-pi\/wp-content\/uploads\/2022\/07\/image-52-16x12.png 16w\" sizes=\"auto, (max-width: 283px) 100vw, 283px\" \/><\/a><\/figure>\n<\/div><\/div>\n\n\n\n<div class=\"wp-block-column is-vertically-aligned-center is-layout-flow wp-block-column-is-layout-flow\">\n<p class=\"has-text-align-center\"><strong><a href=\"https:\/\/buyzero.de\/products\/zerocam-camera-for-raspberry-pi-zero?_pos=1&amp;_sid=9d7b61947&amp;_ss=r\">Microservo (such as the SG90)<\/a><\/strong><\/p>\n<\/div>\n<\/div>\n\n\n\n<div class=\"wp-block-columns is-layout-flex wp-container-core-columns-is-layout-9d6595d7 wp-block-columns-is-layout-flex\">\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\"><div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full is-resized\"><a href=\"https:\/\/buyzero.de\/products\/copy-of-premium-female-female-jumper-wires-40-x-6\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/picockpit.com\/raspberry-pi\/wp-content\/uploads\/2022\/07\/image-54.png\" alt=\"\" class=\"wp-image-2836\" style=\"width:288px;height:216px\" width=\"288\" height=\"216\" srcset=\"https:\/\/picockpit.com\/raspberry-pi\/wp-content\/uploads\/2022\/07\/image-54.png 600w, https:\/\/picockpit.com\/raspberry-pi\/wp-content\/uploads\/2022\/07\/image-54-300x225.png 300w, https:\/\/picockpit.com\/raspberry-pi\/wp-content\/uploads\/2022\/07\/image-54-16x12.png 16w\" sizes=\"auto, (max-width: 288px) 100vw, 288px\" \/><\/a><\/figure>\n<\/div><\/div>\n\n\n\n<div class=\"wp-block-column is-vertically-aligned-center is-layout-flow wp-block-column-is-layout-flow\">\n<p class=\"has-text-align-center\"><strong><a href=\"https:\/\/buyzero.de\/products\/zerocam-camera-for-raspberry-pi-zero?_pos=1&amp;_sid=9d7b61947&amp;_ss=r\">Jumper wires<\/a><\/strong><\/p>\n<\/div>\n<\/div>\n\n\n\n<p>I also used an optional breadboard to connect the servo to the Pico W with male-to-male jumper wires, but you can connect the servo directly to the Pico W&#8217;s headers with male-to-female jumper wires.<\/p>\n\n\n\n<p>You will also need double sided tape to stick your servo onto the light switch housing.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Wiring it up<\/h2>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/picockpit.com\/raspberry-pi\/wp-content\/uploads\/2022\/07\/image-55.png\" alt=\"Pico W Servo Switch Controller\" class=\"wp-image-2838\" style=\"width:665px;height:406px\" width=\"665\" height=\"406\" srcset=\"https:\/\/picockpit.com\/raspberry-pi\/wp-content\/uploads\/2022\/07\/image-55.png 737w, https:\/\/picockpit.com\/raspberry-pi\/wp-content\/uploads\/2022\/07\/image-55-300x183.png 300w, https:\/\/picockpit.com\/raspberry-pi\/wp-content\/uploads\/2022\/07\/image-55-18x12.png 18w\" sizes=\"auto, (max-width: 665px) 100vw, 665px\" \/><figcaption class=\"wp-element-caption\">Connecting a Pico W to a servo. (diagram made with <a href=\"http:\/\/wokwi.com\">Wokwi<\/a>)<\/figcaption><\/figure>\n<\/div>\n\n\n<p>Generally, all servo has a red, black\/brown and third wire.<\/p>\n\n\n\n<p>Connect a red jumper wire to the red wire coming from the servo. This is where you&#8217;ll send 5V, via VBUS.<\/p>\n\n\n\n<p>Connect a black wire to the black\/brown wire. You&#8217;ll connect this to GND on the Pico W.<\/p>\n\n\n\n<p>Connect another wire to the third wire. Mine&#8217;s orange in colour, so I used a orange jumper wire. This is the signal wire which I connected to GPIO16.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">The code<\/h2>\n\n\n\n<p>This code will allow you to trigger the servo upon a client connecting to the Pico W&#8217;s SoftAP access point.<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.25rem\"><span style=\"display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#2e3440ff\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"54\" height=\"14\" viewBox=\"0 0 54 14\"><g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\"><circle cx=\"6\" cy=\"6\" r=\"6\" fill=\"#FF5F56\" stroke=\"#E0443E\" stroke-width=\".5\"><\/circle><circle cx=\"26\" cy=\"6\" r=\"6\" fill=\"#FFBD2E\" stroke=\"#DEA123\" stroke-width=\".5\"><\/circle><circle cx=\"46\" cy=\"6\" r=\"6\" fill=\"#27C93F\" stroke=\"#1AAB29\" stroke-width=\".5\"><\/circle><\/g><\/svg><\/span><span role=\"button\" tabindex=\"0\" data-code=\"import network\nimport machine\nfrom machine import PWM\nfrom time import sleep\n\n#Pin param = servo GPIO pin number\npwm = PWM(machine.Pin(16))\n\nssid = 'Lights-Out'\npassword = 'sleeptime'\n\nap = network.WLAN(network.AP_IF)\nap.config(essid=ssid, password=password)\nap.active(True)\n\nwhile ap.active() == False:\n  pass\n\nprint('Connection successful')\nprint(ap.ifconfig())\n\ndef rotateServo ():\n    pwm.freq(50)\n\n    pwm.duty_ns(2000000)\n\n    sleep(0.5)\n\n    pwm.duty_ns(1500000)\n\n#ap.status is a blank array until someone connects, then it will have one entry\n#when ap.status = true, then it will trigger rotateServo()\n# then it will shut itself off to kick the user off the network,\n# allowing the device to reconnect to its usual network\n\nwhile True:\n    try:\n        if ap.status('stations'):\n            print('client connected')\n            rotateServo()\n            sleep(5)\n            ap.active(False)\n            sleep(2)\n            ap.active(True)\n        \n    except OSError as e:\n        print('Connection closed')\n\" style=\"color:#d8dee9ff;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki nord\" style=\"background-color: #2e3440ff\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #81A1C1\">import<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #8FBCBB\">network<\/span><\/span>\n<span class=\"line\"><span style=\"color: #8FBCBB\">import<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #8FBCBB\">machine<\/span><\/span>\n<span class=\"line\"><span style=\"color: #81A1C1\">from<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #8FBCBB\">machine<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #8FBCBB\">import<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #8FBCBB\">PWM<\/span><\/span>\n<span class=\"line\"><span style=\"color: #81A1C1\">from<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #8FBCBB\">time<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #8FBCBB\">import<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #8FBCBB\">sleep<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">#<\/span><span style=\"color: #8FBCBB\">Pin<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #8FBCBB\">param<\/span><span style=\"color: #D8DEE9FF\"> = <\/span><span style=\"color: #8FBCBB\">servo<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #8FBCBB\">GPIO<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #8FBCBB\">pin<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #8FBCBB\">number<\/span><\/span>\n<span class=\"line\"><span style=\"color: #8FBCBB\">pwm<\/span><span style=\"color: #D8DEE9FF\"> = <\/span><span style=\"color: #8FBCBB\">PWM<\/span><span style=\"color: #D8DEE9FF\">(<\/span><span style=\"color: #8FBCBB\">machine<\/span><span style=\"color: #D8DEE9FF\">.<\/span><span style=\"color: #8FBCBB\">Pin<\/span><span style=\"color: #D8DEE9FF\">(16))<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #8FBCBB\">ssid<\/span><span style=\"color: #D8DEE9FF\"> = <\/span><span style=\"color: #ECEFF4\">&#39;<\/span><span style=\"color: #A3BE8C\">Lights-Out<\/span><span style=\"color: #ECEFF4\">&#39;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #8FBCBB\">password<\/span><span style=\"color: #D8DEE9FF\"> = <\/span><span style=\"color: #ECEFF4\">&#39;<\/span><span style=\"color: #A3BE8C\">sleeptime<\/span><span style=\"color: #ECEFF4\">&#39;<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #8FBCBB\">ap<\/span><span style=\"color: #D8DEE9FF\"> = <\/span><span style=\"color: #8FBCBB\">network<\/span><span style=\"color: #D8DEE9FF\">.<\/span><span style=\"color: #8FBCBB\">WLAN<\/span><span style=\"color: #D8DEE9FF\">(<\/span><span style=\"color: #8FBCBB\">network<\/span><span style=\"color: #D8DEE9FF\">.<\/span><span style=\"color: #8FBCBB\">AP_IF<\/span><span style=\"color: #D8DEE9FF\">)<\/span><\/span>\n<span class=\"line\"><span style=\"color: #8FBCBB\">ap<\/span><span style=\"color: #D8DEE9FF\">.<\/span><span style=\"color: #8FBCBB\">config<\/span><span style=\"color: #D8DEE9FF\">(<\/span><span style=\"color: #8FBCBB\">essid<\/span><span style=\"color: #D8DEE9FF\">=<\/span><span style=\"color: #8FBCBB\">ssid<\/span><span style=\"color: #ECEFF4\">,<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #8FBCBB\">password<\/span><span style=\"color: #D8DEE9FF\">=<\/span><span style=\"color: #8FBCBB\">password<\/span><span style=\"color: #D8DEE9FF\">)<\/span><\/span>\n<span class=\"line\"><span style=\"color: #8FBCBB\">ap<\/span><span style=\"color: #D8DEE9FF\">.<\/span><span style=\"color: #8FBCBB\">active<\/span><span style=\"color: #D8DEE9FF\">(<\/span><span style=\"color: #8FBCBB\">True<\/span><span style=\"color: #D8DEE9FF\">)<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #8FBCBB\">while<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #8FBCBB\">ap<\/span><span style=\"color: #D8DEE9FF\">.<\/span><span style=\"color: #8FBCBB\">active<\/span><span style=\"color: #D8DEE9FF\">() == <\/span><span style=\"color: #8FBCBB\">False<\/span><span style=\"color: #D8DEE9FF\">:<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">  <\/span><span style=\"color: #8FBCBB\">pass<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #8FBCBB\">print<\/span><span style=\"color: #D8DEE9FF\">(<\/span><span style=\"color: #ECEFF4\">&#39;<\/span><span style=\"color: #A3BE8C\">Connection successful<\/span><span style=\"color: #ECEFF4\">&#39;<\/span><span style=\"color: #D8DEE9FF\">)<\/span><\/span>\n<span class=\"line\"><span style=\"color: #8FBCBB\">print<\/span><span style=\"color: #D8DEE9FF\">(<\/span><span style=\"color: #8FBCBB\">ap<\/span><span style=\"color: #D8DEE9FF\">.<\/span><span style=\"color: #8FBCBB\">ifconfig<\/span><span style=\"color: #D8DEE9FF\">())<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #8FBCBB\">def<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #8FBCBB\">rotateServo<\/span><span style=\"color: #D8DEE9FF\"> ():<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">    <\/span><span style=\"color: #8FBCBB\">pwm<\/span><span style=\"color: #D8DEE9FF\">.<\/span><span style=\"color: #8FBCBB\">freq<\/span><span style=\"color: #D8DEE9FF\">(50)<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">    <\/span><span style=\"color: #8FBCBB\">pwm<\/span><span style=\"color: #D8DEE9FF\">.<\/span><span style=\"color: #8FBCBB\">duty_ns<\/span><span style=\"color: #D8DEE9FF\">(2000000)<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">    <\/span><span style=\"color: #8FBCBB\">sleep<\/span><span style=\"color: #D8DEE9FF\">(0.5)<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">    <\/span><span style=\"color: #8FBCBB\">pwm<\/span><span style=\"color: #D8DEE9FF\">.<\/span><span style=\"color: #8FBCBB\">duty_ns<\/span><span style=\"color: #D8DEE9FF\">(1500000)<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">#<\/span><span style=\"color: #8FBCBB\">ap<\/span><span style=\"color: #D8DEE9FF\">.<\/span><span style=\"color: #8FBCBB\">status<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #8FBCBB\">is<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #8FBCBB\">a<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #8FBCBB\">blank<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #8FBCBB\">array<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #8FBCBB\">until<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #8FBCBB\">someone<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #8FBCBB\">connects<\/span><span style=\"color: #ECEFF4\">,<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #8FBCBB\">then<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #8FBCBB\">it<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #8FBCBB\">will<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #8FBCBB\">have<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #8FBCBB\">one<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #8FBCBB\">entry<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">#<\/span><span style=\"color: #8FBCBB\">when<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #8FBCBB\">ap<\/span><span style=\"color: #D8DEE9FF\">.<\/span><span style=\"color: #8FBCBB\">status<\/span><span style=\"color: #D8DEE9FF\"> = <\/span><span style=\"color: #8FBCBB\">true<\/span><span style=\"color: #ECEFF4\">,<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #8FBCBB\">then<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #8FBCBB\">it<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #8FBCBB\">will<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #8FBCBB\">trigger<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #8FBCBB\">rotateServo<\/span><span style=\"color: #D8DEE9FF\">()<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\"># <\/span><span style=\"color: #8FBCBB\">then<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #8FBCBB\">it<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #8FBCBB\">will<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #8FBCBB\">shut<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #8FBCBB\">itself<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #8FBCBB\">off<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #8FBCBB\">to<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #8FBCBB\">kick<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #8FBCBB\">the<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #8FBCBB\">user<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #8FBCBB\">off<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #8FBCBB\">the<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #8FBCBB\">network<\/span><span style=\"color: #ECEFF4\">,<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\"># <\/span><span style=\"color: #8FBCBB\">allowing<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #8FBCBB\">the<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #8FBCBB\">device<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #8FBCBB\">to<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #8FBCBB\">reconnect<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #8FBCBB\">to<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #8FBCBB\">its<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #8FBCBB\">usual<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #8FBCBB\">network<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #8FBCBB\">while<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #8FBCBB\">True<\/span><span style=\"color: #D8DEE9FF\">:<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">    <\/span><span style=\"color: #8FBCBB\">try<\/span><span style=\"color: #D8DEE9FF\">:<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">        <\/span><span style=\"color: #8FBCBB\">if<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #8FBCBB\">ap<\/span><span style=\"color: #D8DEE9FF\">.<\/span><span style=\"color: #8FBCBB\">status<\/span><span style=\"color: #D8DEE9FF\">(<\/span><span style=\"color: #ECEFF4\">&#39;<\/span><span style=\"color: #A3BE8C\">stations<\/span><span style=\"color: #ECEFF4\">&#39;<\/span><span style=\"color: #D8DEE9FF\">):<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">            <\/span><span style=\"color: #8FBCBB\">print<\/span><span style=\"color: #D8DEE9FF\">(<\/span><span style=\"color: #ECEFF4\">&#39;<\/span><span style=\"color: #A3BE8C\">client connected<\/span><span style=\"color: #ECEFF4\">&#39;<\/span><span style=\"color: #D8DEE9FF\">)<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">            <\/span><span style=\"color: #8FBCBB\">rotateServo<\/span><span style=\"color: #D8DEE9FF\">()<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">            <\/span><span style=\"color: #8FBCBB\">sleep<\/span><span style=\"color: #D8DEE9FF\">(5)<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">            <\/span><span style=\"color: #8FBCBB\">ap<\/span><span style=\"color: #D8DEE9FF\">.<\/span><span style=\"color: #8FBCBB\">active<\/span><span style=\"color: #D8DEE9FF\">(<\/span><span style=\"color: #8FBCBB\">False<\/span><span style=\"color: #D8DEE9FF\">)<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">            <\/span><span style=\"color: #8FBCBB\">sleep<\/span><span style=\"color: #D8DEE9FF\">(2)<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">            <\/span><span style=\"color: #8FBCBB\">ap<\/span><span style=\"color: #D8DEE9FF\">.<\/span><span style=\"color: #8FBCBB\">active<\/span><span style=\"color: #D8DEE9FF\">(<\/span><span style=\"color: #8FBCBB\">True<\/span><span style=\"color: #D8DEE9FF\">)<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">        <\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">    <\/span><span style=\"color: #8FBCBB\">except<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">OSError<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #81A1C1\">as<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #8FBCBB\">e<\/span><span style=\"color: #D8DEE9FF\">:<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">        <\/span><span style=\"color: #8FBCBB\">print<\/span><span style=\"color: #D8DEE9FF\">(<\/span><span style=\"color: #ECEFF4\">&#39;<\/span><span style=\"color: #A3BE8C\">Connection closed<\/span><span style=\"color: #ECEFF4\">&#39;<\/span><span style=\"color: #D8DEE9FF\">)<\/span><\/span>\n<span class=\"line\"><\/span><\/code><\/pre><\/div>\n\n\n\n<p>Certain important lines of code to explain:<\/p>\n\n\n\n<p>The code assumes you connected the signal wire to GPIO16. If not, change the &#8220;16&#8221; integer in this line to the GPIO pin you&#8217;re connected to.<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.25rem\"><span style=\"display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#2e3440ff\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"54\" height=\"14\" viewBox=\"0 0 54 14\"><g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\"><circle cx=\"6\" cy=\"6\" r=\"6\" fill=\"#FF5F56\" stroke=\"#E0443E\" stroke-width=\".5\"><\/circle><circle cx=\"26\" cy=\"6\" r=\"6\" fill=\"#FFBD2E\" stroke=\"#DEA123\" stroke-width=\".5\"><\/circle><circle cx=\"46\" cy=\"6\" r=\"6\" fill=\"#27C93F\" stroke=\"#1AAB29\" stroke-width=\".5\"><\/circle><\/g><\/svg><\/span><span role=\"button\" tabindex=\"0\" data-code=\"#Pin param = servo GPIO pin number\npwm = PWM(machine.Pin(<strong&gt;16<\/strong&gt;))\" style=\"color:#d8dee9ff;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki nord\" style=\"background-color: #2e3440ff\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #D8DEE9FF\">#<\/span><span style=\"color: #D8DEE9\">Pin<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">param<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #81A1C1\">=<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">servo<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">GPIO<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">pin<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">number<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9\">pwm<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #81A1C1\">=<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #88C0D0\">PWM<\/span><span style=\"color: #D8DEE9FF\">(<\/span><span style=\"color: #D8DEE9\">machine<\/span><span style=\"color: #ECEFF4\">.<\/span><span style=\"color: #88C0D0\">Pin<\/span><span style=\"color: #D8DEE9FF\">(<\/span><span style=\"color: #81A1C1\">&lt;strong&gt;<\/span><span style=\"color: #D8DEE9FF\">16<\/span><span style=\"color: #81A1C1\">&lt;\/strong&gt;<\/span><span style=\"color: #D8DEE9FF\">))<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p>This sets up the SoftAP, declares the SSID name and password,<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.25rem\"><span style=\"display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#2e3440ff\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"54\" height=\"14\" viewBox=\"0 0 54 14\"><g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\"><circle cx=\"6\" cy=\"6\" r=\"6\" fill=\"#FF5F56\" stroke=\"#E0443E\" stroke-width=\".5\"><\/circle><circle cx=\"26\" cy=\"6\" r=\"6\" fill=\"#FFBD2E\" stroke=\"#DEA123\" stroke-width=\".5\"><\/circle><circle cx=\"46\" cy=\"6\" r=\"6\" fill=\"#27C93F\" stroke=\"#1AAB29\" stroke-width=\".5\"><\/circle><\/g><\/svg><\/span><span role=\"button\" tabindex=\"0\" data-code=\"import network\n...\nssid = 'Lights-Out'\npassword = 'sleeptime'\n\nap = network.WLAN(network.AP_IF)\nap.config(essid=ssid, password=password)\nap.active(True)\" style=\"color:#d8dee9ff;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki nord\" style=\"background-color: #2e3440ff\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #81A1C1\">import<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #8FBCBB\">network<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">...<\/span><\/span>\n<span class=\"line\"><span style=\"color: #8FBCBB\">ssid<\/span><span style=\"color: #D8DEE9FF\"> = <\/span><span style=\"color: #ECEFF4\">&#39;<\/span><span style=\"color: #A3BE8C\">Lights-Out<\/span><span style=\"color: #ECEFF4\">&#39;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #8FBCBB\">password<\/span><span style=\"color: #D8DEE9FF\"> = <\/span><span style=\"color: #ECEFF4\">&#39;<\/span><span style=\"color: #A3BE8C\">sleeptime<\/span><span style=\"color: #ECEFF4\">&#39;<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #8FBCBB\">ap<\/span><span style=\"color: #D8DEE9FF\"> = <\/span><span style=\"color: #8FBCBB\">network<\/span><span style=\"color: #D8DEE9FF\">.<\/span><span style=\"color: #8FBCBB\">WLAN<\/span><span style=\"color: #D8DEE9FF\">(<\/span><span style=\"color: #8FBCBB\">network<\/span><span style=\"color: #D8DEE9FF\">.<\/span><span style=\"color: #8FBCBB\">AP_IF<\/span><span style=\"color: #D8DEE9FF\">)<\/span><\/span>\n<span class=\"line\"><span style=\"color: #8FBCBB\">ap<\/span><span style=\"color: #D8DEE9FF\">.<\/span><span style=\"color: #8FBCBB\">config<\/span><span style=\"color: #D8DEE9FF\">(<\/span><span style=\"color: #8FBCBB\">essid<\/span><span style=\"color: #D8DEE9FF\">=<\/span><span style=\"color: #8FBCBB\">ssid<\/span><span style=\"color: #ECEFF4\">,<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #8FBCBB\">password<\/span><span style=\"color: #D8DEE9FF\">=<\/span><span style=\"color: #8FBCBB\">password<\/span><span style=\"color: #D8DEE9FF\">)<\/span><\/span>\n<span class=\"line\"><span style=\"color: #8FBCBB\">ap<\/span><span style=\"color: #D8DEE9FF\">.<\/span><span style=\"color: #8FBCBB\">active<\/span><span style=\"color: #D8DEE9FF\">(<\/span><span style=\"color: #8FBCBB\">True<\/span><span style=\"color: #D8DEE9FF\">)<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<h3 class=\"wp-block-heading\">Servo control on the Pico W<\/h3>\n\n\n\n<p>This controls the servo. You will probably have to modify this.<\/p>\n\n\n\n<p>For my servo, I could use a value of 500000 (500K) to 2000000 (2 mil). This would give the full range of the servo.<\/p>\n\n\n\n<p>However, I only needed small rotation. Hence, I put the servo to its full rotation with <strong>pwm.duty_ns(2000000)<\/strong> and then let it return to <strong>pwm.duty_ns(1500000)<\/strong>.<\/p>\n\n\n\n<p>It&#8217;s probably best to test this while your servo is free-floating so you can see if it&#8217;s rotating in the right direction and then you can fine tune the degrees of rotation.<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.25rem\"><span style=\"display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#2e3440ff\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"54\" height=\"14\" viewBox=\"0 0 54 14\"><g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\"><circle cx=\"6\" cy=\"6\" r=\"6\" fill=\"#FF5F56\" stroke=\"#E0443E\" stroke-width=\".5\"><\/circle><circle cx=\"26\" cy=\"6\" r=\"6\" fill=\"#FFBD2E\" stroke=\"#DEA123\" stroke-width=\".5\"><\/circle><circle cx=\"46\" cy=\"6\" r=\"6\" fill=\"#27C93F\" stroke=\"#1AAB29\" stroke-width=\".5\"><\/circle><\/g><\/svg><\/span><span role=\"button\" tabindex=\"0\" data-code=\"def rotateServo ():\n    pwm.freq(50)\n\n    pwm.duty_ns(2000000)\n\n    sleep(0.5)\n\n    pwm.duty_ns(1500000)\" style=\"color:#d8dee9ff;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki nord\" style=\"background-color: #2e3440ff\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #D8DEE9\">def<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #88C0D0\">rotateServo<\/span><span style=\"color: #D8DEE9FF\"> ():<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">    <\/span><span style=\"color: #D8DEE9\">pwm<\/span><span style=\"color: #ECEFF4\">.<\/span><span style=\"color: #88C0D0\">freq<\/span><span style=\"color: #D8DEE9FF\">(<\/span><span style=\"color: #B48EAD\">50<\/span><span style=\"color: #D8DEE9FF\">)<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">    <\/span><span style=\"color: #D8DEE9\">pwm<\/span><span style=\"color: #ECEFF4\">.<\/span><span style=\"color: #88C0D0\">duty_ns<\/span><span style=\"color: #D8DEE9FF\">(<\/span><span style=\"color: #B48EAD\">2000000<\/span><span style=\"color: #D8DEE9FF\">)<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">    <\/span><span style=\"color: #88C0D0\">sleep<\/span><span style=\"color: #D8DEE9FF\">(<\/span><span style=\"color: #B48EAD\">0.5<\/span><span style=\"color: #D8DEE9FF\">)<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">    <\/span><span style=\"color: #D8DEE9\">pwm<\/span><span style=\"color: #ECEFF4\">.<\/span><span style=\"color: #88C0D0\">duty_ns<\/span><span style=\"color: #D8DEE9FF\">(<\/span><span style=\"color: #B48EAD\">1500000<\/span><span style=\"color: #D8DEE9FF\">)<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<h2 class=\"wp-block-heading\">Broadcasting an AP, triggering rotateServo on connection<\/h2>\n\n\n\n<p>This line of code runs repeatedly.<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.25rem\"><span style=\"display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#2e3440ff\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"54\" height=\"14\" viewBox=\"0 0 54 14\"><g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\"><circle cx=\"6\" cy=\"6\" r=\"6\" fill=\"#FF5F56\" stroke=\"#E0443E\" stroke-width=\".5\"><\/circle><circle cx=\"26\" cy=\"6\" r=\"6\" fill=\"#FFBD2E\" stroke=\"#DEA123\" stroke-width=\".5\"><\/circle><circle cx=\"46\" cy=\"6\" r=\"6\" fill=\"#27C93F\" stroke=\"#1AAB29\" stroke-width=\".5\"><\/circle><\/g><\/svg><\/span><span role=\"button\" tabindex=\"0\" data-code=\"while True:\n    try:\n        if ap.status('stations'):\n            print('client connected')\n            rotateServo()\n            sleep(10)\n            ap.active(False)\n            sleep(2)\n            ap.active(True)\" style=\"color:#d8dee9ff;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki nord\" style=\"background-color: #2e3440ff\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #81A1C1\">while<\/span><span style=\"color: #D8DEE9FF\"> True<\/span><span style=\"color: #ECEFF4\">:<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">    <\/span><span style=\"color: #81A1C1\">try<\/span><span style=\"color: #D8DEE9FF\">:<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">        <\/span><span style=\"color: #81A1C1\">if<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">ap<\/span><span style=\"color: #ECEFF4\">.<\/span><span style=\"color: #88C0D0\">status<\/span><span style=\"color: #D8DEE9FF\">(<\/span><span style=\"color: #ECEFF4\">&#39;<\/span><span style=\"color: #A3BE8C\">stations<\/span><span style=\"color: #ECEFF4\">&#39;<\/span><span style=\"color: #D8DEE9FF\">):<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">            <\/span><span style=\"color: #88C0D0\">print<\/span><span style=\"color: #D8DEE9FF\">(<\/span><span style=\"color: #ECEFF4\">&#39;<\/span><span style=\"color: #A3BE8C\">client connected<\/span><span style=\"color: #ECEFF4\">&#39;<\/span><span style=\"color: #D8DEE9FF\">)<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">            <\/span><span style=\"color: #88C0D0\">rotateServo<\/span><span style=\"color: #D8DEE9FF\">()<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">            <\/span><span style=\"color: #88C0D0\">sleep<\/span><span style=\"color: #D8DEE9FF\">(<\/span><span style=\"color: #B48EAD\">10<\/span><span style=\"color: #D8DEE9FF\">)<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">            <\/span><span style=\"color: #D8DEE9\">ap<\/span><span style=\"color: #ECEFF4\">.<\/span><span style=\"color: #88C0D0\">active<\/span><span style=\"color: #D8DEE9FF\">(<\/span><span style=\"color: #D8DEE9\">False<\/span><span style=\"color: #D8DEE9FF\">)<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">            <\/span><span style=\"color: #88C0D0\">sleep<\/span><span style=\"color: #D8DEE9FF\">(<\/span><span style=\"color: #B48EAD\">2<\/span><span style=\"color: #D8DEE9FF\">)<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">            <\/span><span style=\"color: #D8DEE9\">ap<\/span><span style=\"color: #ECEFF4\">.<\/span><span style=\"color: #88C0D0\">active<\/span><span style=\"color: #D8DEE9FF\">(<\/span><span style=\"color: #D8DEE9\">True<\/span><span style=\"color: #D8DEE9FF\">)<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p>If <strong>ap.status(&#8216;stations&#8217;)<\/strong> detects a connection onto the wireless network, it will return an array with one item.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/picockpit.com\/raspberry-pi\/wp-content\/uploads\/2022\/07\/image-56.png\" alt=\"\" class=\"wp-image-2840\" style=\"width:488px;height:261px\" width=\"488\" height=\"261\" srcset=\"https:\/\/picockpit.com\/raspberry-pi\/wp-content\/uploads\/2022\/07\/image-56.png 634w, https:\/\/picockpit.com\/raspberry-pi\/wp-content\/uploads\/2022\/07\/image-56-300x160.png 300w, https:\/\/picockpit.com\/raspberry-pi\/wp-content\/uploads\/2022\/07\/image-56-18x10.png 18w\" sizes=\"auto, (max-width: 488px) 100vw, 488px\" \/><figcaption class=\"wp-element-caption\"> <strong>ap.status(&#8216;stations&#8217;)<\/strong> returns an empty array if no one is connected to the AP<\/figcaption><\/figure>\n<\/div>\n\n\n<p>Hence, if the code isn&#8217;t an empty array, it will launch <strong>rotateServo<\/strong> and shut off the AP before turning it on again.<\/p>\n\n\n\n<p>The idea of turning the AP on and off is to kick the connected client off the network. This allows it to connect to its habitual network with an internet connection. <\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/picockpit.com\/raspberry-pi\/wp-content\/uploads\/2022\/07\/auto-reconnect-off.jpg\" alt=\"android auto reconnect off\" class=\"wp-image-2850\" style=\"width:429px;height:260px\" width=\"429\" height=\"260\" srcset=\"https:\/\/picockpit.com\/raspberry-pi\/wp-content\/uploads\/2022\/07\/auto-reconnect-off.jpg 720w, https:\/\/picockpit.com\/raspberry-pi\/wp-content\/uploads\/2022\/07\/auto-reconnect-off-300x182.jpg 300w, https:\/\/picockpit.com\/raspberry-pi\/wp-content\/uploads\/2022\/07\/auto-reconnect-off-18x12.jpg 18w\" sizes=\"auto, (max-width: 429px) 100vw, 429px\" \/><figcaption class=\"wp-element-caption\">Auto reconnect turned off in Android<\/figcaption><\/figure>\n<\/div>\n\n\n<p>Just make sure to turn off auto-reconnect in your phone or computer.<\/p>\n\n\n\n<p>Why do we need the sleep(x) in between ap.active() calls? That&#8217;s because I learned that if I turn the AP off and on too quickly, my phone will not drop the connection.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Learn more about the Raspberry Pi Pico W<\/h2>\n\n\n\n<p>We have written an article specifically about the Raspberry Pi Pico W that will help you get the most out of your Pico W. <a href=\"https:\/\/picockpit.com\/raspberry-pi\/everything-about-the-raspberry-pi-pico-w\/\">Click here to learn about things you never knew.<\/a><\/p>\n\n\n\n<p><\/p>\n<div class=\"shariff shariff-align-center shariff-widget-align-left shariff-buttonstretch\"><ul class=\"shariff-buttons theme-white orientation-horizontal buttonsize-medium\"><li class=\"shariff-button twitter shariff-nocustomcolor\" style=\"background-color:#595959\"><a href=\"https:\/\/twitter.com\/share?url=https%3A%2F%2Fpicockpit.com%2Fraspberry-pi%2Fdiy-wireless-servo-switch-controller-with-raspberry-pi-pico-w%2F&text=DIY%20wireless%20servo%20switch%20controller%20with%20Raspberry%20Pi%20Pico%20W\" title=\"Share on X\" aria-label=\"Share on X\" role=\"button\" rel=\"noopener nofollow\" class=\"shariff-link\" style=\"; background-color:#000; color:#000\" target=\"_blank\"><span class=\"shariff-icon\" style=\"fill:#000\"><svg width=\"32px\" height=\"20px\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" viewBox=\"0 0 24 24\"><path fill=\"#000\" d=\"M14.258 10.152L23.176 0h-2.113l-7.747 8.813L7.133 0H0l9.352 13.328L0 23.973h2.113l8.176-9.309 6.531 9.309h7.133zm-2.895 3.293l-.949-1.328L2.875 1.56h3.246l6.086 8.523.945 1.328 7.91 11.078h-3.246zm0 0\"\/><\/svg><\/span><span class=\"shariff-text\" style=\"color:#000\">share<\/span>&nbsp;<\/a><\/li><li class=\"shariff-button facebook shariff-nocustomcolor\" style=\"background-color:#4273c8\"><a href=\"https:\/\/www.facebook.com\/sharer\/sharer.php?u=https%3A%2F%2Fpicockpit.com%2Fraspberry-pi%2Fdiy-wireless-servo-switch-controller-with-raspberry-pi-pico-w%2F\" title=\"Share on Facebook\" aria-label=\"Share on Facebook\" role=\"button\" rel=\"nofollow\" class=\"shariff-link\" style=\"; background-color:#3b5998; color:#3b5998\" target=\"_blank\"><span class=\"shariff-icon\" style=\"fill:#3b5998\"><svg width=\"32px\" height=\"20px\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" viewBox=\"0 0 18 32\"><path fill=\"#3b5998\" d=\"M17.1 0.2v4.7h-2.8q-1.5 0-2.1 0.6t-0.5 1.9v3.4h5.2l-0.7 5.3h-4.5v13.6h-5.5v-13.6h-4.5v-5.3h4.5v-3.9q0-3.3 1.9-5.2t5-1.8q2.6 0 4.1 0.2z\"\/><\/svg><\/span><span class=\"shariff-text\" style=\"color:#3b5998\">share<\/span>&nbsp;<\/a><\/li><li class=\"shariff-button telegram shariff-nocustomcolor\" style=\"background-color:#4084A6\"><a href=\"https:\/\/telegram.me\/share\/url?url=https%3A%2F%2Fpicockpit.com%2Fraspberry-pi%2Fdiy-wireless-servo-switch-controller-with-raspberry-pi-pico-w%2F&text=DIY%20wireless%20servo%20switch%20controller%20with%20Raspberry%20Pi%20Pico%20W\" title=\"Share on Telegram\" aria-label=\"Share on Telegram\" role=\"button\" rel=\"noopener nofollow\" class=\"shariff-link\" style=\"; background-color:#0088cc; color:#0088cc\" target=\"_blank\"><span class=\"shariff-icon\" style=\"fill:#0088cc\"><svg width=\"32px\" height=\"20px\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" viewBox=\"0 0 32 32\"><path fill=\"#0088cc\" d=\"M30.8 6.5l-4.5 21.4c-.3 1.5-1.2 1.9-2.5 1.2L16.9 24l-3.3 3.2c-.4.4-.7.7-1.4.7l.5-7L25.5 9.2c.6-.5-.1-.8-.9-.3l-15.8 10L2 16.7c-1.5-.5-1.5-1.5.3-2.2L28.9 4.3c1.3-.5 2.3.3 1.9 2.2z\"\/><\/svg><\/span><span class=\"shariff-text\" style=\"color:#0088cc\">share<\/span>&nbsp;<\/a><\/li><li class=\"shariff-button reddit shariff-nocustomcolor\" style=\"background-color:#ff5700\"><a href=\"https:\/\/www.reddit.com\/submit?url=https%3A%2F%2Fpicockpit.com%2Fraspberry-pi%2Fdiy-wireless-servo-switch-controller-with-raspberry-pi-pico-w%2F\" title=\"Share on Reddit\" aria-label=\"Share on Reddit\" role=\"button\" rel=\"noopener nofollow\" class=\"shariff-link\" style=\"; background-color:#ff4500; color:#ff4500\" target=\"_blank\"><span class=\"shariff-icon\" style=\"fill:#ff4500\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" viewBox=\"0 0 512 512\"><path fill=\"#ff4500\" d=\"M440.3 203.5c-15 0-28.2 6.2-37.9 15.9-35.7-24.7-83.8-40.6-137.1-42.3L293 52.3l88.2 19.8c0 21.6 17.6 39.2 39.2 39.2 22 0 39.7-18.1 39.7-39.7s-17.6-39.7-39.7-39.7c-15.4 0-28.7 9.3-35.3 22l-97.4-21.6c-4.9-1.3-9.7 2.2-11 7.1L246.3 177c-52.9 2.2-100.5 18.1-136.3 42.8-9.7-10.1-23.4-16.3-38.4-16.3-55.6 0-73.8 74.6-22.9 100.1-1.8 7.9-2.6 16.3-2.6 24.7 0 83.8 94.4 151.7 210.3 151.7 116.4 0 210.8-67.9 210.8-151.7 0-8.4-.9-17.2-3.1-25.1 49.9-25.6 31.5-99.7-23.8-99.7zM129.4 308.9c0-22 17.6-39.7 39.7-39.7 21.6 0 39.2 17.6 39.2 39.7 0 21.6-17.6 39.2-39.2 39.2-22 .1-39.7-17.6-39.7-39.2zm214.3 93.5c-36.4 36.4-139.1 36.4-175.5 0-4-3.5-4-9.7 0-13.7 3.5-3.5 9.7-3.5 13.2 0 27.8 28.5 120 29 149 0 3.5-3.5 9.7-3.5 13.2 0 4.1 4 4.1 10.2.1 13.7zm-.8-54.2c-21.6 0-39.2-17.6-39.2-39.2 0-22 17.6-39.7 39.2-39.7 22 0 39.7 17.6 39.7 39.7-.1 21.5-17.7 39.2-39.7 39.2z\"\/><\/svg><\/span><span class=\"shariff-text\" style=\"color:#ff4500\">share<\/span>&nbsp;<\/a><\/li><\/ul><\/div>","protected":false},"excerpt":{"rendered":"<p>One of the biggest problems I have is getting up from bed to turn off the bedroom&#8217;s light. It&#8217;s very difficult to do so when you&#8217;re cozy in bed. And so here, I want to tell you how to solve that problem with a Pico W Servo switch controller. You see, a few years ago,&hellip;<\/p>\n","protected":false},"author":2,"featured_media":2854,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[10,3],"tags":[425,545,543,11,221,486,447,187,484,544],"class_list":["post-2824","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-raspberry-pi-pico","category-raspberry-pi-how-to","tag-light","tag-lights","tag-microservo","tag-pico","tag-pico-w","tag-project","tag-projects","tag-raspberry-pi","tag-servo","tag-sg90"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.4 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>DIY wireless servo switch controller with Raspberry Pi Pico W | PiCockpit<\/title>\n<meta name=\"description\" content=\"Make DIY wireless servo switch controller to turn off light switches, appliances and much more with the Raspberry Pi Pico W and SoftAP!\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/picockpit.com\/raspberry-pi\/diy-wireless-servo-switch-controller-with-raspberry-pi-pico-w\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"DIY wireless servo switch controller with Raspberry Pi Pico W | PiCockpit\" \/>\n<meta property=\"og:description\" content=\"Make DIY wireless servo switch controller to turn off light switches, appliances and much more with the Raspberry Pi Pico W and SoftAP!\" \/>\n<meta property=\"og:url\" content=\"https:\/\/picockpit.com\/raspberry-pi\/diy-wireless-servo-switch-controller-with-raspberry-pi-pico-w\/\" \/>\n<meta property=\"og:site_name\" content=\"PiCockpit\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/pi3gshop\" \/>\n<meta property=\"article:published_time\" content=\"2022-07-19T12:43:06+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-08-22T14:46:06+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/picockpit.com\/raspberry-pi\/wp-content\/uploads\/2022\/07\/featured-image-4.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1778\" \/>\n\t<meta property=\"og:image:height\" content=\"1000\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"raspi berry\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@pi3g\" \/>\n<meta name=\"twitter:site\" content=\"@pi3g\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"raspi berry\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"8 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/picockpit.com\\\/raspberry-pi\\\/diy-wireless-servo-switch-controller-with-raspberry-pi-pico-w\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/picockpit.com\\\/raspberry-pi\\\/diy-wireless-servo-switch-controller-with-raspberry-pi-pico-w\\\/\"},\"author\":{\"name\":\"raspi berry\",\"@id\":\"https:\\\/\\\/picockpit.com\\\/raspberry-pi\\\/#\\\/schema\\\/person\\\/7af3a7a8c999bc722029ef9ca9d78eee\"},\"headline\":\"DIY wireless servo switch controller with Raspberry Pi Pico W\",\"datePublished\":\"2022-07-19T12:43:06+00:00\",\"dateModified\":\"2023-08-22T14:46:06+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/picockpit.com\\\/raspberry-pi\\\/diy-wireless-servo-switch-controller-with-raspberry-pi-pico-w\\\/\"},\"wordCount\":1308,\"commentCount\":2,\"publisher\":{\"@id\":\"https:\\\/\\\/picockpit.com\\\/raspberry-pi\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/picockpit.com\\\/raspberry-pi\\\/diy-wireless-servo-switch-controller-with-raspberry-pi-pico-w\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/picockpit.com\\\/raspberry-pi\\\/wp-content\\\/uploads\\\/2022\\\/07\\\/featured-image-4.jpg\",\"keywords\":[\"light\",\"lights\",\"microservo\",\"Pico\",\"Pico W\",\"project\",\"Projects\",\"Raspberry Pi\",\"servo\",\"SG90\"],\"articleSection\":[\"Raspberry Pi Pico\",\"Tutorials\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/picockpit.com\\\/raspberry-pi\\\/diy-wireless-servo-switch-controller-with-raspberry-pi-pico-w\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/picockpit.com\\\/raspberry-pi\\\/diy-wireless-servo-switch-controller-with-raspberry-pi-pico-w\\\/\",\"url\":\"https:\\\/\\\/picockpit.com\\\/raspberry-pi\\\/diy-wireless-servo-switch-controller-with-raspberry-pi-pico-w\\\/\",\"name\":\"DIY wireless servo switch controller with Raspberry Pi Pico W | PiCockpit\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/picockpit.com\\\/raspberry-pi\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/picockpit.com\\\/raspberry-pi\\\/diy-wireless-servo-switch-controller-with-raspberry-pi-pico-w\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/picockpit.com\\\/raspberry-pi\\\/diy-wireless-servo-switch-controller-with-raspberry-pi-pico-w\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/picockpit.com\\\/raspberry-pi\\\/wp-content\\\/uploads\\\/2022\\\/07\\\/featured-image-4.jpg\",\"datePublished\":\"2022-07-19T12:43:06+00:00\",\"dateModified\":\"2023-08-22T14:46:06+00:00\",\"description\":\"Make DIY wireless servo switch controller to turn off light switches, appliances and much more with the Raspberry Pi Pico W and SoftAP!\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/picockpit.com\\\/raspberry-pi\\\/diy-wireless-servo-switch-controller-with-raspberry-pi-pico-w\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/picockpit.com\\\/raspberry-pi\\\/diy-wireless-servo-switch-controller-with-raspberry-pi-pico-w\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/picockpit.com\\\/raspberry-pi\\\/diy-wireless-servo-switch-controller-with-raspberry-pi-pico-w\\\/#primaryimage\",\"url\":\"https:\\\/\\\/picockpit.com\\\/raspberry-pi\\\/wp-content\\\/uploads\\\/2022\\\/07\\\/featured-image-4.jpg\",\"contentUrl\":\"https:\\\/\\\/picockpit.com\\\/raspberry-pi\\\/wp-content\\\/uploads\\\/2022\\\/07\\\/featured-image-4.jpg\",\"width\":1778,\"height\":1000,\"caption\":\"DIY wireless servo switch controller with Raspberry Pi Pico W\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/picockpit.com\\\/raspberry-pi\\\/diy-wireless-servo-switch-controller-with-raspberry-pi-pico-w\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/picockpit.com\\\/raspberry-pi\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Tutorials\",\"item\":\"https:\\\/\\\/picockpit.com\\\/raspberry-pi\\\/category\\\/raspberry-pi-how-to\\\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"DIY wireless servo switch controller with Raspberry Pi Pico W\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/picockpit.com\\\/raspberry-pi\\\/#website\",\"url\":\"https:\\\/\\\/picockpit.com\\\/raspberry-pi\\\/\",\"name\":\"PiCockpit\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\\\/\\\/picockpit.com\\\/raspberry-pi\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/picockpit.com\\\/raspberry-pi\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/picockpit.com\\\/raspberry-pi\\\/#organization\",\"name\":\"PiCockpit.com\",\"url\":\"https:\\\/\\\/picockpit.com\\\/raspberry-pi\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/picockpit.com\\\/raspberry-pi\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/picockpit.com\\\/raspberry-pi\\\/wp-content\\\/uploads\\\/2023\\\/07\\\/Screenshot-from-2023-07-24-15-01-24.png\",\"contentUrl\":\"https:\\\/\\\/picockpit.com\\\/raspberry-pi\\\/wp-content\\\/uploads\\\/2023\\\/07\\\/Screenshot-from-2023-07-24-15-01-24.png\",\"width\":1165,\"height\":283,\"caption\":\"PiCockpit.com\"},\"image\":{\"@id\":\"https:\\\/\\\/picockpit.com\\\/raspberry-pi\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/www.facebook.com\\\/pi3gshop\",\"https:\\\/\\\/x.com\\\/pi3g\"]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/picockpit.com\\\/raspberry-pi\\\/#\\\/schema\\\/person\\\/7af3a7a8c999bc722029ef9ca9d78eee\",\"name\":\"raspi berry\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/c10c423ceeff34163dd54a5472d6da17d71c0e360e0cf8cdb8847006372f216b?s=96&d=blank&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/c10c423ceeff34163dd54a5472d6da17d71c0e360e0cf8cdb8847006372f216b?s=96&d=blank&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/c10c423ceeff34163dd54a5472d6da17d71c0e360e0cf8cdb8847006372f216b?s=96&d=blank&r=g\",\"caption\":\"raspi berry\"},\"description\":\"I'm here to help you with all your Raspberry Pi related questions &amp; love to share about new project ideas for the Raspberry Pi, and give quick tips. Of course I'll also help you with PiCockpit and how to make your Raspberry Pi even easier to use with this raspberry pi monitoring solution :-)\",\"sameAs\":[\"https:\\\/\\\/picockpit.com\"],\"url\":\"https:\\\/\\\/picockpit.com\\\/raspberry-pi\\\/author\\\/raspi-berry\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"DIY wireless servo switch controller with Raspberry Pi Pico W | PiCockpit","description":"Make DIY wireless servo switch controller to turn off light switches, appliances and much more with the Raspberry Pi Pico W and SoftAP!","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:\/\/picockpit.com\/raspberry-pi\/diy-wireless-servo-switch-controller-with-raspberry-pi-pico-w\/","og_locale":"en_US","og_type":"article","og_title":"DIY wireless servo switch controller with Raspberry Pi Pico W | PiCockpit","og_description":"Make DIY wireless servo switch controller to turn off light switches, appliances and much more with the Raspberry Pi Pico W and SoftAP!","og_url":"https:\/\/picockpit.com\/raspberry-pi\/diy-wireless-servo-switch-controller-with-raspberry-pi-pico-w\/","og_site_name":"PiCockpit","article_publisher":"https:\/\/www.facebook.com\/pi3gshop","article_published_time":"2022-07-19T12:43:06+00:00","article_modified_time":"2023-08-22T14:46:06+00:00","og_image":[{"width":1778,"height":1000,"url":"https:\/\/picockpit.com\/raspberry-pi\/wp-content\/uploads\/2022\/07\/featured-image-4.jpg","type":"image\/jpeg"}],"author":"raspi berry","twitter_card":"summary_large_image","twitter_creator":"@pi3g","twitter_site":"@pi3g","twitter_misc":{"Written by":"raspi berry","Est. reading time":"8 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/picockpit.com\/raspberry-pi\/diy-wireless-servo-switch-controller-with-raspberry-pi-pico-w\/#article","isPartOf":{"@id":"https:\/\/picockpit.com\/raspberry-pi\/diy-wireless-servo-switch-controller-with-raspberry-pi-pico-w\/"},"author":{"name":"raspi berry","@id":"https:\/\/picockpit.com\/raspberry-pi\/#\/schema\/person\/7af3a7a8c999bc722029ef9ca9d78eee"},"headline":"DIY wireless servo switch controller with Raspberry Pi Pico W","datePublished":"2022-07-19T12:43:06+00:00","dateModified":"2023-08-22T14:46:06+00:00","mainEntityOfPage":{"@id":"https:\/\/picockpit.com\/raspberry-pi\/diy-wireless-servo-switch-controller-with-raspberry-pi-pico-w\/"},"wordCount":1308,"commentCount":2,"publisher":{"@id":"https:\/\/picockpit.com\/raspberry-pi\/#organization"},"image":{"@id":"https:\/\/picockpit.com\/raspberry-pi\/diy-wireless-servo-switch-controller-with-raspberry-pi-pico-w\/#primaryimage"},"thumbnailUrl":"https:\/\/picockpit.com\/raspberry-pi\/wp-content\/uploads\/2022\/07\/featured-image-4.jpg","keywords":["light","lights","microservo","Pico","Pico W","project","Projects","Raspberry Pi","servo","SG90"],"articleSection":["Raspberry Pi Pico","Tutorials"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/picockpit.com\/raspberry-pi\/diy-wireless-servo-switch-controller-with-raspberry-pi-pico-w\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/picockpit.com\/raspberry-pi\/diy-wireless-servo-switch-controller-with-raspberry-pi-pico-w\/","url":"https:\/\/picockpit.com\/raspberry-pi\/diy-wireless-servo-switch-controller-with-raspberry-pi-pico-w\/","name":"DIY wireless servo switch controller with Raspberry Pi Pico W | PiCockpit","isPartOf":{"@id":"https:\/\/picockpit.com\/raspberry-pi\/#website"},"primaryImageOfPage":{"@id":"https:\/\/picockpit.com\/raspberry-pi\/diy-wireless-servo-switch-controller-with-raspberry-pi-pico-w\/#primaryimage"},"image":{"@id":"https:\/\/picockpit.com\/raspberry-pi\/diy-wireless-servo-switch-controller-with-raspberry-pi-pico-w\/#primaryimage"},"thumbnailUrl":"https:\/\/picockpit.com\/raspberry-pi\/wp-content\/uploads\/2022\/07\/featured-image-4.jpg","datePublished":"2022-07-19T12:43:06+00:00","dateModified":"2023-08-22T14:46:06+00:00","description":"Make DIY wireless servo switch controller to turn off light switches, appliances and much more with the Raspberry Pi Pico W and SoftAP!","breadcrumb":{"@id":"https:\/\/picockpit.com\/raspberry-pi\/diy-wireless-servo-switch-controller-with-raspberry-pi-pico-w\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/picockpit.com\/raspberry-pi\/diy-wireless-servo-switch-controller-with-raspberry-pi-pico-w\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/picockpit.com\/raspberry-pi\/diy-wireless-servo-switch-controller-with-raspberry-pi-pico-w\/#primaryimage","url":"https:\/\/picockpit.com\/raspberry-pi\/wp-content\/uploads\/2022\/07\/featured-image-4.jpg","contentUrl":"https:\/\/picockpit.com\/raspberry-pi\/wp-content\/uploads\/2022\/07\/featured-image-4.jpg","width":1778,"height":1000,"caption":"DIY wireless servo switch controller with Raspberry Pi Pico W"},{"@type":"BreadcrumbList","@id":"https:\/\/picockpit.com\/raspberry-pi\/diy-wireless-servo-switch-controller-with-raspberry-pi-pico-w\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/picockpit.com\/raspberry-pi\/"},{"@type":"ListItem","position":2,"name":"Tutorials","item":"https:\/\/picockpit.com\/raspberry-pi\/category\/raspberry-pi-how-to\/"},{"@type":"ListItem","position":3,"name":"DIY wireless servo switch controller with Raspberry Pi Pico W"}]},{"@type":"WebSite","@id":"https:\/\/picockpit.com\/raspberry-pi\/#website","url":"https:\/\/picockpit.com\/raspberry-pi\/","name":"PiCockpit","description":"","publisher":{"@id":"https:\/\/picockpit.com\/raspberry-pi\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/picockpit.com\/raspberry-pi\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/picockpit.com\/raspberry-pi\/#organization","name":"PiCockpit.com","url":"https:\/\/picockpit.com\/raspberry-pi\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/picockpit.com\/raspberry-pi\/#\/schema\/logo\/image\/","url":"https:\/\/picockpit.com\/raspberry-pi\/wp-content\/uploads\/2023\/07\/Screenshot-from-2023-07-24-15-01-24.png","contentUrl":"https:\/\/picockpit.com\/raspberry-pi\/wp-content\/uploads\/2023\/07\/Screenshot-from-2023-07-24-15-01-24.png","width":1165,"height":283,"caption":"PiCockpit.com"},"image":{"@id":"https:\/\/picockpit.com\/raspberry-pi\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/pi3gshop","https:\/\/x.com\/pi3g"]},{"@type":"Person","@id":"https:\/\/picockpit.com\/raspberry-pi\/#\/schema\/person\/7af3a7a8c999bc722029ef9ca9d78eee","name":"raspi berry","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/c10c423ceeff34163dd54a5472d6da17d71c0e360e0cf8cdb8847006372f216b?s=96&d=blank&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/c10c423ceeff34163dd54a5472d6da17d71c0e360e0cf8cdb8847006372f216b?s=96&d=blank&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/c10c423ceeff34163dd54a5472d6da17d71c0e360e0cf8cdb8847006372f216b?s=96&d=blank&r=g","caption":"raspi berry"},"description":"I'm here to help you with all your Raspberry Pi related questions &amp; love to share about new project ideas for the Raspberry Pi, and give quick tips. Of course I'll also help you with PiCockpit and how to make your Raspberry Pi even easier to use with this raspberry pi monitoring solution :-)","sameAs":["https:\/\/picockpit.com"],"url":"https:\/\/picockpit.com\/raspberry-pi\/author\/raspi-berry\/"}]}},"_links":{"self":[{"href":"https:\/\/picockpit.com\/raspberry-pi\/wp-json\/wp\/v2\/posts\/2824","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/picockpit.com\/raspberry-pi\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/picockpit.com\/raspberry-pi\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/picockpit.com\/raspberry-pi\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/picockpit.com\/raspberry-pi\/wp-json\/wp\/v2\/comments?post=2824"}],"version-history":[{"count":26,"href":"https:\/\/picockpit.com\/raspberry-pi\/wp-json\/wp\/v2\/posts\/2824\/revisions"}],"predecessor-version":[{"id":4877,"href":"https:\/\/picockpit.com\/raspberry-pi\/wp-json\/wp\/v2\/posts\/2824\/revisions\/4877"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/picockpit.com\/raspberry-pi\/wp-json\/wp\/v2\/media\/2854"}],"wp:attachment":[{"href":"https:\/\/picockpit.com\/raspberry-pi\/wp-json\/wp\/v2\/media?parent=2824"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/picockpit.com\/raspberry-pi\/wp-json\/wp\/v2\/categories?post=2824"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/picockpit.com\/raspberry-pi\/wp-json\/wp\/v2\/tags?post=2824"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}