{"id":16272,"date":"2020-05-20T20:47:43","date_gmt":"2020-05-21T00:47:43","guid":{"rendered":"https:\/\/scruss.com\/blog\/?p=16272"},"modified":"2026-02-10T19:11:54","modified_gmt":"2026-02-11T00:11:54","slug":"canaduino-stm32-boards-with-micropython","status":"publish","type":"post","link":"https:\/\/scruss.com\/blog\/2020\/05\/20\/canaduino-stm32-boards-with-micropython\/","title":{"rendered":"Canaduino STM32 boards with MicroPython"},"content":{"rendered":"\n<p><em><em>Volker Forster<\/em> at <a href=\"https:\/\/www.universal-solder.ca\/\">Universal Solder<\/a> was kind enough to send me a couple of these boards for free when I asked about availability. By way of thanks, I&#8217;m writing this article about what&#8217;s neat about these micro-controller boards<\/em>.<\/p>\n\n\n\n<figure class=\"wp-block-image aligncenter size-medium\"><img loading=\"lazy\" decoding=\"async\" width=\"240\" height=\"320\" src=\"https:\/\/scruss.com\/wordpress\/wp-content\/uploads\/2020\/05\/01-always_neat_packaging_from_universal_solder-240x320.jpg\" alt=\"\" class=\"wp-image-16279\" srcset=\"https:\/\/scruss.com\/wordpress\/wp-content\/uploads\/2020\/05\/01-always_neat_packaging_from_universal_solder-240x320.jpg 240w, https:\/\/scruss.com\/wordpress\/wp-content\/uploads\/2020\/05\/01-always_neat_packaging_from_universal_solder-769x1024.jpg 769w, https:\/\/scruss.com\/wordpress\/wp-content\/uploads\/2020\/05\/01-always_neat_packaging_from_universal_solder-120x160.jpg 120w, https:\/\/scruss.com\/wordpress\/wp-content\/uploads\/2020\/05\/01-always_neat_packaging_from_universal_solder-768x1023.jpg 768w, https:\/\/scruss.com\/wordpress\/wp-content\/uploads\/2020\/05\/01-always_neat_packaging_from_universal_solder.jpg 901w\" sizes=\"auto, (max-width: 240px) 100vw, 240px\" \/><figcaption class=\"wp-element-caption\">always neat packaging from Universal Solder<\/figcaption><\/figure>\n\n\n\n<p>Can I just say how nicely packaged Universal Solder&#8217;s own or customized products are? They want it to get to you, and they want it to work.<\/p>\n\n\n\n<p>I&#8217;d previously played around with Blue Pill and Black Pill boards with limited success. Yes, they&#8217;re cheap and powerful, but getting the toolchain to work reliably was <em>so<\/em> much work. So when I read about the WeAct STM32F411CEU6 board on the <a href=\"https:\/\/forum.micropython.org\/viewtopic.php?t=7154\">MicroPython forum<\/a>, I knew they&#8217;d be a much better bet.<\/p>\n\n\n\n<figure class=\"wp-block-image aligncenter size-medium\"><img loading=\"lazy\" decoding=\"async\" width=\"320\" height=\"240\" src=\"https:\/\/scruss.com\/wordpress\/wp-content\/uploads\/2020\/05\/06-canaduino_black_pill_carrier_board_with_stm32f411_and_battery_installed-320x240.jpg\" alt=\"\" class=\"wp-image-16274\" srcset=\"https:\/\/scruss.com\/wordpress\/wp-content\/uploads\/2020\/05\/06-canaduino_black_pill_carrier_board_with_stm32f411_and_battery_installed-320x240.jpg 320w, https:\/\/scruss.com\/wordpress\/wp-content\/uploads\/2020\/05\/06-canaduino_black_pill_carrier_board_with_stm32f411_and_battery_installed-1024x767.jpg 1024w, https:\/\/scruss.com\/wordpress\/wp-content\/uploads\/2020\/05\/06-canaduino_black_pill_carrier_board_with_stm32f411_and_battery_installed-160x120.jpg 160w, https:\/\/scruss.com\/wordpress\/wp-content\/uploads\/2020\/05\/06-canaduino_black_pill_carrier_board_with_stm32f411_and_battery_installed-768x575.jpg 768w, https:\/\/scruss.com\/wordpress\/wp-content\/uploads\/2020\/05\/06-canaduino_black_pill_carrier_board_with_stm32f411_and_battery_installed.jpg 1200w\" sizes=\"auto, (max-width: 320px) 100vw, 320px\" \/><figcaption class=\"wp-element-caption\">Canaduino Black Pill Carrier Board with STM32F411 (and battery) installed<\/figcaption><\/figure>\n\n\n\n<p>Volker sent me two different things:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>a couple of <a href=\"https:\/\/www.universal-solder.ca\/product\/stm32-pro-black-pill-stm32f411ceu6-128m-extra-flash-100mhz-512k-internal-flash-128k-ram-no-soldering\/\">specially-modified WeAct F411 boards<\/a> that work really well with MicroPython;<\/li>\n\n\n\n<li>a <a href=\"https:\/\/www.universal-solder.ca\/product\/stm32-screw-terminal-adapter-for-blue-pill-stm32f103-and-black-pill-stm32f4x1-diy-kit\/\">Canaduino screw terminal carrier board for the WeAct board<\/a>s.<\/li>\n<\/ul>\n\n\n\n<p>Let&#8217;s start with the STM32 Screw Terminal Adapter:<\/p>\n\n\n\n<figure class=\"wp-block-image aligncenter size-medium\"><img loading=\"lazy\" decoding=\"async\" width=\"320\" height=\"240\" src=\"https:\/\/scruss.com\/wordpress\/wp-content\/uploads\/2020\/05\/02-canaduino_black_pill_carrier_board_front-320x240.jpg\" alt=\"\" class=\"wp-image-16278\" srcset=\"https:\/\/scruss.com\/wordpress\/wp-content\/uploads\/2020\/05\/02-canaduino_black_pill_carrier_board_front-320x240.jpg 320w, https:\/\/scruss.com\/wordpress\/wp-content\/uploads\/2020\/05\/02-canaduino_black_pill_carrier_board_front-1024x768.jpg 1024w, https:\/\/scruss.com\/wordpress\/wp-content\/uploads\/2020\/05\/02-canaduino_black_pill_carrier_board_front-160x120.jpg 160w, https:\/\/scruss.com\/wordpress\/wp-content\/uploads\/2020\/05\/02-canaduino_black_pill_carrier_board_front-768x576.jpg 768w, https:\/\/scruss.com\/wordpress\/wp-content\/uploads\/2020\/05\/02-canaduino_black_pill_carrier_board_front.jpg 1200w\" sizes=\"auto, (max-width: 320px) 100vw, 320px\" \/><figcaption class=\"wp-element-caption\">Canaduino Black Pill Carrier Board (front)<\/figcaption><\/figure>\n\n\n\n<p>It&#8217;s a neat, solid board built on a black 1.6 mm thick PCB. Apart from the obvious screw terminals \u2014 essential for long-term industrial installations \u2014 it adds three handy features:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>a real-time clock battery. If you&#8217;re using a micro-controller for data logging, an RTC battery helps you keep timestamps accurate even if the device loses power. <\/li>\n\n\n\n<li><em>mounting holes!<\/em> This may seem a small thing, but if you can mount your micro-controller solidly, your project will look much more professional and last longer too.<\/li>\n\n\n\n<li>A 6\u201330 V DC regulator. Connect this voltage between Vin and GND and the regulator will keep the board happy. From the helpful graph on the back of the board, it doesn&#8217;t look as if things start getting efficient until around 12 V, but it&#8217;s really nice to have a choice.<\/li>\n<\/ul>\n\n\n\n<figure class=\"wp-block-image aligncenter size-medium\"><img loading=\"lazy\" decoding=\"async\" width=\"320\" height=\"240\" src=\"https:\/\/scruss.com\/wordpress\/wp-content\/uploads\/2020\/05\/03-canaduino_black_pill_carrier_board_back-320x240.jpg\" alt=\"\" class=\"wp-image-16277\" srcset=\"https:\/\/scruss.com\/wordpress\/wp-content\/uploads\/2020\/05\/03-canaduino_black_pill_carrier_board_back-320x240.jpg 320w, https:\/\/scruss.com\/wordpress\/wp-content\/uploads\/2020\/05\/03-canaduino_black_pill_carrier_board_back-1024x768.jpg 1024w, https:\/\/scruss.com\/wordpress\/wp-content\/uploads\/2020\/05\/03-canaduino_black_pill_carrier_board_back-160x120.jpg 160w, https:\/\/scruss.com\/wordpress\/wp-content\/uploads\/2020\/05\/03-canaduino_black_pill_carrier_board_back-768x576.jpg 768w, https:\/\/scruss.com\/wordpress\/wp-content\/uploads\/2020\/05\/03-canaduino_black_pill_carrier_board_back.jpg 1200w\" sizes=\"auto, (max-width: 320px) 100vw, 320px\" \/><figcaption class=\"wp-element-caption\">Canaduino Black Pill Carrier Board (back)<\/figcaption><\/figure>\n\n\n\n<p>I made a little slip-case for this board so it wouldn&#8217;t short out on the workbench. The project is here: <a href=\"https:\/\/www.thingiverse.com\/thing:4375286\">Canaduino STM32 Screw Terminal board tray<\/a> and you can download a snapshot here:<\/p>\n\n\n\n<div class=\"wp-block-file\"><a href=\"https:\/\/scruss.com\/wordpress\/wp-content\/uploads\/2020\/05\/CanaduinoSTM32ScrewTerminalboardtray.zip\">CanaduinoSTM32ScrewTerminalboardtray<\/a><a href=\"https:\/\/scruss.com\/wordpress\/wp-content\/uploads\/2020\/05\/CanaduinoSTM32ScrewTerminalboardtray.zip\" class=\"wp-block-file__button wp-element-button\" download>Download<\/a><\/div>\n\n\n\n<p>The boards themselves are pretty neat:<\/p>\n\n\n\n<figure class=\"wp-block-image aligncenter size-medium\"><img loading=\"lazy\" decoding=\"async\" width=\"320\" height=\"240\" src=\"https:\/\/scruss.com\/wordpress\/wp-content\/uploads\/2020\/05\/04-two_stm32f411_black_pill_boards_from_canaduino-320x240.jpg\" alt=\"\" class=\"wp-image-16276\" srcset=\"https:\/\/scruss.com\/wordpress\/wp-content\/uploads\/2020\/05\/04-two_stm32f411_black_pill_boards_from_canaduino-320x240.jpg 320w, https:\/\/scruss.com\/wordpress\/wp-content\/uploads\/2020\/05\/04-two_stm32f411_black_pill_boards_from_canaduino-1024x768.jpg 1024w, https:\/\/scruss.com\/wordpress\/wp-content\/uploads\/2020\/05\/04-two_stm32f411_black_pill_boards_from_canaduino-160x120.jpg 160w, https:\/\/scruss.com\/wordpress\/wp-content\/uploads\/2020\/05\/04-two_stm32f411_black_pill_boards_from_canaduino-768x576.jpg 768w, https:\/\/scruss.com\/wordpress\/wp-content\/uploads\/2020\/05\/04-two_stm32f411_black_pill_boards_from_canaduino.jpg 1200w\" sizes=\"auto, (max-width: 320px) 100vw, 320px\" \/><figcaption class=\"wp-element-caption\">two STM32F411 Black Pill boards from Canaduino<\/figcaption><\/figure>\n\n\n\n<p>Gone are the lumpy pin headers of the earlier Blue and Black Pill boards, replaced by tactile switches. The iffy micro USB connectors are replaced by much more solid USB C connectors. According to <a href=\"https:\/\/stm32-base.org\/boards\/STM32F411CEU6-WeAct-Black-Pill-V2.0\">STM32-base<\/a>, the STM32F411 has:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>100 MHz ARM Cortex-M4 core. This brings fast (single-precision) floating point so you don&#8217;t have to fret over integer maths<\/li>\n\n\n\n<li>512 K Flash, 128 K RAM. MicroPython runs in this, but more flash is always helpful<\/li>\n\n\n\n<li>Lots of digital and analogue I\/O, including a 12-bit ADC<\/li>\n\n\n\n<li>A user LED and user input switch.<\/li>\n<\/ul>\n\n\n\n<p>About the only advanced features it&#8217;s missing are a true RNG, a DAC for analogue outputs, and WiFi. But on top of all this, Volker added:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"769\" src=\"https:\/\/scruss.com\/wordpress\/wp-content\/uploads\/2020\/05\/05-the_all-important_128_mbit_flash_chip_and_capacitor_fitted_by_universal_solder-1024x769.jpg\" alt=\"\" class=\"wp-image-16275\" srcset=\"https:\/\/scruss.com\/wordpress\/wp-content\/uploads\/2020\/05\/05-the_all-important_128_mbit_flash_chip_and_capacitor_fitted_by_universal_solder-1024x769.jpg 1024w, https:\/\/scruss.com\/wordpress\/wp-content\/uploads\/2020\/05\/05-the_all-important_128_mbit_flash_chip_and_capacitor_fitted_by_universal_solder-320x240.jpg 320w, https:\/\/scruss.com\/wordpress\/wp-content\/uploads\/2020\/05\/05-the_all-important_128_mbit_flash_chip_and_capacitor_fitted_by_universal_solder-160x120.jpg 160w, https:\/\/scruss.com\/wordpress\/wp-content\/uploads\/2020\/05\/05-the_all-important_128_mbit_flash_chip_and_capacitor_fitted_by_universal_solder-768x577.jpg 768w, https:\/\/scruss.com\/wordpress\/wp-content\/uploads\/2020\/05\/05-the_all-important_128_mbit_flash_chip_and_capacitor_fitted_by_universal_solder.jpg 1200w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><figcaption class=\"wp-element-caption\">the all-important 128 Mbit flash chip (and capacitor) fitted by Universal Solder<\/figcaption><\/figure>\n\n\n\n<p>128 Mbit of Flash! This gives the board roughly 16 MB of storage that, when used with MicroPython, appears as a small USB drive for your programs and data. I found I was able to read the ADC more than 22,000 times\/second under MicroPython, so who needs slow-to-deploy compiled code?<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"773\" src=\"https:\/\/scruss.com\/wordpress\/wp-content\/uploads\/2020\/07\/STM32F4x1_PinoutDiagram_RichardBalint-1024x773.png\" alt=\"STM32F411 board pinout\" class=\"wp-image-16421\" srcset=\"https:\/\/scruss.com\/wordpress\/wp-content\/uploads\/2020\/07\/STM32F4x1_PinoutDiagram_RichardBalint-1024x773.png 1024w, https:\/\/scruss.com\/wordpress\/wp-content\/uploads\/2020\/07\/STM32F4x1_PinoutDiagram_RichardBalint-320x241.png 320w, https:\/\/scruss.com\/wordpress\/wp-content\/uploads\/2020\/07\/STM32F4x1_PinoutDiagram_RichardBalint-160x121.png 160w, https:\/\/scruss.com\/wordpress\/wp-content\/uploads\/2020\/07\/STM32F4x1_PinoutDiagram_RichardBalint-768x580.png 768w, https:\/\/scruss.com\/wordpress\/wp-content\/uploads\/2020\/07\/STM32F4x1_PinoutDiagram_RichardBalint-1536x1159.png 1536w, https:\/\/scruss.com\/wordpress\/wp-content\/uploads\/2020\/07\/STM32F4x1_PinoutDiagram_RichardBalint-1200x906.png 1200w, https:\/\/scruss.com\/wordpress\/wp-content\/uploads\/2020\/07\/STM32F4x1_PinoutDiagram_RichardBalint.png 1561w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><figcaption class=\"wp-element-caption\">board pinout from <a href=\"https:\/\/github.com\/WeActTC\/MiniF4-STM32F4x1\">STM32F4x1 MiniF4 \/ WeAct Studio \u00e5\u00be\u00ae\u00e8\u00a1\u0152\u00e5\u00b7\u00a5\u00e4\u00bd\u0153\u00e5\u00ae\u00a4 \u00e5\u2021\u00ba\u00e5\u201c\u0081<\/a>. <br>Avoid A4-A7 if you&#8217;re using a <a href=\"https:\/\/github.com\/mcauser\/WEACT_F411CEU6#spi-flash-u3-unpopulated\">flash<\/a> chip.<\/figcaption><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Building and Installing MicroPython<\/h2>\n\n\n\n<p>This is surprisingly easy. You&#8217;ll need to install the <em>gcc-arm-none-eabi<\/em> compiler set before you start, but following the instructions at <a href=\"https:\/\/github.com\/mcauser\/WEACT_F411CEU6\">mcauser\/WEACT_F411CEU6: MicroPython board definition for the WeAct STM32F411CEU6 board<\/a> will get you there.<\/p>\n\n\n\n<p>I had to run make a couple of times before it would build, but it built and installed quickly. This board doesn&#8217;t take UF2 image files that other boards use, so the installation is a little more complicated than other. But it works!<\/p>\n\n\n\n<p>Once flashed, you should have a USB device with two important  MicroPython files on it: <strong>boot.py<\/strong> and <strong>main.py<\/strong>. boot.py is best left alone, but main.py can be used for your program. I&#8217;m going into more details in a later article, but how about replacing the main.py program with the fanciest version if Blink you ever saw:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: python; title: ; notranslate\" title=\"\">\n# main.py -- fancy Blink (scruss, 2020-05)\n\nfrom pyb import LED\nfrom machine import Timer\ntim = Timer(-1)\ntim.init(period=1000, mode=Timer.PERIODIC,\n         callback=lambda t: LED(1).toggle())\n<\/pre><\/div>\n\n\n<p>None of that blocking delay() nonsense: we&#8217;re using a periodic timer to toggle the user LED every second!<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"768\" src=\"https:\/\/scruss.com\/wordpress\/wp-content\/uploads\/2020\/05\/07-debugging_the_mystery_huge_potentiometer_using_two_adc_channels-1024x768.jpg\" alt=\"\" class=\"wp-image-16273\" srcset=\"https:\/\/scruss.com\/wordpress\/wp-content\/uploads\/2020\/05\/07-debugging_the_mystery_huge_potentiometer_using_two_adc_channels-1024x768.jpg 1024w, https:\/\/scruss.com\/wordpress\/wp-content\/uploads\/2020\/05\/07-debugging_the_mystery_huge_potentiometer_using_two_adc_channels-320x240.jpg 320w, https:\/\/scruss.com\/wordpress\/wp-content\/uploads\/2020\/05\/07-debugging_the_mystery_huge_potentiometer_using_two_adc_channels-160x120.jpg 160w, https:\/\/scruss.com\/wordpress\/wp-content\/uploads\/2020\/05\/07-debugging_the_mystery_huge_potentiometer_using_two_adc_channels-768x576.jpg 768w, https:\/\/scruss.com\/wordpress\/wp-content\/uploads\/2020\/05\/07-debugging_the_mystery_huge_potentiometer_using_two_adc_channels.jpg 1200w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><figcaption class=\"wp-element-caption\">debugging the mystery huge potentiometer using two ADC channels<\/figcaption><\/figure>\n\n\n\n<p>I&#8217;m really impressed with the Universal Solder-modified board as an experimentation\/discovery platform. MicroPython makes development and testing really quick and easy.<\/p>\n\n\n\n<p>[and about the mystery huge potentiometer: it&#8217;s a <strong>Computer Instruments Corporation<\/strong> Model 206-IG multi-turn, multi-track potentiometer I picked up from the free table at a nerd event. I <em>think<\/em> it&#8217;s a 1950s (so Servo-control\/Cybernetics age) analogue equivalent of a shaft encoder, looking at the <a href=\"https:\/\/patents.google.com\/patent\/US2848629\">patent<\/a>. Best I can tell is that each pot (there are two, stacked, with precision bearings) appears to have two 120\u00b0 10k ohm sweep tracks offset 90\u00b0 to one another. The four wipers are labelled -COS, -SIN, +COS and +SIN. If anyone knows more about the thing, let me know!]<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Volker Forster at Universal Solder was kind enough to send me a couple of these boards for free when I asked about availability. By way of thanks, I&#8217;m writing this article about what&#8217;s neat about these micro-controller boards. Can I just say how nicely packaged Universal Solder&#8217;s own or customized products are? They want it [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[7,2,3239],"tags":[3094,3231],"class_list":["post-16272","post","type-post","status-publish","format-standard","hentry","category-computers-suck","category-goatee-stroking-musing-or-something","category-semisponsored","tag-micropython","tag-weact_f411"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/pQNZZ-4es","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/scruss.com\/blog\/wp-json\/wp\/v2\/posts\/16272","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/scruss.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/scruss.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/scruss.com\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/scruss.com\/blog\/wp-json\/wp\/v2\/comments?post=16272"}],"version-history":[{"count":8,"href":"https:\/\/scruss.com\/blog\/wp-json\/wp\/v2\/posts\/16272\/revisions"}],"predecessor-version":[{"id":18044,"href":"https:\/\/scruss.com\/blog\/wp-json\/wp\/v2\/posts\/16272\/revisions\/18044"}],"wp:attachment":[{"href":"https:\/\/scruss.com\/blog\/wp-json\/wp\/v2\/media?parent=16272"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/scruss.com\/blog\/wp-json\/wp\/v2\/categories?post=16272"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/scruss.com\/blog\/wp-json\/wp\/v2\/tags?post=16272"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}