{"id":10010,"date":"2021-02-27T20:05:31","date_gmt":"2021-02-27T13:05:31","guid":{"rendered":"https:\/\/www.makeriot2020.com\/?p=10010"},"modified":"2021-02-27T20:05:35","modified_gmt":"2021-02-27T13:05:35","slug":"maker-pi-pico-with-esp01s-module","status":"publish","type":"post","link":"https:\/\/www.makeriot2020.com\/index.php\/2021\/02\/27\/maker-pi-pico-with-esp01s-module\/","title":{"rendered":"Maker Pi Pico with ESP01S Module"},"content":{"rendered":"\n<p>It has been a while since my last post, most of which has been spent dealing with other things, as well as waiting for electronics modules to arrive from overseas. A lot of my time has also been spent on getting to grips with the Raspberry Pi Pico, and in particular, the <a rel=\"noreferrer noopener\" href=\"https:\/\/th.cytron.io\/p-maker-pi-pico\" target=\"_blank\">Maker Pi Pico, from Cytron Technologies<\/a>. This has been an experience with quite a lot of mixed feelings&#8230; As Usual, Cytron has done an excellent job with the development board, which, while apparently still in Beta, seems to be rock solid. Most of my frustration came from the &#8220;patchy&#8221; C\/C++ support for the Pi Pico (Yes, I know there are great support, BUT it is not exactly user friendly \ud83d\ude42 ). That left me with MicroPython, which although I am fluent, are not my goto language&#8230; <\/p>\n\n\n\n<p>Lets get back on track though&#8230; The Maker Pi Pico has built in support for an ESP01\/ESP01S Module. Lets look at the schematic&#8230;.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" width=\"768\" height=\"541\" data-src=\"http:\/\/144.126.248.244\/wp-content\/uploads\/2021\/02\/MakerPIPico.png\" alt=\"\" class=\"wp-image-10033 lazyload\" data-srcset=\"https:\/\/www.makeriot2020.com\/wp-content\/uploads\/2021\/02\/MakerPIPico.png 768w, https:\/\/www.makeriot2020.com\/wp-content\/uploads\/2021\/02\/MakerPIPico-600x423.png 600w, https:\/\/www.makeriot2020.com\/wp-content\/uploads\/2021\/02\/MakerPIPico-300x211.png 300w\" data-sizes=\"(max-width: 709px) 85vw, (max-width: 909px) 67vw, (max-width: 984px) 61vw, (max-width: 1362px) 45vw, 600px\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" style=\"--smush-placeholder-width: 768px; --smush-placeholder-aspect-ratio: 768\/541;\" \/><figcaption>Maker Pi Pico Schematic<\/figcaption><\/figure>\n\n\n\n<p>As we can see, Cytron has provided us with access to Tx (GP17) and Rx(GP16) directly on the Pi Pico. Power (+3.3v) and Ground are connected as well&#8230; On this version of the board, no access to IO0,IO2 and the Reset Pin for the ESP01\/ESP01S was provided&#8230; Maybe this will change in future&#8230;? <\/p>\n\n\n\n<p>I have used the standard AT command firmware that comes pre-loaded onto the ESP01\/S module. This allows you to send AT commands to the ESP01 Module to control it. It is also possible to setup a transparent WiFi &#8220;channel&#8221; to communicate between Pico and a remote application , making it possible to control Pico remotely. I have however not prepared and example of that for release yet&#8230;.<br><\/p>\n\n\n\n<figure class=\"wp-block-gallery columns-3 is-cropped wp-block-gallery-1 is-layout-flex wp-block-gallery-is-layout-flex\"><ul class=\"blocks-gallery-grid\"><li class=\"blocks-gallery-item\"><figure><img decoding=\"async\" width=\"1024\" height=\"768\" data-src=\"http:\/\/144.126.248.244\/wp-content\/uploads\/2021\/02\/20210227_184251-1024x768.jpg\" alt=\"\" data-id=\"10013\" data-full-url=\"http:\/\/144.126.248.244\/wp-content\/uploads\/2021\/02\/20210227_184251-scaled.jpg\" data-link=\"http:\/\/144.126.248.244\/?attachment_id=10013\" class=\"wp-image-10013 lazyload\" data-srcset=\"https:\/\/www.makeriot2020.com\/wp-content\/uploads\/2021\/02\/20210227_184251-1024x768.jpg 1024w, https:\/\/www.makeriot2020.com\/wp-content\/uploads\/2021\/02\/20210227_184251-scaled-600x450.jpg 600w, https:\/\/www.makeriot2020.com\/wp-content\/uploads\/2021\/02\/20210227_184251-300x225.jpg 300w, https:\/\/www.makeriot2020.com\/wp-content\/uploads\/2021\/02\/20210227_184251-768x576.jpg 768w, https:\/\/www.makeriot2020.com\/wp-content\/uploads\/2021\/02\/20210227_184251-1536x1152.jpg 1536w, https:\/\/www.makeriot2020.com\/wp-content\/uploads\/2021\/02\/20210227_184251-2048x1536.jpg 2048w\" data-sizes=\"(max-width: 709px) 85vw, (max-width: 909px) 67vw, (max-width: 1362px) 62vw, 840px\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" style=\"--smush-placeholder-width: 1024px; --smush-placeholder-aspect-ratio: 1024\/768;\" \/><\/figure><\/li><li class=\"blocks-gallery-item\"><figure><img decoding=\"async\" width=\"1024\" height=\"768\" data-src=\"http:\/\/144.126.248.244\/wp-content\/uploads\/2021\/02\/20210227_184234-1024x768.jpg\" alt=\"\" data-id=\"10012\" data-full-url=\"http:\/\/144.126.248.244\/wp-content\/uploads\/2021\/02\/20210227_184234-scaled.jpg\" data-link=\"http:\/\/144.126.248.244\/?attachment_id=10012\" class=\"wp-image-10012 lazyload\" data-srcset=\"https:\/\/www.makeriot2020.com\/wp-content\/uploads\/2021\/02\/20210227_184234-1024x768.jpg 1024w, https:\/\/www.makeriot2020.com\/wp-content\/uploads\/2021\/02\/20210227_184234-scaled-600x450.jpg 600w, https:\/\/www.makeriot2020.com\/wp-content\/uploads\/2021\/02\/20210227_184234-300x225.jpg 300w, https:\/\/www.makeriot2020.com\/wp-content\/uploads\/2021\/02\/20210227_184234-768x576.jpg 768w, https:\/\/www.makeriot2020.com\/wp-content\/uploads\/2021\/02\/20210227_184234-1536x1152.jpg 1536w, https:\/\/www.makeriot2020.com\/wp-content\/uploads\/2021\/02\/20210227_184234-2048x1536.jpg 2048w\" data-sizes=\"(max-width: 709px) 85vw, (max-width: 909px) 67vw, (max-width: 1362px) 62vw, 840px\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" style=\"--smush-placeholder-width: 1024px; --smush-placeholder-aspect-ratio: 1024\/768;\" \/><\/figure><\/li><li class=\"blocks-gallery-item\"><figure><img decoding=\"async\" width=\"1024\" height=\"768\" data-src=\"http:\/\/144.126.248.244\/wp-content\/uploads\/2021\/02\/20210227_184214-1024x768.jpg\" alt=\"\" data-id=\"10011\" data-full-url=\"http:\/\/144.126.248.244\/wp-content\/uploads\/2021\/02\/20210227_184214-scaled.jpg\" data-link=\"http:\/\/144.126.248.244\/?attachment_id=10011\" class=\"wp-image-10011 lazyload\" data-srcset=\"https:\/\/www.makeriot2020.com\/wp-content\/uploads\/2021\/02\/20210227_184214-1024x768.jpg 1024w, https:\/\/www.makeriot2020.com\/wp-content\/uploads\/2021\/02\/20210227_184214-scaled-600x450.jpg 600w, https:\/\/www.makeriot2020.com\/wp-content\/uploads\/2021\/02\/20210227_184214-300x225.jpg 300w, https:\/\/www.makeriot2020.com\/wp-content\/uploads\/2021\/02\/20210227_184214-768x576.jpg 768w, https:\/\/www.makeriot2020.com\/wp-content\/uploads\/2021\/02\/20210227_184214-1536x1152.jpg 1536w, https:\/\/www.makeriot2020.com\/wp-content\/uploads\/2021\/02\/20210227_184214-2048x1536.jpg 2048w\" data-sizes=\"(max-width: 709px) 85vw, (max-width: 909px) 67vw, (max-width: 1362px) 62vw, 840px\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" style=\"--smush-placeholder-width: 1024px; --smush-placeholder-aspect-ratio: 1024\/768;\" \/><\/figure><\/li><\/ul><\/figure>\n\n\n\n<p>MicroPython Code to communicate with ESP01 from Maker Pi Pico<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>import uos\nfrom machine import UART, Pin\nimport utime\n\n\"\"\"\nESPRESSIF AT Command Set\nhttps:&#47;&#47;docs.espressif.com\/projects\/esp-at\/en\/latest\/AT_Command_Set\/\n\"\"\"\n\nprint()\nprint(\"Machine: \\t\" + uos.uname()&#91;4])\nprint(\"MicroPython: \\t\" + uos.uname()&#91;3])\n\n#indicate program started visually\nled_onboard = machine.Pin(25, machine.Pin.OUT)\nled_onboard.value(0)     # onboard LED OFF\/ON for 0.5\/1.0 sec\nutime.sleep(0.5)\nled_onboard.value(1)\nutime.sleep(1.0)\nled_onboard.value(0)\n\nuart0 = UART(0, rx=Pin(17), tx=Pin(16), baudrate=115200)\n# NOTE that we explicitly set the Tx and Rx pins for use with the UART\n# If we do not do this, they WILL default to Pin 0 and Pin 1\n# Also note that Rx and Tx are swapped, meaning Pico Tx goes to ESP01 Rx \n# and vice versa.\nprint(uart0)\n\ndef sendCMD_waitResp(cmd, uart=uart0, timeout=2000):\n    print(\"CMD: \" + cmd)\n    uart.write(cmd)\n    waitResp(uart, timeout)\n    print()\n    \ndef waitResp(uart=uart0, timeout=2000):\n    prvMills = utime.ticks_ms()\n    resp = b\"\"\n    while (utime.ticks_ms()-prvMills)&lt;timeout:\n        if uart.any():\n            resp = b\"\".join(&#91;resp, uart.read(1)])\n    print(\"resp:\")\n    try:\n        print(resp.decode())\n    except UnicodeError:\n        print(resp)\n    \nsendCMD_waitResp('AT\\r\\n')          #Test AT startup\nsendCMD_waitResp('AT+GMR\\r\\n')      #Check version information\n#sendCMD_waitResp('AT+RESTORE\\r\\n')  #Restore Factory Default Settings\nsendCMD_waitResp('AT+CWMODE?\\r\\n')  #Query the Wi-Fi mode\nsendCMD_waitResp('AT+CWMODE=1\\r\\n') #Set the Wi-Fi mode = Station mode\nsendCMD_waitResp('AT+CWMODE?\\r\\n')  #Query the Wi-Fi mode again\n#sendCMD_waitResp('AT+CWLAP\\r\\n', timeout=10000) #List available APs\nsendCMD_waitResp('AT+CWJAP=\"jean_iot\",\"master123abc\"\\r\\n', timeout=5000) #Connect to AP\nutime.sleep(1)\nsendCMD_waitResp('AT+CIFSR\\r\\n')    #Obtain the Local IP Address<\/code><\/pre>\n\n\n\n<p>You can now extend and adapt this code to suit your purposes&#8230; <\/p>\n\n\n\n<p>The ESP01\/ESP01S AT Command Datasheet is available for download <a rel=\"noreferrer noopener\" href=\"https:\/\/docs.espressif.com\/projects\/esp-at\/en\/latest\/AT_Command_Set\/\" target=\"_blank\">here<\/a><\/p>\n\n\n\n<p>Thank you <\/p>\n","protected":false},"excerpt":{"rendered":"<p>It has been a while since my last post, most of which has been spent dealing with other things, as well as waiting for electronics modules to arrive from overseas. A lot of my time has also been spent on getting to grips with the Raspberry Pi Pico, and in particular, the Maker Pi Pico, &hellip; <a href=\"https:\/\/www.makeriot2020.com\/index.php\/2021\/02\/27\/maker-pi-pico-with-esp01s-module\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Maker Pi Pico with ESP01S Module&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":10013,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[94],"tags":[102,101],"class_list":["post-10010","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-raspberry-pi-pico","tag-esp01s","tag-raspi-pico"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.makeriot2020.com\/index.php\/wp-json\/wp\/v2\/posts\/10010","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.makeriot2020.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.makeriot2020.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.makeriot2020.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.makeriot2020.com\/index.php\/wp-json\/wp\/v2\/comments?post=10010"}],"version-history":[{"count":0,"href":"https:\/\/www.makeriot2020.com\/index.php\/wp-json\/wp\/v2\/posts\/10010\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.makeriot2020.com\/index.php\/wp-json\/wp\/v2\/media\/10013"}],"wp:attachment":[{"href":"https:\/\/www.makeriot2020.com\/index.php\/wp-json\/wp\/v2\/media?parent=10010"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.makeriot2020.com\/index.php\/wp-json\/wp\/v2\/categories?post=10010"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.makeriot2020.com\/index.php\/wp-json\/wp\/v2\/tags?post=10010"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}