{"id":623,"date":"2025-11-08T08:30:10","date_gmt":"2025-11-08T07:30:10","guid":{"rendered":"https:\/\/www.systemdeveloper.nl\/tech\/?p=623"},"modified":"2025-11-08T08:30:11","modified_gmt":"2025-11-08T07:30:11","slug":"teaching-an-ai-to-program-a-microcontroller","status":"publish","type":"post","link":"https:\/\/www.systemdeveloper.nl\/tech\/teaching-an-ai-to-program-a-microcontroller\/","title":{"rendered":"Teaching an AI to Program a Microcontroller"},"content":{"rendered":"<p class=\"wp-block-paragraph wp-block-paragraph\" style=\"\">Most &ldquo;AI + robotics&rdquo; posts are still simulations and slides.<br>This one isn&rsquo;t.<\/p>\n\n\n<p class=\"wp-block-paragraph wp-block-paragraph\" style=\"\">This is the story of how we wired up a Raspberry Pi CM-5, a Raspberry Pi Pico W (running MicroPython), a small OLED display, a green LED, a camera, and an RTX 5090 into a system where:<\/p>\n\n\n<ul class=\"wp-block-list wp-block-list\">\n<li>an AI can <strong>write and deploy code<\/strong> to a real microcontroller,<\/li>\n\n\n\n<li>run it, log the result, and iterate like an engineer,<\/li>\n\n\n\n<li>and use <strong>vision and sensors<\/strong> to ground that code in the real world.<\/li>\n<\/ul>\n\n\n<p class=\"wp-block-paragraph wp-block-paragraph\" style=\"\">It&rsquo;s &ldquo;hello world&rdquo;, but instead of printing a string, the world actually blinks back.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n<h2 class=\"wp-block-heading\" id=\"architecture-in-short\">Architecture in Short<\/h2>\n\n\n<ol class=\"wp-block-list\">\n<li>\n<strong>Pico W<\/strong> connected via USB to a <strong>CM-5 \/ Pi 5<\/strong>.<\/li>\n\n\n\n<li>\n<strong>MicroPython<\/strong> runs on the Pico.<\/li>\n\n\n\n<li>\n<strong>CM-5<\/strong> runs:<ul class=\"wp-block-list wp-block-list wp-block-list\">\n<li>\n<code>mpremote<\/code> for direct serial access,<\/li>\n\n\n\n<li>a small <strong>Flask API<\/strong> (<code>pico_api.py<\/code>) exposing:<ul class=\"wp-block-list wp-block-list\">\n<li>code execution, file upload\/delete, reset, run logs.<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li>Any agent or AI can:<ul class=\"wp-block-list wp-block-list\">\n<li>upload new code,<\/li>\n\n\n\n<li>execute it,<\/li>\n\n\n\n<li>read stdout\/stderr and classify errors,<\/li>\n\n\n\n<li>store each run as JSON for later reasoning.<\/li>\n<\/ul>\n<\/li>\n<\/ol>\n\n\n<p class=\"wp-block-paragraph wp-block-paragraph\" style=\"\">The system forms a programmable bridge between intelligence and hardware.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n<h2 class=\"wp-block-heading\" id=\"hardware-setup\">Hardware Setup<\/h2>\n\n\n<ul class=\"wp-block-list wp-block-list\">\n<li>\n<strong>Raspberry Pi Pico W<\/strong> (or Pico 2 W) connected via USB.<\/li>\n\n\n\n<li>\n<strong>OLED SSD1306 I&sup2;C<\/strong> display:<ul class=\"wp-block-list wp-block-list\">\n<li>SCL &rarr; GP15, SDA &rarr; GP14<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li>\n<strong>Green LED<\/strong> &rarr; GP16 (with resistor).<\/li>\n\n\n\n<li>\n<strong>CM-5 \/ Pi 5<\/strong> runs Python 3 and Flask.<\/li>\n<\/ul>\n\n\n<pre class=\"wp-block-code\"><div class=\"copy-to-clipboard\">\n<span>Copied!<\/span><button class=\"click-to-copy-button\" title=\"Copy to clipboard\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" viewbox=\"0 0 32 32\" stroke=\"currentcolor\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\" width=\"24\" height=\"24\" fill=\"none\">\n  <path d=\"M12.9975 10.7499L11.7475 10.7499C10.6429 10.7499 9.74747 11.6453 9.74747 12.7499L9.74747 21.2499C9.74747 22.3544 10.6429 23.2499 11.7475 23.2499L20.2475 23.2499C21.352 23.2499 22.2475 22.3544 22.2475 21.2499L22.2475 12.7499C22.2475 11.6453 21.352 10.7499 20.2475 10.7499L18.9975 10.7499Z\"><\/path>\n  <path d=\"M17.9975 12.2499L13.9975 12.2499C13.4452 12.2499 12.9975 11.8022 12.9975 11.2499L12.9975 9.74988C12.9975 9.19759 13.4452 8.74988 13.9975 8.74988L17.9975 8.74988C18.5498 8.74988 18.9975 9.19759 18.9975 9.74988L18.9975 11.2499C18.9975 11.8022 18.5498 12.2499 17.9975 12.2499Z\"><\/path>\n  <path d=\"M13.7475 16.2499L18.2475 16.2499\"><\/path>\n  <path d=\"M13.7475 19.2499L18.2475 19.2499\"><\/path>\n<\/svg><\/button><textarea>sudo apt install python3-venv\npython3 -m venv .venv\nsource .venv\/bin\/activate\npip install flask mpremote<\/textarea>\n<\/div><code>sudo apt install python3-venv\npython3 -m venv .venv\nsource .venv\/bin\/activate\npip install flask mpremote\n<\/code><\/pre>\n\n\n<p class=\"wp-block-paragraph wp-block-paragraph\" style=\"\">Verify connection:<\/p>\n\n\n<pre class=\"wp-block-code\"><div class=\"copy-to-clipboard\">\n<span>Copied!<\/span><button class=\"click-to-copy-button\" title=\"Copy to clipboard\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" viewbox=\"0 0 32 32\" stroke=\"currentcolor\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\" width=\"24\" height=\"24\" fill=\"none\">\n  <path d=\"M12.9975 10.7499L11.7475 10.7499C10.6429 10.7499 9.74747 11.6453 9.74747 12.7499L9.74747 21.2499C9.74747 22.3544 10.6429 23.2499 11.7475 23.2499L20.2475 23.2499C21.352 23.2499 22.2475 22.3544 22.2475 21.2499L22.2475 12.7499C22.2475 11.6453 21.352 10.7499 20.2475 10.7499L18.9975 10.7499Z\"><\/path>\n  <path d=\"M17.9975 12.2499L13.9975 12.2499C13.4452 12.2499 12.9975 11.8022 12.9975 11.2499L12.9975 9.74988C12.9975 9.19759 13.4452 8.74988 13.9975 8.74988L17.9975 8.74988C18.5498 8.74988 18.9975 9.19759 18.9975 9.74988L18.9975 11.2499C18.9975 11.8022 18.5498 12.2499 17.9975 12.2499Z\"><\/path>\n  <path d=\"M13.7475 16.2499L18.2475 16.2499\"><\/path>\n  <path d=\"M13.7475 19.2499L18.2475 19.2499\"><\/path>\n<\/svg><\/button><textarea>mpremote connect auto\n&gt;&gt;&gt; # MicroPython REPL should appear<\/textarea>\n<\/div><code>mpremote connect auto\n&gt;&gt;&gt; # MicroPython REPL should appear\n<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n<h2 class=\"wp-block-heading\" id=\"the-pico-api-picoapi-py\">The Pico API (<code>pico_api.py<\/code>)<\/h2>\n\n\n<p class=\"wp-block-paragraph wp-block-paragraph\" style=\"\">A lightweight Flask server wraps <code>mpremote<\/code> and gives the AI a safe, auditable way to manipulate the board.<\/p>\n\n\n<h3 class=\"wp-block-heading\" id=\"key-endpoints\">Key Endpoints<\/h3>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th>Method<\/th><th>Path<\/th><th>Description<\/th><\/tr><\/thead><tbody><tr><td><code>POST<\/code><\/td><td><code>\/pico\/runs\/exec_snippet<\/code><\/td><td>Run a MicroPython snippet<\/td><\/tr><tr><td><code>POST<\/code><\/td><td><code>\/pico\/runs\/exec_file<\/code><\/td><td>Execute existing file<\/td><\/tr><tr><td><code>PUT<\/code><\/td><td><code>\/pico\/files<\/code><\/td><td>Upload \/ overwrite file<\/td><\/tr><tr><td><code>GET<\/code><\/td><td><code>\/pico\/files<\/code><\/td><td>List files<\/td><\/tr><tr><td><code>GET<\/code><\/td><td><code>\/pico\/files\/content<\/code><\/td><td>Read a file<\/td><\/tr><tr><td><code>DELETE<\/code><\/td><td><code>\/pico\/files<\/code><\/td><td>Remove file<\/td><\/tr><tr><td><code>POST<\/code><\/td><td><code>\/pico\/reset<\/code><\/td><td>Soft \/ hard reset<\/td><\/tr><tr><td><code>GET<\/code><\/td><td><code>\/pico\/info<\/code><\/td><td>FS info<\/td><\/tr><tr><td><code>GET<\/code><\/td><td><code>\/pico\/runs<\/code><\/td><td>List logged runs<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n<p class=\"wp-block-paragraph wp-block-paragraph\" style=\"\">Every run is logged as a JSON file in <code>.\/pico_runs<\/code>, including code, stdout, stderr, status and duration.<\/p>\n\n\n<p class=\"wp-block-paragraph wp-block-paragraph\" style=\"\">The AI can then analyse those logs to learn what worked, what failed, and why.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n<h2 class=\"wp-block-heading\" id=\"hello-led\">Hello, LED<\/h2>\n\n\n<pre class=\"wp-block-code\"><div class=\"copy-to-clipboard\">\n<span>Copied!<\/span><button class=\"click-to-copy-button\" title=\"Copy to clipboard\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" viewbox=\"0 0 32 32\" stroke=\"currentcolor\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\" width=\"24\" height=\"24\" fill=\"none\">\n  <path d=\"M12.9975 10.7499L11.7475 10.7499C10.6429 10.7499 9.74747 11.6453 9.74747 12.7499L9.74747 21.2499C9.74747 22.3544 10.6429 23.2499 11.7475 23.2499L20.2475 23.2499C21.352 23.2499 22.2475 22.3544 22.2475 21.2499L22.2475 12.7499C22.2475 11.6453 21.352 10.7499 20.2475 10.7499L18.9975 10.7499Z\"><\/path>\n  <path d=\"M17.9975 12.2499L13.9975 12.2499C13.4452 12.2499 12.9975 11.8022 12.9975 11.2499L12.9975 9.74988C12.9975 9.19759 13.4452 8.74988 13.9975 8.74988L17.9975 8.74988C18.5498 8.74988 18.9975 9.19759 18.9975 9.74988L18.9975 11.2499C18.9975 11.8022 18.5498 12.2499 17.9975 12.2499Z\"><\/path>\n  <path d=\"M13.7475 16.2499L18.2475 16.2499\"><\/path>\n  <path d=\"M13.7475 19.2499L18.2475 19.2499\"><\/path>\n<\/svg><\/button><textarea>curl -X POST http:\/\/cm5.ipaddress:8000\/pico\/runs\/exec_snippet \\\n  -H \"Content-Type: application\/json\" \\\n  -d '{\n    \"code\": \"import machine, time\\nled = machine.Pin(16, machine.Pin.OUT)\\nled.value(1)\\nprint(\\\"LED ON\\\")\\ntime.sleep(1)\\nled.value(0)\\nprint(\\\"LED OFF\\\")\",\n    \"timeout\": 3.0\n  }'<\/textarea>\n<\/div><code>curl -X POST http:\/\/cm5.ipaddress:8000\/pico\/runs\/exec_snippet \\\n  -H \"Content-Type: application\/json\" \\\n  -d '{\n    \"code\": \"import machine, time\\nled = machine.Pin(16, machine.Pin.OUT)\\nled.value(1)\\nprint(\\\"LED ON\\\")\\ntime.sleep(1)\\nled.value(0)\\nprint(\\\"LED OFF\\\")\",\n    \"timeout\": 3.0\n  }'\n<\/code><\/pre>\n\n\n<p class=\"wp-block-paragraph wp-block-paragraph\" style=\"\">Result:<\/p>\n\n\n<pre class=\"wp-block-code\"><div class=\"copy-to-clipboard\">\n<span>Copied!<\/span><button class=\"click-to-copy-button\" title=\"Copy to clipboard\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" viewbox=\"0 0 32 32\" stroke=\"currentcolor\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\" width=\"24\" height=\"24\" fill=\"none\">\n  <path d=\"M12.9975 10.7499L11.7475 10.7499C10.6429 10.7499 9.74747 11.6453 9.74747 12.7499L9.74747 21.2499C9.74747 22.3544 10.6429 23.2499 11.7475 23.2499L20.2475 23.2499C21.352 23.2499 22.2475 22.3544 22.2475 21.2499L22.2475 12.7499C22.2475 11.6453 21.352 10.7499 20.2475 10.7499L18.9975 10.7499Z\"><\/path>\n  <path d=\"M17.9975 12.2499L13.9975 12.2499C13.4452 12.2499 12.9975 11.8022 12.9975 11.2499L12.9975 9.74988C12.9975 9.19759 13.4452 8.74988 13.9975 8.74988L17.9975 8.74988C18.5498 8.74988 18.9975 9.19759 18.9975 9.74988L18.9975 11.2499C18.9975 11.8022 18.5498 12.2499 17.9975 12.2499Z\"><\/path>\n  <path d=\"M13.7475 16.2499L18.2475 16.2499\"><\/path>\n  <path d=\"M13.7475 19.2499L18.2475 19.2499\"><\/path>\n<\/svg><\/button><textarea>{\n  \"ok\": true,\n  \"status\": \"success\",\n  \"stdout\": \"LED ON\\nLED OFF\\n\",\n  \"duration_ms\": 1012.5\n}<\/textarea>\n<\/div><code>{\n  \"ok\": true,\n  \"status\": \"success\",\n  \"stdout\": \"LED ON\\nLED OFF\\n\",\n  \"duration_ms\": 1012.5\n}\n<\/code><\/pre>\n\n\n<p class=\"wp-block-paragraph wp-block-paragraph\" style=\"\">A real LED just blinked because of a JSON request.<br>And that tiny event is where <em>machine learning meets machine doing<\/em>.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n<h2 class=\"wp-block-heading\" id=\"deploying-code-as-files\">Deploying Code as Files<\/h2>\n\n\n<p class=\"wp-block-paragraph wp-block-paragraph\" style=\"\"><code>PUT \/pico\/files<\/code> uploads a file:<\/p>\n\n\n<pre class=\"wp-block-code\"><div class=\"copy-to-clipboard\">\n<span>Copied!<\/span><button class=\"click-to-copy-button\" title=\"Copy to clipboard\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" viewbox=\"0 0 32 32\" stroke=\"currentcolor\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\" width=\"24\" height=\"24\" fill=\"none\">\n  <path d=\"M12.9975 10.7499L11.7475 10.7499C10.6429 10.7499 9.74747 11.6453 9.74747 12.7499L9.74747 21.2499C9.74747 22.3544 10.6429 23.2499 11.7475 23.2499L20.2475 23.2499C21.352 23.2499 22.2475 22.3544 22.2475 21.2499L22.2475 12.7499C22.2475 11.6453 21.352 10.7499 20.2475 10.7499L18.9975 10.7499Z\"><\/path>\n  <path d=\"M17.9975 12.2499L13.9975 12.2499C13.4452 12.2499 12.9975 11.8022 12.9975 11.2499L12.9975 9.74988C12.9975 9.19759 13.4452 8.74988 13.9975 8.74988L17.9975 8.74988C18.5498 8.74988 18.9975 9.19759 18.9975 9.74988L18.9975 11.2499C18.9975 11.8022 18.5498 12.2499 17.9975 12.2499Z\"><\/path>\n  <path d=\"M13.7475 16.2499L18.2475 16.2499\"><\/path>\n  <path d=\"M13.7475 19.2499L18.2475 19.2499\"><\/path>\n<\/svg><\/button><textarea>curl -X PUT http:\/\/cm5.ipaddress:8000\/pico\/files \\\n  -H \"Content-Type: application\/json\" \\\n  -d '{\n    \"path\": \":experiments\/led_test1.py\",\n    \"content\": \"from machine import Pin\\nimport time\\nled = Pin(16, Pin.OUT)\\nled.value(1)\\ntime.sleep(1)\\nled.value(0)\\n\"\n  }'<\/textarea>\n<\/div><code>curl -X PUT http:\/\/cm5.ipaddress:8000\/pico\/files \\\n  -H \"Content-Type: application\/json\" \\\n  -d '{\n    \"path\": \":experiments\/led_test1.py\",\n    \"content\": \"from machine import Pin\\nimport time\\nled = Pin(16, Pin.OUT)\\nled.value(1)\\ntime.sleep(1)\\nled.value(0)\\n\"\n  }'\n<\/code><\/pre>\n\n\n<p class=\"wp-block-paragraph wp-block-paragraph\" style=\"\">Check on device:<\/p>\n\n\n<pre class=\"wp-block-code\"><div class=\"copy-to-clipboard\">\n<span>Copied!<\/span><button class=\"click-to-copy-button\" title=\"Copy to clipboard\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" viewbox=\"0 0 32 32\" stroke=\"currentcolor\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\" width=\"24\" height=\"24\" fill=\"none\">\n  <path d=\"M12.9975 10.7499L11.7475 10.7499C10.6429 10.7499 9.74747 11.6453 9.74747 12.7499L9.74747 21.2499C9.74747 22.3544 10.6429 23.2499 11.7475 23.2499L20.2475 23.2499C21.352 23.2499 22.2475 22.3544 22.2475 21.2499L22.2475 12.7499C22.2475 11.6453 21.352 10.7499 20.2475 10.7499L18.9975 10.7499Z\"><\/path>\n  <path d=\"M17.9975 12.2499L13.9975 12.2499C13.4452 12.2499 12.9975 11.8022 12.9975 11.2499L12.9975 9.74988C12.9975 9.19759 13.4452 8.74988 13.9975 8.74988L17.9975 8.74988C18.5498 8.74988 18.9975 9.19759 18.9975 9.74988L18.9975 11.2499C18.9975 11.8022 18.5498 12.2499 17.9975 12.2499Z\"><\/path>\n  <path d=\"M13.7475 16.2499L18.2475 16.2499\"><\/path>\n  <path d=\"M13.7475 19.2499L18.2475 19.2499\"><\/path>\n<\/svg><\/button><textarea>mpremote connect auto fs ls experiments<\/textarea>\n<\/div><code>mpremote connect auto fs ls experiments\n<\/code><\/pre>\n\n\n<p class=\"wp-block-paragraph wp-block-paragraph\" style=\"\">And execute via:<\/p>\n\n\n<pre class=\"wp-block-code\"><div class=\"copy-to-clipboard\">\n<span>Copied!<\/span><button class=\"click-to-copy-button\" title=\"Copy to clipboard\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" viewbox=\"0 0 32 32\" stroke=\"currentcolor\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\" width=\"24\" height=\"24\" fill=\"none\">\n  <path d=\"M12.9975 10.7499L11.7475 10.7499C10.6429 10.7499 9.74747 11.6453 9.74747 12.7499L9.74747 21.2499C9.74747 22.3544 10.6429 23.2499 11.7475 23.2499L20.2475 23.2499C21.352 23.2499 22.2475 22.3544 22.2475 21.2499L22.2475 12.7499C22.2475 11.6453 21.352 10.7499 20.2475 10.7499L18.9975 10.7499Z\"><\/path>\n  <path d=\"M17.9975 12.2499L13.9975 12.2499C13.4452 12.2499 12.9975 11.8022 12.9975 11.2499L12.9975 9.74988C12.9975 9.19759 13.4452 8.74988 13.9975 8.74988L17.9975 8.74988C18.5498 8.74988 18.9975 9.19759 18.9975 9.74988L18.9975 11.2499C18.9975 11.8022 18.5498 12.2499 17.9975 12.2499Z\"><\/path>\n  <path d=\"M13.7475 16.2499L18.2475 16.2499\"><\/path>\n  <path d=\"M13.7475 19.2499L18.2475 19.2499\"><\/path>\n<\/svg><\/button><textarea>exec(open(\"experiments\/led_test1.py\").read(), {})<\/textarea>\n<\/div><code>exec(open(\"experiments\/led_test1.py\").read(), )\n<\/code><\/pre>\n\n\n<p class=\"wp-block-paragraph wp-block-paragraph\" style=\"\">All remotely managed, fully logged.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n<h2 class=\"wp-block-heading\" id=\"demo-led-oled-e2809csose2809d\">Demo: LED + OLED &ldquo;SOS&rdquo;<\/h2>\n\n\n<pre class=\"wp-block-code\"><div class=\"copy-to-clipboard\">\n<span>Copied!<\/span><button class=\"click-to-copy-button\" title=\"Copy to clipboard\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" viewbox=\"0 0 32 32\" stroke=\"currentcolor\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\" width=\"24\" height=\"24\" fill=\"none\">\n  <path d=\"M12.9975 10.7499L11.7475 10.7499C10.6429 10.7499 9.74747 11.6453 9.74747 12.7499L9.74747 21.2499C9.74747 22.3544 10.6429 23.2499 11.7475 23.2499L20.2475 23.2499C21.352 23.2499 22.2475 22.3544 22.2475 21.2499L22.2475 12.7499C22.2475 11.6453 21.352 10.7499 20.2475 10.7499L18.9975 10.7499Z\"><\/path>\n  <path d=\"M17.9975 12.2499L13.9975 12.2499C13.4452 12.2499 12.9975 11.8022 12.9975 11.2499L12.9975 9.74988C12.9975 9.19759 13.4452 8.74988 13.9975 8.74988L17.9975 8.74988C18.5498 8.74988 18.9975 9.19759 18.9975 9.74988L18.9975 11.2499C18.9975 11.8022 18.5498 12.2499 17.9975 12.2499Z\"><\/path>\n  <path d=\"M13.7475 16.2499L18.2475 16.2499\"><\/path>\n  <path d=\"M13.7475 19.2499L18.2475 19.2499\"><\/path>\n<\/svg><\/button><textarea>curl -X POST http:\/\/cm5.ipaddress:8000\/pico\/runs\/exec_snippet \\\n  -H \"Content-Type: application\/json\" \\\n  -d '{\n  \"code\": \"from machine import Pin, SoftI2C\\nimport ssd1306, time\\n\\nled = Pin(16, Pin.OUT)\\ni2c = SoftI2C(scl=Pin(15), sda=Pin(14))\\noled = ssd1306.SSD1306_I2C(128, 64, i2c)\\n\\n# Morse helpers\\ndef dot(): led(1); time.sleep(0.2); led(0); time.sleep(0.2)\\ndef dash(): led(1); time.sleep(0.6); led(0); time.sleep(0.2)\\n\\ndef sos():\\n  for ch in ['S','O','S']:\\n    (dot,dash)[ch=='O'](); (dot,dash)[ch=='O'](); (dot,dash)[ch=='O'](); time.sleep(0.4)\\n\\noled.fill(0); oled.text('SOS',45,10); oled.show()\\nsos()\\noled.fill(0); oled.text('DONE',40,30); oled.show()\",\n  \"timeout\": 10.0\n}'<\/textarea>\n<\/div><code>curl -X POST http:\/\/cm5.ipaddress:8000\/pico\/runs\/exec_snippet \\\n  -H \"Content-Type: application\/json\" \\\n  -d '{\n  \"code\": \"from machine import Pin, SoftI2C\\nimport ssd1306, time\\n\\nled = Pin(16, Pin.OUT)\\ni2c = SoftI2C(scl=Pin(15), sda=Pin(14))\\noled = ssd1306.SSD1306_I2C(128, 64, i2c)\\n\\n# Morse helpers\\ndef dot(): led(1); time.sleep(0.2); led(0); time.sleep(0.2)\\ndef dash(): led(1); time.sleep(0.6); led(0); time.sleep(0.2)\\n\\ndef sos():\\n  for ch in ['S','O','S']:\\n    (dot,dash)[ch=='O'](); (dot,dash)[ch=='O'](); (dot,dash)[ch=='O'](); time.sleep(0.4)\\n\\noled.fill(0); oled.text('SOS',45,10); oled.show()\\nsos()\\noled.fill(0); oled.text('DONE',40,30); oled.show()\",\n  \"timeout\": 10.0\n}'\n<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n<h2 class=\"wp-block-heading\" id=\"continuous-behavior-via-main-py\">Continuous Behavior via <code>main.py<\/code>\n<\/h2>\n\n\n<p class=\"wp-block-paragraph wp-block-paragraph\" style=\"\">Upload a <code>main.py<\/code> with a breathing LED and progress bar:<\/p>\n\n\n<pre class=\"wp-block-code\"><div class=\"copy-to-clipboard\">\n<span>Copied!<\/span><button class=\"click-to-copy-button\" title=\"Copy to clipboard\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" viewbox=\"0 0 32 32\" stroke=\"currentcolor\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\" width=\"24\" height=\"24\" fill=\"none\">\n  <path d=\"M12.9975 10.7499L11.7475 10.7499C10.6429 10.7499 9.74747 11.6453 9.74747 12.7499L9.74747 21.2499C9.74747 22.3544 10.6429 23.2499 11.7475 23.2499L20.2475 23.2499C21.352 23.2499 22.2475 22.3544 22.2475 21.2499L22.2475 12.7499C22.2475 11.6453 21.352 10.7499 20.2475 10.7499L18.9975 10.7499Z\"><\/path>\n  <path d=\"M17.9975 12.2499L13.9975 12.2499C13.4452 12.2499 12.9975 11.8022 12.9975 11.2499L12.9975 9.74988C12.9975 9.19759 13.4452 8.74988 13.9975 8.74988L17.9975 8.74988C18.5498 8.74988 18.9975 9.19759 18.9975 9.74988L18.9975 11.2499C18.9975 11.8022 18.5498 12.2499 17.9975 12.2499Z\"><\/path>\n  <path d=\"M13.7475 16.2499L18.2475 16.2499\"><\/path>\n  <path d=\"M13.7475 19.2499L18.2475 19.2499\"><\/path>\n<\/svg><\/button><textarea>curl -X PUT http:\/\/cm5.ipaddress:8000\/pico\/files \\\n  -H \"Content-Type: application\/json\" \\\n  -d '{\"path\":\":main.py\",\"content\":\"<...code omitted for brevity...>\"}'\ncurl -X POST http:\/\/cm5.ipaddress:8000\/pico\/reset -H \"Content-Type: application\/json\" -d '{}'<\/...code><\/textarea>\n<\/div><code>curl -X PUT http:\/\/cm5.ipaddress:8000\/pico\/files \\\n  -H \"Content-Type: application\/json\" \\\n  -d '{\"path\":\":main.py\",\"content\":\"&lt;...code omitted for brevity...&gt;\"}'\ncurl -X POST http:\/\/cm5.ipaddress:8000\/pico\/reset -H \"Content-Type: application\/json\" -d ''\n<\/code><\/pre>\n\n\n<p class=\"wp-block-paragraph wp-block-paragraph\" style=\"\">Now the Pico boots autonomously, displaying a &ldquo;breathing&rdquo; LED and progress bar &mdash; a visual heartbeat.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n<h2 class=\"wp-block-heading\" id=\"fast-vs-deep-perception\">Fast vs Deep Perception<\/h2>\n\n\n<p class=\"wp-block-paragraph wp-block-paragraph\" style=\"\">Once the physical control layer works, we add sight and meaning.<\/p>\n\n\n<h3 class=\"wp-block-heading\" id=\"1-edge-perception-e28094-cm-5-yolo\">1. Edge Perception &mdash; CM-5 + YOLO<\/h3>\n\n\n<p class=\"wp-block-paragraph wp-block-paragraph\" style=\"\">The CM-5 continuously processes its Picam feed using a lightweight YOLO model.<br>It looks for <em>triggers<\/em> like a cat, a human, movement, or something new in the room.<br>Only when an event is interesting enough does it escalate.<\/p>\n\n\n<h3 class=\"wp-block-heading\" id=\"2-deep-scene-understanding-e28094-rtx-5090-llm-studio\">2. Deep Scene Understanding &mdash; RTX 5090 + LLM Studio<\/h3>\n\n\n<p class=\"wp-block-paragraph wp-block-paragraph\" style=\"\">When a frame is promoted, it&rsquo;s sent to a GPU box running LLM Studio.<br>There, a large model performs full scene parsing:<\/p>\n\n\n<ul class=\"wp-block-list wp-block-list\">\n<li>Who&rsquo;s in the room, what are they doing?<\/li>\n\n\n\n<li>What objects, text, or interactions exist?<\/li>\n\n\n\n<li>What&rsquo;s changed since the last observation?<\/li>\n<\/ul>\n\n\n<p class=\"wp-block-paragraph wp-block-paragraph\" style=\"\">The output becomes structured world data &mdash; not just <em>pixels<\/em>, but <em>facts<\/em>:<\/p>\n\n\n<pre class=\"wp-block-code\"><div class=\"copy-to-clipboard\">\n<span>Copied!<\/span><button class=\"click-to-copy-button\" title=\"Copy to clipboard\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" viewbox=\"0 0 32 32\" stroke=\"currentcolor\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\" width=\"24\" height=\"24\" fill=\"none\">\n  <path d=\"M12.9975 10.7499L11.7475 10.7499C10.6429 10.7499 9.74747 11.6453 9.74747 12.7499L9.74747 21.2499C9.74747 22.3544 10.6429 23.2499 11.7475 23.2499L20.2475 23.2499C21.352 23.2499 22.2475 22.3544 22.2475 21.2499L22.2475 12.7499C22.2475 11.6453 21.352 10.7499 20.2475 10.7499L18.9975 10.7499Z\"><\/path>\n  <path d=\"M17.9975 12.2499L13.9975 12.2499C13.4452 12.2499 12.9975 11.8022 12.9975 11.2499L12.9975 9.74988C12.9975 9.19759 13.4452 8.74988 13.9975 8.74988L17.9975 8.74988C18.5498 8.74988 18.9975 9.19759 18.9975 9.74988L18.9975 11.2499C18.9975 11.8022 18.5498 12.2499 17.9975 12.2499Z\"><\/path>\n  <path d=\"M13.7475 16.2499L18.2475 16.2499\"><\/path>\n  <path d=\"M13.7475 19.2499L18.2475 19.2499\"><\/path>\n<\/svg><\/button><textarea>{\n  \"time\": \"2025-11-07T19:32:00Z\",\n  \"entities\": [\n    {\"type\":\"person\",\"count\":2,\"actions\":[\"typing\",\"talking\"]},\n    {\"type\":\"cat\",\"count\":1,\"action\":\"sleeping\"}\n  ],\n  \"objects\":[\"desk\",\"keyboard\",\"monitor\",\"coffee_cup\"],\n  \"summary\":\"Two people working at a desk with a cat nearby.\"\n}<\/textarea>\n<\/div><code>{\n  \"time\": \"2025-11-07T19:32:00Z\",\n  \"entities\": [\n    {\"type\":\"person\",\"count\":2,\"actions\":[\"typing\",\"talking\"]},\n    {\"type\":\"cat\",\"count\":1,\"action\":\"sleeping\"}\n  ],\n  \"objects\":[\"desk\",\"keyboard\",\"monitor\",\"coffee_cup\"],\n  \"summary\":\"Two people working at a desk with a cat nearby.\"\n}\n<\/code><\/pre>\n\n\n<p class=\"wp-block-paragraph wp-block-paragraph\" style=\"\">This <strong>world model<\/strong> lives as a JSON state the AI can query, reason over, and extend.<br>The CM-5 thus acts as a <strong>bouncer<\/strong>, and the RTX 5090 as the <strong>scribe and philosopher<\/strong>.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n<h2 class=\"wp-block-heading\" id=\"ephemeral-micro-apps-on-the-pico\">Ephemeral Micro-Apps on the Pico<\/h2>\n\n\n<p class=\"wp-block-paragraph wp-block-paragraph\" style=\"\">In traditional robotics you flash one giant firmware with all libraries baked in.<br>In this design, the Pico becomes a <strong>throw-away runtime<\/strong>.<\/p>\n\n\n<p class=\"wp-block-paragraph wp-block-paragraph\" style=\"\">The AGX Orin (the planner) can command the CM-5:<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\"><p class=\"wp-block-paragraph wp-block-paragraph\" style=\"\">&ldquo;Deploy this 3 KB script to the Pico, connect to that Wi-Fi,<br>read those sensors, send data back, then self-wipe.&rdquo;<\/p>\n<\/blockquote>\n\n\n<p class=\"wp-block-paragraph wp-block-paragraph\" style=\"\">Each mission uses a new, minimal piece of code:<\/p>\n\n\n<ul class=\"wp-block-list wp-block-list\">\n<li>No heavy motor or display libraries unless required.<\/li>\n\n\n\n<li>Lower memory footprint.<\/li>\n\n\n\n<li>Easier reasoning for the AI (&ldquo;I only need code for this goal&rdquo;).<\/li>\n\n\n\n<li>Higher security (no permanent broad-capability firmware).<\/li>\n<\/ul>\n\n\n<p class=\"wp-block-paragraph wp-block-paragraph\" style=\"\">It&rsquo;s like micro-containers for embedded devices &mdash; single-purpose, temporary, and fully auditable.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n<h2 class=\"wp-block-heading\" id=\"autonomous-coordination\">Autonomous Coordination<\/h2>\n\n\n<p class=\"wp-block-paragraph wp-block-paragraph\" style=\"\">The full system ties together like this:<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th>Role<\/th><th>Hardware<\/th><th>Responsibility<\/th><\/tr><\/thead><tbody><tr><td><strong>Vision \/ Perception<\/strong><\/td><td>CM-5 + Picam<\/td><td>Detect motion, cats, people; decide when to escalate<\/td><\/tr><tr><td><strong>Deep Analysis<\/strong><\/td><td>RTX 5090 LLM Studio<\/td><td>Parse images in detail, update world model<\/td><\/tr><tr><td><strong>Planning \/ Orchestration<\/strong><\/td><td>AGX Orin<\/td><td>Decide where to go, which sensors to use, generate new Pico code<\/td><\/tr><tr><td><strong>Execution \/ Interface<\/strong><\/td><td>Pico W nodes<\/td><td>Run short-lived code snippets for local sensing or actuation<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n<p class=\"wp-block-paragraph wp-block-paragraph\" style=\"\">Even if the CM-5 is 100 km away, the Orin can drive it over VPN\/Wi-Fi,<br>and through it, deploy fresh code to local Pico nodes &mdash; dynamically exploring new networks or environments.<\/p>\n\n\n<p class=\"wp-block-paragraph wp-block-paragraph\" style=\"\">Over time the AI learns:<\/p>\n\n\n<ul class=\"wp-block-list wp-block-list\">\n<li>which pins map to which hardware,<\/li>\n\n\n\n<li>which networks are reachable,<\/li>\n\n\n\n<li>what each sensor measures,<\/li>\n\n\n\n<li>and how to optimise its own code for speed, noise or accuracy.<\/li>\n<\/ul>\n\n\n<p class=\"wp-block-paragraph wp-block-paragraph\" style=\"\">It&rsquo;s a <strong>self-organising embedded ecosystem<\/strong>.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n<h2 class=\"wp-block-heading\" id=\"why-this-matters\">Why This Matters<\/h2>\n\n\n<p class=\"wp-block-paragraph wp-block-paragraph\" style=\"\">This isn&rsquo;t just about blinking LEDs, it&rsquo;s about building a living, programmable feedback loop between <em>thought<\/em> and <em>world<\/em>.<\/p>\n\n\n<ul class=\"wp-block-list wp-block-list\">\n<li>\n<strong>The AI writes code<\/strong> (agency).<\/li>\n\n\n\n<li>\n<strong>The hardware executes it<\/strong> (embodiment).<\/li>\n\n\n\n<li>\n<strong>Sensors and cameras respond<\/strong> (perception).<\/li>\n\n\n\n<li>\n<strong>Logs and analysis refine the model<\/strong> (learning).<\/li>\n<\/ul>\n\n\n<p class=\"wp-block-paragraph wp-block-paragraph\" style=\"\">And the entire chain is open, inspectable, and under your control.<\/p>\n\n\n<p class=\"wp-block-paragraph wp-block-paragraph\" style=\"\">Every new node, every run, every image adds to its understanding of reality until you no longer have a static device, but a small, distributed intelligence<br>that can <em>see, act, reflect, and adapt.<\/em><\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n<p class=\"wp-block-paragraph wp-block-paragraph\" style=\"\"><em>Next up: Part II &ndash; World Ingestion and Semantic Mapping,<br>where we&rsquo;ll show how the AI merges vision, sensor streams and logs into one evolving world model.<\/em><\/p>\n\n\n<p class=\"wp-block-paragraph wp-block-paragraph\" style=\"\">I know, you want more code and see it do what it does. If I have time, I will clean up the github repo. But as soon as things work, I change everything and add something new. Everything is always a work in progress&#8230; <\/p>\n","protected":false},"excerpt":{"rendered":"<p>Most &ldquo;AI + robotics&rdquo; posts are still simulations and slides.This one isn&rsquo;t. This is the story of how we wired up a Raspberry Pi CM-5, a Raspberry Pi Pico W (running MicroPython), a small OLED display, a green LED, a camera, and an RTX 5090 into a system where: It&rsquo;s &ldquo;hello world&rdquo;, but instead of &hellip;<\/p>\n","protected":false},"author":1,"featured_media":625,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[28,16],"tags":[29,34],"class_list":["post-623","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-ai","category-tech-innovation","tag-ai","tag-python"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.9 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Teaching an AI to Program a Microcontroller - SystemDeveloper.NL<\/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.systemdeveloper.nl\/tech\/teaching-an-ai-to-program-a-microcontroller\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Teaching an AI to Program a Microcontroller - SystemDeveloper.NL\" \/>\n<meta property=\"og:description\" content=\"Most &ldquo;AI + robotics&rdquo; posts are still simulations and slides.This one isn&rsquo;t. This is the story of how we wired up a Raspberry Pi CM-5, a Raspberry Pi Pico W (running MicroPython), a small OLED display, a green LED, a camera, and an RTX 5090 into a system where: It&rsquo;s &ldquo;hello world&rdquo;, but instead of &hellip;\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.systemdeveloper.nl\/tech\/teaching-an-ai-to-program-a-microcontroller\/\" \/>\n<meta property=\"og:site_name\" content=\"SystemDeveloper.NL\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/quan.tora.16\" \/>\n<meta property=\"article:published_time\" content=\"2025-11-08T07:30:10+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-11-08T07:30:11+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.systemdeveloper.nl\/tech\/wp-content\/uploads\/2025\/11\/85cd4c93-969c-4886-a9ba-e421bdaefe2f-e1762586951387.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1024\" \/>\n\t<meta property=\"og:image:height\" content=\"683\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"John Timmer\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"John Timmer\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"5 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.systemdeveloper.nl\\\/tech\\\/teaching-an-ai-to-program-a-microcontroller\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.systemdeveloper.nl\\\/tech\\\/teaching-an-ai-to-program-a-microcontroller\\\/\"},\"author\":{\"name\":\"John Timmer\",\"@id\":\"https:\\\/\\\/www.systemdeveloper.nl\\\/tech\\\/#\\\/schema\\\/person\\\/5760c2ed5300c56d8ef01dfb00a9763b\"},\"headline\":\"Teaching an AI to Program a Microcontroller\",\"datePublished\":\"2025-11-08T07:30:10+00:00\",\"dateModified\":\"2025-11-08T07:30:11+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.systemdeveloper.nl\\\/tech\\\/teaching-an-ai-to-program-a-microcontroller\\\/\"},\"wordCount\":911,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/www.systemdeveloper.nl\\\/tech\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/www.systemdeveloper.nl\\\/tech\\\/teaching-an-ai-to-program-a-microcontroller\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.systemdeveloper.nl\\\/tech\\\/wp-content\\\/uploads\\\/2025\\\/11\\\/85cd4c93-969c-4886-a9ba-e421bdaefe2f-e1762586951387.png\",\"keywords\":[\"AI\",\"Python\"],\"articleSection\":[\"AI\",\"Tech Innovation\"],\"inLanguage\":\"en\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.systemdeveloper.nl\\\/tech\\\/teaching-an-ai-to-program-a-microcontroller\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.systemdeveloper.nl\\\/tech\\\/teaching-an-ai-to-program-a-microcontroller\\\/\",\"url\":\"https:\\\/\\\/www.systemdeveloper.nl\\\/tech\\\/teaching-an-ai-to-program-a-microcontroller\\\/\",\"name\":\"Teaching an AI to Program a Microcontroller - SystemDeveloper.NL\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.systemdeveloper.nl\\\/tech\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.systemdeveloper.nl\\\/tech\\\/teaching-an-ai-to-program-a-microcontroller\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.systemdeveloper.nl\\\/tech\\\/teaching-an-ai-to-program-a-microcontroller\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.systemdeveloper.nl\\\/tech\\\/wp-content\\\/uploads\\\/2025\\\/11\\\/85cd4c93-969c-4886-a9ba-e421bdaefe2f-e1762586951387.png\",\"datePublished\":\"2025-11-08T07:30:10+00:00\",\"dateModified\":\"2025-11-08T07:30:11+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.systemdeveloper.nl\\\/tech\\\/teaching-an-ai-to-program-a-microcontroller\\\/#breadcrumb\"},\"inLanguage\":\"en\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.systemdeveloper.nl\\\/tech\\\/teaching-an-ai-to-program-a-microcontroller\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en\",\"@id\":\"https:\\\/\\\/www.systemdeveloper.nl\\\/tech\\\/teaching-an-ai-to-program-a-microcontroller\\\/#primaryimage\",\"url\":\"https:\\\/\\\/www.systemdeveloper.nl\\\/tech\\\/wp-content\\\/uploads\\\/2025\\\/11\\\/85cd4c93-969c-4886-a9ba-e421bdaefe2f-e1762586951387.png\",\"contentUrl\":\"https:\\\/\\\/www.systemdeveloper.nl\\\/tech\\\/wp-content\\\/uploads\\\/2025\\\/11\\\/85cd4c93-969c-4886-a9ba-e421bdaefe2f-e1762586951387.png\",\"width\":1024,\"height\":683},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.systemdeveloper.nl\\\/tech\\\/teaching-an-ai-to-program-a-microcontroller\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.systemdeveloper.nl\\\/tech\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Teaching an AI to Program a Microcontroller\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.systemdeveloper.nl\\\/tech\\\/#website\",\"url\":\"https:\\\/\\\/www.systemdeveloper.nl\\\/tech\\\/\",\"name\":\"www.systemdeveloper.nl\",\"description\":\"NextGen IT\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.systemdeveloper.nl\\\/tech\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.systemdeveloper.nl\\\/tech\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.systemdeveloper.nl\\\/tech\\\/#organization\",\"name\":\"www.systemdeveloper.nl\",\"url\":\"https:\\\/\\\/www.systemdeveloper.nl\\\/tech\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en\",\"@id\":\"https:\\\/\\\/www.systemdeveloper.nl\\\/tech\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/www.systemdeveloper.nl\\\/tech\\\/wp-content\\\/uploads\\\/2024\\\/11\\\/qt-logo.png\",\"contentUrl\":\"https:\\\/\\\/www.systemdeveloper.nl\\\/tech\\\/wp-content\\\/uploads\\\/2024\\\/11\\\/qt-logo.png\",\"width\":1346,\"height\":1230,\"caption\":\"www.systemdeveloper.nl\"},\"image\":{\"@id\":\"https:\\\/\\\/www.systemdeveloper.nl\\\/tech\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/www.facebook.com\\\/quan.tora.16\"]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.systemdeveloper.nl\\\/tech\\\/#\\\/schema\\\/person\\\/5760c2ed5300c56d8ef01dfb00a9763b\",\"name\":\"John Timmer\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en\",\"@id\":\"https:\\\/\\\/www.systemdeveloper.nl\\\/tech\\\/wp-content\\\/uploads\\\/2024\\\/11\\\/cropped-D6E27035-6864-4270-8D72-0D8C0C59F370-96x96.jpeg\",\"url\":\"https:\\\/\\\/www.systemdeveloper.nl\\\/tech\\\/wp-content\\\/uploads\\\/2024\\\/11\\\/cropped-D6E27035-6864-4270-8D72-0D8C0C59F370-96x96.jpeg\",\"contentUrl\":\"https:\\\/\\\/www.systemdeveloper.nl\\\/tech\\\/wp-content\\\/uploads\\\/2024\\\/11\\\/cropped-D6E27035-6864-4270-8D72-0D8C0C59F370-96x96.jpeg\",\"caption\":\"John Timmer\"},\"sameAs\":[\"https:\\\/\\\/www.systemdeveloper.nl\\\/tech\"],\"url\":\"https:\\\/\\\/www.systemdeveloper.nl\\\/tech\\\/author\\\/admin\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Teaching an AI to Program a Microcontroller - SystemDeveloper.NL","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.systemdeveloper.nl\/tech\/teaching-an-ai-to-program-a-microcontroller\/","og_locale":"en_US","og_type":"article","og_title":"Teaching an AI to Program a Microcontroller - SystemDeveloper.NL","og_description":"Most &ldquo;AI + robotics&rdquo; posts are still simulations and slides.This one isn&rsquo;t. This is the story of how we wired up a Raspberry Pi CM-5, a Raspberry Pi Pico W (running MicroPython), a small OLED display, a green LED, a camera, and an RTX 5090 into a system where: It&rsquo;s &ldquo;hello world&rdquo;, but instead of &hellip;","og_url":"https:\/\/www.systemdeveloper.nl\/tech\/teaching-an-ai-to-program-a-microcontroller\/","og_site_name":"SystemDeveloper.NL","article_publisher":"https:\/\/www.facebook.com\/quan.tora.16","article_published_time":"2025-11-08T07:30:10+00:00","article_modified_time":"2025-11-08T07:30:11+00:00","og_image":[{"width":1024,"height":683,"url":"https:\/\/www.systemdeveloper.nl\/tech\/wp-content\/uploads\/2025\/11\/85cd4c93-969c-4886-a9ba-e421bdaefe2f-e1762586951387.png","type":"image\/png"}],"author":"John Timmer","twitter_card":"summary_large_image","twitter_misc":{"Written by":"John Timmer","Est. reading time":"5 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.systemdeveloper.nl\/tech\/teaching-an-ai-to-program-a-microcontroller\/#article","isPartOf":{"@id":"https:\/\/www.systemdeveloper.nl\/tech\/teaching-an-ai-to-program-a-microcontroller\/"},"author":{"name":"John Timmer","@id":"https:\/\/www.systemdeveloper.nl\/tech\/#\/schema\/person\/5760c2ed5300c56d8ef01dfb00a9763b"},"headline":"Teaching an AI to Program a Microcontroller","datePublished":"2025-11-08T07:30:10+00:00","dateModified":"2025-11-08T07:30:11+00:00","mainEntityOfPage":{"@id":"https:\/\/www.systemdeveloper.nl\/tech\/teaching-an-ai-to-program-a-microcontroller\/"},"wordCount":911,"commentCount":0,"publisher":{"@id":"https:\/\/www.systemdeveloper.nl\/tech\/#organization"},"image":{"@id":"https:\/\/www.systemdeveloper.nl\/tech\/teaching-an-ai-to-program-a-microcontroller\/#primaryimage"},"thumbnailUrl":"https:\/\/www.systemdeveloper.nl\/tech\/wp-content\/uploads\/2025\/11\/85cd4c93-969c-4886-a9ba-e421bdaefe2f-e1762586951387.png","keywords":["AI","Python"],"articleSection":["AI","Tech Innovation"],"inLanguage":"en","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.systemdeveloper.nl\/tech\/teaching-an-ai-to-program-a-microcontroller\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.systemdeveloper.nl\/tech\/teaching-an-ai-to-program-a-microcontroller\/","url":"https:\/\/www.systemdeveloper.nl\/tech\/teaching-an-ai-to-program-a-microcontroller\/","name":"Teaching an AI to Program a Microcontroller - SystemDeveloper.NL","isPartOf":{"@id":"https:\/\/www.systemdeveloper.nl\/tech\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.systemdeveloper.nl\/tech\/teaching-an-ai-to-program-a-microcontroller\/#primaryimage"},"image":{"@id":"https:\/\/www.systemdeveloper.nl\/tech\/teaching-an-ai-to-program-a-microcontroller\/#primaryimage"},"thumbnailUrl":"https:\/\/www.systemdeveloper.nl\/tech\/wp-content\/uploads\/2025\/11\/85cd4c93-969c-4886-a9ba-e421bdaefe2f-e1762586951387.png","datePublished":"2025-11-08T07:30:10+00:00","dateModified":"2025-11-08T07:30:11+00:00","breadcrumb":{"@id":"https:\/\/www.systemdeveloper.nl\/tech\/teaching-an-ai-to-program-a-microcontroller\/#breadcrumb"},"inLanguage":"en","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.systemdeveloper.nl\/tech\/teaching-an-ai-to-program-a-microcontroller\/"]}]},{"@type":"ImageObject","inLanguage":"en","@id":"https:\/\/www.systemdeveloper.nl\/tech\/teaching-an-ai-to-program-a-microcontroller\/#primaryimage","url":"https:\/\/www.systemdeveloper.nl\/tech\/wp-content\/uploads\/2025\/11\/85cd4c93-969c-4886-a9ba-e421bdaefe2f-e1762586951387.png","contentUrl":"https:\/\/www.systemdeveloper.nl\/tech\/wp-content\/uploads\/2025\/11\/85cd4c93-969c-4886-a9ba-e421bdaefe2f-e1762586951387.png","width":1024,"height":683},{"@type":"BreadcrumbList","@id":"https:\/\/www.systemdeveloper.nl\/tech\/teaching-an-ai-to-program-a-microcontroller\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.systemdeveloper.nl\/tech\/"},{"@type":"ListItem","position":2,"name":"Teaching an AI to Program a Microcontroller"}]},{"@type":"WebSite","@id":"https:\/\/www.systemdeveloper.nl\/tech\/#website","url":"https:\/\/www.systemdeveloper.nl\/tech\/","name":"www.systemdeveloper.nl","description":"NextGen IT","publisher":{"@id":"https:\/\/www.systemdeveloper.nl\/tech\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.systemdeveloper.nl\/tech\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en"},{"@type":"Organization","@id":"https:\/\/www.systemdeveloper.nl\/tech\/#organization","name":"www.systemdeveloper.nl","url":"https:\/\/www.systemdeveloper.nl\/tech\/","logo":{"@type":"ImageObject","inLanguage":"en","@id":"https:\/\/www.systemdeveloper.nl\/tech\/#\/schema\/logo\/image\/","url":"https:\/\/www.systemdeveloper.nl\/tech\/wp-content\/uploads\/2024\/11\/qt-logo.png","contentUrl":"https:\/\/www.systemdeveloper.nl\/tech\/wp-content\/uploads\/2024\/11\/qt-logo.png","width":1346,"height":1230,"caption":"www.systemdeveloper.nl"},"image":{"@id":"https:\/\/www.systemdeveloper.nl\/tech\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/quan.tora.16"]},{"@type":"Person","@id":"https:\/\/www.systemdeveloper.nl\/tech\/#\/schema\/person\/5760c2ed5300c56d8ef01dfb00a9763b","name":"John Timmer","image":{"@type":"ImageObject","inLanguage":"en","@id":"https:\/\/www.systemdeveloper.nl\/tech\/wp-content\/uploads\/2024\/11\/cropped-D6E27035-6864-4270-8D72-0D8C0C59F370-96x96.jpeg","url":"https:\/\/www.systemdeveloper.nl\/tech\/wp-content\/uploads\/2024\/11\/cropped-D6E27035-6864-4270-8D72-0D8C0C59F370-96x96.jpeg","contentUrl":"https:\/\/www.systemdeveloper.nl\/tech\/wp-content\/uploads\/2024\/11\/cropped-D6E27035-6864-4270-8D72-0D8C0C59F370-96x96.jpeg","caption":"John Timmer"},"sameAs":["https:\/\/www.systemdeveloper.nl\/tech"],"url":"https:\/\/www.systemdeveloper.nl\/tech\/author\/admin\/"}]}},"_links":{"self":[{"href":"https:\/\/www.systemdeveloper.nl\/tech\/wp-json\/wp\/v2\/posts\/623","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.systemdeveloper.nl\/tech\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.systemdeveloper.nl\/tech\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.systemdeveloper.nl\/tech\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.systemdeveloper.nl\/tech\/wp-json\/wp\/v2\/comments?post=623"}],"version-history":[{"count":1,"href":"https:\/\/www.systemdeveloper.nl\/tech\/wp-json\/wp\/v2\/posts\/623\/revisions"}],"predecessor-version":[{"id":624,"href":"https:\/\/www.systemdeveloper.nl\/tech\/wp-json\/wp\/v2\/posts\/623\/revisions\/624"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.systemdeveloper.nl\/tech\/wp-json\/wp\/v2\/media\/625"}],"wp:attachment":[{"href":"https:\/\/www.systemdeveloper.nl\/tech\/wp-json\/wp\/v2\/media?parent=623"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.systemdeveloper.nl\/tech\/wp-json\/wp\/v2\/categories?post=623"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.systemdeveloper.nl\/tech\/wp-json\/wp\/v2\/tags?post=623"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}