WeAct Duino - Cheap and Powerful!

The purpose of this project is to show how to use the WeAct STM32G431 board as an ARM-based Arduino.

Similar projects worth following
Go on, admit it! The perfect Arduino doesn't exist. Most boards from Arduino don't have enough power (Uno, Nano) or are too large and expensive (most of the rest)> Sure, lots of good features and fun to experiment with, but not something to build into projects. There are many fine work-alikes (Teensy4, Feathers, etc.), but still too expensive. At the small end, there's the Xiao from Seeduino, but maybe too small and lacking in resources - and still costs five bucks.
What to do?
How about a 170MHz ARM M4 with 128K flash, 32K of ram, 4 serial ports, 3 I2C ports, 3 SPI ports, 10 ADC channels, 2 DAC channels, and more? Recently released by WeAct Studio and available on AliExpress, the G431 board offers significant power in a small, affordable package - less than three bucks!
My Project Logs below will explain how to make this into a powerful Arduino!

My first serious work with STM processors as powerful ARM-based Arduinos started with ST32L071 and is documented here. As part of that article, I found a way to integrate a custom board into the Arduino environment and how to use the ST-Link to upload a sketch from the Arduino IDE. Satisfied as I am with that work, I realize that no one is likely to build any of my L071 based Arduinos, even if they can be itsy-bitsy, low power, etc. However, my work may still be very useful!

Let's talk about the WeAct Duino. As discussed in the Description section above, the STM32G431 on the WeAct Mini Core Board offers a lot of power along with many peripherals. WeAct offers this unit at a very affordable price - less than three bucks! (Even in quantity, the G431 chip from Digikey costs more than the cost of the system from WeAct. How can they make it so cheap? Who knows! But we can all benefit!) While the G4xx draws more power than the L0xx, it is an M4 core with floating point hardware, runs over 4 times faster, and has additional resources. The version from WeAct is in a 48 pin package, so more of the resources are accessible. ST Nucleo versions of the G431 are available from Digikey (and others). The 32 pin version costs $12 and the 64 pin version is $16. Both are significantly larger than the WeAct  board, but not any more powerful (same chip).
As a useful bonus, WeAct also offers a clone of the ST-LINK_2.1 programmer. Not only does it cost half what the cheapest ST version costs, it also provides a serial interface. The usual sort of Serial.print() debug can be easily used for program debug; for harder problems, gdb (g-debugger) can be invoked as described here (but it might be broken also - not sure)??
So lots of reasons to love the G431, but how do we use it as an Arduino?? That brings us back to my work on the L071! As mentioned above, that project is currently broken. It will be fixed soon and the documentation will be directly applicable to the G431. In the paragraphs to follow, I will explain how to make the G431 into an Arduino: WeAct Duino!

Let's have a look at the hardware side. WeAct supplies dual rows of square pins to be soldered into the holes in the board, but I wanted something that could plug into a breadboard. I used Arduino connectors on the inside rows and standard square pins on the outer rows as shown.

Now I can plug the WeAct Duino into a breadboard if I want and still have a row or two of connections available for each pin.

WeAct kindly provides pdf versions of the schematics and the board layout. These are very helpful in understanding the design and how to use it effectively. I've included these in the Files section.
The files that actually define a board to the Arduino IDE are those in the variant directories. This is all (or soon will be) explained in the revisions to the tDuino prject referenced above. For now, know that the necessary files (which you will put in place in a few paragraphs) have been suitably modified for the WeAct Duino. The external 8MHz clock crystal on the WeAct board is implemented as the system clock source. The WeAct Duino board runs at 170MHz.
To assist in understanding and using the resources of the WeAct Duino, I created a map of the pin functions. This is WeAct_Pin_Map.png in the Files section, and will be used as a guide to experiments in the Project Logs to follow.
Final hardware note: There are still a few details of the WeAct board that are not clear to me. I am still investigating and will report as I learn.

Hardware ready, let's look at software. Although I will explain all the steps I went through to add the WeAct Duino to the Arduino IDE (as part of the update to the tDuino project), I've provided the necessary files so you can just copy them and go. I'm now running Ubuntu 18.04, but this should work with other recent versions and operating systems. My Arduino version is 1.8.15, but more recent versions should work also. (However, I haven't tried Arduino 2.0...

Read more »


WeAct Duino Resource Pin Map. Revised 9/9/23.

Portable Network Graphics (PNG) - 251.02 kB - 09/13/2023 at 00:29


Arduino software package for WeAct Duino.

Zip Archive - 12.44 kB - 09/04/2023 at 00:16



WeAct Duino Circuit board.

Adobe Portable Document Format - 1.55 MB - 09/04/2023 at 00:15



Schematic of the WeAct Duino board.

Adobe Portable Document Format - 219.04 kB - 09/04/2023 at 00:14


  • Getting Started and Blinky

    doctek09/05/2023 at 01:05 0 comments

    Blinky, of course! But this really explains how to download a program use the ST-Link.

    Connect your ST-Link as follows. If you're using the WeAct ST-Link version of their Mini Debugger, these wire colors apply. Be sure to note that the black wire is NOT ground (as much as we all want it to be). Ground is green! The WeAct ST-Link also supplies 3.3V; no separate supply is needed.

    ST-Link pinWeAct Duino pinwire color

    Connection of an ST-Link from a Nucleo board is described in tDuino. That description should all still be correct. Note that SWC is the same as SWCLK is the same as CLK.
    Time to navigate the menu items on the Tools Menu!
    Be sure you have selected the weArmDuinoG431 as described above.
    Then for U(S)ART support:, you can choose "Disabled (No serial support)". We'll get to that in the next Project Log.
    Next, Optimize: "Smallest (-Os default)". More details to follow. I haven't played with this much.
    Now, C Runtime Library: "Newlib Nano (default)". Again, I haven't messed with this.
    Finally, Upload method: "STM32CubeProgrammer (SWD)".
    The program we will use will be File -> Examples -> 02 Digital -> BlinkWithoutDelay. No changes are necessary. Verify the sketch. If all goes well, upload. The blue led on the WeAct Duino should be blinking.

    You want to Run stand-alone? Easy! Disconnect the ST-Link and hook up a battery or power supply providing 3.3 to 20 Volts to either Vcc pin - NOT to 3v3. Hook Ground to any ground pin. The led should blink.

View project log

Enjoy this project?



trimarco232 wrote 09/30/2023 at 20:44 point

Thanks , some thoughts , imho :

1) I don't now what could be the + of WeAct Duino , as stm32duino supports the chip , and can give support on the forum or on github

2) there is no need for ST-Link , the chip can be natively programmed in DFU mode through USB , and CDC mode can be selected in order to interact with the monitor . Nevertheless ,  one have to push the boot0 and the rst buttons before each upload ; I have connected the boot0-PB8 to 3v3 , so I just have to push the rst button ; it is better to close the monitor before uploading ; yes , one have to install STM32CubeProgrammer before

3) i have got old $3 stlinks , with STM32GC102CB chip : they can be upgraded for G4 , there is a good video how to

4) they are "forbidden" pins :

// PA11 , PA12 : USB , not on the headers
// PA13 , PA14 : SW (ST-Link)
// PG10 : NRST  ;  PB8 : BOOT0
// PC14 , PC15 : OSC32
// PB4, PB6 , PA10, PA9 : USB C : The pull-down effect on the CC lines can be removed by using the bit UCPD1_DBDIS =1 ???  I have to clarify ...

5) it has 5 u(s)arts ; didn't try lpuart ; and yes , much more

6) the reason why the board is cheap is that the chip itself is cheap in china  : 100+ US$1.451 at LCSC ; maybe a commercial effort from ST , in order to fight the clones ; so , not the perfect arduino , but one of the top bests

  Are you sure? yes | no

doctek wrote 09/30/2023 at 23:29 point

Thank you for your interest and comments. Here are my responses to each item.
1) The purpose of WeAct Duino is to integrate both the board and the chip (with its unique pinout) into the Arduino environment. The stm32duino project does not offer this specific support.

2) Perhaps the WeAct board can be configured for programming in this mode, but I don't think it can be done without some effort. The ST-Link supports easy uploading as well as debug (using gdb), plus a uart to usb connection. So no fooling around with buttons to upload.

3) By all means, use what you have if it works. Not everyone has these units sitting around.

4) I'm not sure what STMG431 board you are using, but the WeAct board pins out several of the pins you say are forbidden. Specifically, PA11, PA12, PB8, PB4, PB6, PA9, and PA10 are all pinned out to headers and may be used with full capabilities.

5) You are correct. I have not tried using the LPUART, but I will. Thanks for calling it to my attention.

6) Thank you for explaining this. I don't source many parts directly from China and hadn't tried to find a source for the G431.

  Are you sure? yes | no

trimarco232 wrote 10/04/2023 at 11:22 point

PB4, PB6 , PA10  PA9 works ; jumpers give the possibility for advanced users to develop USB C

but PA13 , PA14 : SW (ST-Link)// PG10 and PB8 : BOOT0 are reserved if you use USB (as an average arduino fan)

  Are you sure? yes | no

doctek wrote 08/29/2023 at 03:54 point

Thanks for the encouragement! Yes, there will be a complete Arduino IDE based toolchain. The CLI is only needed to use gdb for advanced debug - that's not supported by Arduino yet. (Actually, it may be in 2.0, but I haven't tried it yet.)

  Are you sure? yes | no

Ken Yap wrote 08/29/2023 at 06:30 point

I'm sure somebody will work out something for debugging using PlatformIO too.

  Are you sure? yes | no

Ken Yap wrote 08/29/2023 at 03:20 point

This should be interesting, especially if there will be an Arduino IDE based toolchain. But I can handle CLI toolcnains too.

  Are you sure? yes | no

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates