{"id":6553,"date":"2025-01-17T09:14:13","date_gmt":"2025-01-17T08:14:13","guid":{"rendered":"https:\/\/www.pschatzmann.ch\/home\/?p=6553"},"modified":"2025-01-17T09:14:13","modified_gmt":"2025-01-17T08:14:13","slug":"arduino-snapclient-with-rasperry-pico-2-w","status":"publish","type":"post","link":"https:\/\/www.pschatzmann.ch\/home\/2025\/01\/17\/arduino-snapclient-with-rasperry-pico-2-w\/","title":{"rendered":"arduino-snapclient  with Rasperry Pico 2 W"},"content":{"rendered":"<p>I was wondering if the <strong>Raperry Pico 2W<\/strong> can be used with my <a href=\"https:\/\/github.com\/pschatzmann\/arduino-snapclient\">Arduino Snapclient Library<\/a>. A related discussion was hinting that it is just not powerful enough.<\/p>\n<p>In the beginning was stuggeling quite a bit and the audio with Opus was just not working and I could bareliy make it work with PCM\/WAV with a sample rate of only 8000.<\/p>\n<p>The solution was to split up the Wifi and the audio decoding to the different cores, so I implemented a new <code>SnapProcessorRP2040<\/code> class.<\/p>\n<p>The sketch that uses this class now looks as follows<\/p>\n<pre><code>#include \"AudioTools.h\"\n#include \"AudioTools\/AudioCodecs\/CodecOpus.h\"\n#include \"AudioTools\/AudioLibs\/AudioBoardStream.h\"\n#include \"SnapClient.h\"\n#include \"api\/SnapProcessorRP2040.h\" \n\n#define ARDUINO_LOOP_STACK_SIZE (10 * 1024)\n\nI2SStream out;\nOpusAudioDecoder opus;\nWiFiClient wifi;\nSnapTimeSyncDynamic synch(172, 10); \/\/ optional configuratioin\nCopyDecoder copy;\nSnapClient client(wifi, out, opus);\nSnapProcessorRP2040 processor_rp2040(1024*10); \/\/ define queue with 10 kbytes\n\nvoid setup() {\n  Serial.begin(115200);\n  AudioToolsLogger.begin(Serial, AudioToolsLogLevel::Info);\n  while(!Serial);\n  Serial.println(\"starting...\");\n\n  \/\/ login to wifi -&gt; Define values in SnapConfig.h or replace them here\n  WiFi.begin(\"ssid\", \"pwd\");\n  Serial.print(\"Connecting to WiFi ..\");\n  while (WiFi.status() != WL_CONNECTED) {\n    Serial.print('.');\n    delay(1000);\n  }\n\n  \/\/ print ip address\n  Serial.println();\n  Serial.println(WiFi.localIP());\n\n  \/\/ Define CONFIG_SNAPCAST_SERVER_HOST in SnapConfig.h or here\n  \/\/client.setServerIP(IPAddress(192,168,1,44));\n  client.setSnapProcessor(processor_rp2040);\n\n  \/\/ start snap client\n  client.begin(synch);\n  Serial.println(\"started\");\n}\n\nvoid loop() {\n  client.doLoop();\n}\n\nvoid setup1(){\n  \/\/ setup I2S to define custom pins\n  auto cfg = out.defaultConfig();\n  \/\/cfg.pin_bck = 14;\n  \/\/cfg.pin_ws = 15;\n  \/\/cfg.pin_data = 22;\n  cfg.sample_rate = 48000;\n  cfg.buffer_size = 1024;\n  cfg.buffer_count = 4;\n  out.begin(cfg);\n}\n\nvoid loop1(){\n  client.snapProcessor().doLoop1();\n}\n<\/code><\/pre>\n<p>I think the audio is not perfect yet, but it is much better now!<br \/>\nIf you plan to use this sketch, I suggest to use the version that is provided in the examples directory.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I was wondering if the Raperry Pico 2W can be used with my Arduino Snapclient Library. A related discussion was hinting that it is just not powerful enough. In the beginning was stuggeling quite a bit and the audio with Opus was just not working and I could bareliy make [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":5434,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_crdt_document":"","_import_markdown_pro_load_document_selector":0,"_import_markdown_pro_submit_text_textarea":"","_exactmetrics_skip_tracking":false,"_exactmetrics_sitenote_active":false,"_exactmetrics_sitenote_note":"","_exactmetrics_sitenote_category":0,"footnotes":""},"categories":[20,22,24],"tags":[],"class_list":["post-6553","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-arduino","category-machine-sound","category-pico"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.5 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>arduino-snapclient with Rasperry Pico 2 W - Phil Schatzmann<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.pschatzmann.ch\/home\/2025\/01\/17\/arduino-snapclient-with-rasperry-pico-2-w\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"arduino-snapclient with Rasperry Pico 2 W - Phil Schatzmann\" \/>\n<meta property=\"og:description\" content=\"I was wondering if the Raperry Pico 2W can be used with my Arduino Snapclient Library. A related discussion was hinting that it is just not powerful enough. In the beginning was stuggeling quite a bit and the audio with Opus was just not working and I could bareliy make [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.pschatzmann.ch\/home\/2025\/01\/17\/arduino-snapclient-with-rasperry-pico-2-w\/\" \/>\n<meta property=\"og:site_name\" content=\"Phil Schatzmann\" \/>\n<meta property=\"article:published_time\" content=\"2025-01-17T08:14:13+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.pschatzmann.ch\/wp-content\/uploads\/2023\/03\/raspberry-pi-pico-w-1.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"800\" \/>\n\t<meta property=\"og:image:height\" content=\"800\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"pschatzmann\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"pschatzmann\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/2025\\\/01\\\/17\\\/arduino-snapclient-with-rasperry-pico-2-w\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/2025\\\/01\\\/17\\\/arduino-snapclient-with-rasperry-pico-2-w\\\/\"},\"author\":{\"name\":\"pschatzmann\",\"@id\":\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/#\\\/schema\\\/person\\\/73a53638a4e34e8373405fd737dac9b1\"},\"headline\":\"arduino-snapclient with Rasperry Pico 2 W\",\"datePublished\":\"2025-01-17T08:14:13+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/2025\\\/01\\\/17\\\/arduino-snapclient-with-rasperry-pico-2-w\\\/\"},\"wordCount\":132,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/#\\\/schema\\\/person\\\/73a53638a4e34e8373405fd737dac9b1\"},\"image\":{\"@id\":\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/2025\\\/01\\\/17\\\/arduino-snapclient-with-rasperry-pico-2-w\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.pschatzmann.ch\\\/wp-content\\\/uploads\\\/2023\\\/03\\\/raspberry-pi-pico-w-1.jpg\",\"articleSection\":[\"Arduino\",\"Machine Sound\",\"Pico\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/2025\\\/01\\\/17\\\/arduino-snapclient-with-rasperry-pico-2-w\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/2025\\\/01\\\/17\\\/arduino-snapclient-with-rasperry-pico-2-w\\\/\",\"url\":\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/2025\\\/01\\\/17\\\/arduino-snapclient-with-rasperry-pico-2-w\\\/\",\"name\":\"arduino-snapclient with Rasperry Pico 2 W - Phil Schatzmann\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/2025\\\/01\\\/17\\\/arduino-snapclient-with-rasperry-pico-2-w\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/2025\\\/01\\\/17\\\/arduino-snapclient-with-rasperry-pico-2-w\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.pschatzmann.ch\\\/wp-content\\\/uploads\\\/2023\\\/03\\\/raspberry-pi-pico-w-1.jpg\",\"datePublished\":\"2025-01-17T08:14:13+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/2025\\\/01\\\/17\\\/arduino-snapclient-with-rasperry-pico-2-w\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/2025\\\/01\\\/17\\\/arduino-snapclient-with-rasperry-pico-2-w\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/2025\\\/01\\\/17\\\/arduino-snapclient-with-rasperry-pico-2-w\\\/#primaryimage\",\"url\":\"https:\\\/\\\/www.pschatzmann.ch\\\/wp-content\\\/uploads\\\/2023\\\/03\\\/raspberry-pi-pico-w-1.jpg\",\"contentUrl\":\"https:\\\/\\\/www.pschatzmann.ch\\\/wp-content\\\/uploads\\\/2023\\\/03\\\/raspberry-pi-pico-w-1.jpg\",\"width\":800,\"height\":800},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/2025\\\/01\\\/17\\\/arduino-snapclient-with-rasperry-pico-2-w\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"arduino-snapclient with Rasperry Pico 2 W\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/#website\",\"url\":\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/\",\"name\":\"Phil Schatzmann Consulting\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/#\\\/schema\\\/person\\\/73a53638a4e34e8373405fd737dac9b1\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/#\\\/schema\\\/person\\\/73a53638a4e34e8373405fd737dac9b1\",\"name\":\"pschatzmann\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.pschatzmann.ch\\\/wp-content\\\/uploads\\\/2022\\\/08\\\/pschatzmann.png\",\"url\":\"https:\\\/\\\/www.pschatzmann.ch\\\/wp-content\\\/uploads\\\/2022\\\/08\\\/pschatzmann.png\",\"contentUrl\":\"https:\\\/\\\/www.pschatzmann.ch\\\/wp-content\\\/uploads\\\/2022\\\/08\\\/pschatzmann.png\",\"width\":305,\"height\":305,\"caption\":\"pschatzmann\"},\"logo\":{\"@id\":\"https:\\\/\\\/www.pschatzmann.ch\\\/wp-content\\\/uploads\\\/2022\\\/08\\\/pschatzmann.png\"}}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"arduino-snapclient with Rasperry Pico 2 W - Phil Schatzmann","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:\/\/www.pschatzmann.ch\/home\/2025\/01\/17\/arduino-snapclient-with-rasperry-pico-2-w\/","og_locale":"en_US","og_type":"article","og_title":"arduino-snapclient with Rasperry Pico 2 W - Phil Schatzmann","og_description":"I was wondering if the Raperry Pico 2W can be used with my Arduino Snapclient Library. A related discussion was hinting that it is just not powerful enough. In the beginning was stuggeling quite a bit and the audio with Opus was just not working and I could bareliy make [&hellip;]","og_url":"https:\/\/www.pschatzmann.ch\/home\/2025\/01\/17\/arduino-snapclient-with-rasperry-pico-2-w\/","og_site_name":"Phil Schatzmann","article_published_time":"2025-01-17T08:14:13+00:00","og_image":[{"width":800,"height":800,"url":"https:\/\/www.pschatzmann.ch\/wp-content\/uploads\/2023\/03\/raspberry-pi-pico-w-1.jpg","type":"image\/jpeg"}],"author":"pschatzmann","twitter_card":"summary_large_image","twitter_misc":{"Written by":"pschatzmann","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.pschatzmann.ch\/home\/2025\/01\/17\/arduino-snapclient-with-rasperry-pico-2-w\/#article","isPartOf":{"@id":"https:\/\/www.pschatzmann.ch\/home\/2025\/01\/17\/arduino-snapclient-with-rasperry-pico-2-w\/"},"author":{"name":"pschatzmann","@id":"https:\/\/www.pschatzmann.ch\/home\/#\/schema\/person\/73a53638a4e34e8373405fd737dac9b1"},"headline":"arduino-snapclient with Rasperry Pico 2 W","datePublished":"2025-01-17T08:14:13+00:00","mainEntityOfPage":{"@id":"https:\/\/www.pschatzmann.ch\/home\/2025\/01\/17\/arduino-snapclient-with-rasperry-pico-2-w\/"},"wordCount":132,"commentCount":0,"publisher":{"@id":"https:\/\/www.pschatzmann.ch\/home\/#\/schema\/person\/73a53638a4e34e8373405fd737dac9b1"},"image":{"@id":"https:\/\/www.pschatzmann.ch\/home\/2025\/01\/17\/arduino-snapclient-with-rasperry-pico-2-w\/#primaryimage"},"thumbnailUrl":"https:\/\/www.pschatzmann.ch\/wp-content\/uploads\/2023\/03\/raspberry-pi-pico-w-1.jpg","articleSection":["Arduino","Machine Sound","Pico"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.pschatzmann.ch\/home\/2025\/01\/17\/arduino-snapclient-with-rasperry-pico-2-w\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.pschatzmann.ch\/home\/2025\/01\/17\/arduino-snapclient-with-rasperry-pico-2-w\/","url":"https:\/\/www.pschatzmann.ch\/home\/2025\/01\/17\/arduino-snapclient-with-rasperry-pico-2-w\/","name":"arduino-snapclient with Rasperry Pico 2 W - Phil Schatzmann","isPartOf":{"@id":"https:\/\/www.pschatzmann.ch\/home\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.pschatzmann.ch\/home\/2025\/01\/17\/arduino-snapclient-with-rasperry-pico-2-w\/#primaryimage"},"image":{"@id":"https:\/\/www.pschatzmann.ch\/home\/2025\/01\/17\/arduino-snapclient-with-rasperry-pico-2-w\/#primaryimage"},"thumbnailUrl":"https:\/\/www.pschatzmann.ch\/wp-content\/uploads\/2023\/03\/raspberry-pi-pico-w-1.jpg","datePublished":"2025-01-17T08:14:13+00:00","breadcrumb":{"@id":"https:\/\/www.pschatzmann.ch\/home\/2025\/01\/17\/arduino-snapclient-with-rasperry-pico-2-w\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.pschatzmann.ch\/home\/2025\/01\/17\/arduino-snapclient-with-rasperry-pico-2-w\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.pschatzmann.ch\/home\/2025\/01\/17\/arduino-snapclient-with-rasperry-pico-2-w\/#primaryimage","url":"https:\/\/www.pschatzmann.ch\/wp-content\/uploads\/2023\/03\/raspberry-pi-pico-w-1.jpg","contentUrl":"https:\/\/www.pschatzmann.ch\/wp-content\/uploads\/2023\/03\/raspberry-pi-pico-w-1.jpg","width":800,"height":800},{"@type":"BreadcrumbList","@id":"https:\/\/www.pschatzmann.ch\/home\/2025\/01\/17\/arduino-snapclient-with-rasperry-pico-2-w\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.pschatzmann.ch\/home\/"},{"@type":"ListItem","position":2,"name":"arduino-snapclient with Rasperry Pico 2 W"}]},{"@type":"WebSite","@id":"https:\/\/www.pschatzmann.ch\/home\/#website","url":"https:\/\/www.pschatzmann.ch\/home\/","name":"Phil Schatzmann Consulting","description":"","publisher":{"@id":"https:\/\/www.pschatzmann.ch\/home\/#\/schema\/person\/73a53638a4e34e8373405fd737dac9b1"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.pschatzmann.ch\/home\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":["Person","Organization"],"@id":"https:\/\/www.pschatzmann.ch\/home\/#\/schema\/person\/73a53638a4e34e8373405fd737dac9b1","name":"pschatzmann","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.pschatzmann.ch\/wp-content\/uploads\/2022\/08\/pschatzmann.png","url":"https:\/\/www.pschatzmann.ch\/wp-content\/uploads\/2022\/08\/pschatzmann.png","contentUrl":"https:\/\/www.pschatzmann.ch\/wp-content\/uploads\/2022\/08\/pschatzmann.png","width":305,"height":305,"caption":"pschatzmann"},"logo":{"@id":"https:\/\/www.pschatzmann.ch\/wp-content\/uploads\/2022\/08\/pschatzmann.png"}}]}},"post_mailing_queue_ids":[],"_links":{"self":[{"href":"https:\/\/www.pschatzmann.ch\/home\/wp-json\/wp\/v2\/posts\/6553","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.pschatzmann.ch\/home\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.pschatzmann.ch\/home\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.pschatzmann.ch\/home\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.pschatzmann.ch\/home\/wp-json\/wp\/v2\/comments?post=6553"}],"version-history":[{"count":2,"href":"https:\/\/www.pschatzmann.ch\/home\/wp-json\/wp\/v2\/posts\/6553\/revisions"}],"predecessor-version":[{"id":6555,"href":"https:\/\/www.pschatzmann.ch\/home\/wp-json\/wp\/v2\/posts\/6553\/revisions\/6555"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.pschatzmann.ch\/home\/wp-json\/wp\/v2\/media\/5434"}],"wp:attachment":[{"href":"https:\/\/www.pschatzmann.ch\/home\/wp-json\/wp\/v2\/media?parent=6553"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.pschatzmann.ch\/home\/wp-json\/wp\/v2\/categories?post=6553"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.pschatzmann.ch\/home\/wp-json\/wp\/v2\/tags?post=6553"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}