Contact Sales & After-Sales Service

Contact & Quotation

  • Inquire: Call 0086-755-23203480, or reach out via the form below/your sales contact to discuss our design, manufacturing, and assembly capabilities.
  • Quote: Email your PCB files to Sales@pcbsync.com (Preferred for large files) or submit online. We will contact you promptly. Please ensure your email is correct.
Drag & Drop Files, Choose Files to Upload You can upload up to 3 files.

Notes:
For PCB fabrication, we require PCB design file in Gerber RS-274X format (most preferred), *.PCB/DDB (Protel, inform your program version) format or *.BRD (Eagle) format. For PCB assembly, we require PCB design file in above mentioned format, drilling file and BOM. Click to download BOM template To avoid file missing, please include all files into one folder and compress it into .zip or .rar format.

STM32 Arduino: Programming Blue Pill with Arduino IDE

The moment I realized my Arduino Uno couldn’t keep up with a motor control project requiring precise PWM timing and fast ADC sampling, I discovered the STM32 Blue Pill. This $2 development board running a 32-bit ARM Cortex-M3 processor absolutely transformed what I could accomplish with Arduino-style programming. The STM32 Arduino combination delivers professional-grade performance while maintaining the familiar development environment millions of makers already know.

The STM32F103C8T6 Blue Pill has become one of the most popular alternatives to traditional Arduino boards, offering dramatically superior specifications at a fraction of the cost. Getting it running with Arduino IDE requires some initial setup that trips up many newcomers, but once configured, you gain access to a microcontroller that outperforms the Arduino Uno in virtually every measurable way.

Understanding the STM32 Blue Pill Development Board

The STM32 Blue Pill earned its name from a forum post on the STM32duino community—a Matrix movie reference that stuck. The board features the STM32F103C8T6 microcontroller from STMicroelectronics, built around an ARM Cortex-M3 core running at 72 MHz. That’s 4.5 times faster than an Arduino Uno’s 16 MHz clock speed, and the 32-bit architecture makes each clock cycle dramatically more productive.

What makes the Blue Pill remarkable for hobbyists is its price-to-performance ratio. You can purchase these boards for $2-5, cheaper than most Arduino clones, while getting specifications that rival development boards costing ten times more.

STM32 Blue Pill Technical Specifications

SpecificationSTM32 Blue PillArduino Uno
MicrocontrollerSTM32F103C8T6ATmega328P
Architecture32-bit ARM Cortex-M38-bit AVR
Clock Speed72 MHz16 MHz
Flash Memory64 KB (128 KB actual*)32 KB
SRAM20 KB2 KB
GPIO Pins3714 digital + 6 analog
ADC Resolution12-bit (2 channels)10-bit (1 channel)
PWM Channels156
Timers7 (including advanced)3
UART31
SPI21
I2C21
CAN Bus10
USB1 (Full Speed)0 (via external chip)
Operating Voltage3.3V5V
Price Range$2-5$20-25 (genuine)

*Note: While officially rated at 64 KB, most STM32F103C8T6 chips actually contain 128 KB of usable flash memory.

The 10x RAM advantage alone changes what’s possible. Running FreeRTOS, implementing complex state machines, or buffering sensor data becomes practical on the Blue Pill where it would be impossible on an Arduino Uno.

Why Choose STM32 Arduino Development

The STM32 Arduino approach bridges two worlds: the accessibility of Arduino’s ecosystem and the power of professional ARM microcontrollers. Here’s why this combination makes sense:

Performance Advantages

The Blue Pill handles computationally intensive tasks that would overwhelm an Arduino Uno. Real-time motor control, audio processing, high-speed data acquisition, and running an RTOS all become practical. The hardware floating-point support (via software on Cortex-M3, native on M4 variants) dramatically accelerates mathematical operations.

Cost Effectiveness

Getting STM32 performance at Arduino Uno clone prices seems almost too good to be true. For prototyping, education, or small production runs, the Blue Pill offers exceptional value. You can afford to embed them in projects without worrying about component cost.

Peripheral Richness

Three UARTs mean connecting GPS, Bluetooth, and debugging simultaneously without multiplexing. Dual SPI and I2C buses eliminate conflicts between sensors sharing communication interfaces. The CAN bus support opens automotive and industrial applications impossible with standard Arduino boards.

Professional Pathway

Skills developed programming STM32 with Arduino transfer directly to professional embedded development. When you’re ready to move beyond Arduino IDE to STM32CubeIDE or direct register programming, the hardware knowledge remains valuable.

STM32 Arduino IDE Setup: Installing the STM32 Core

Before programming your Blue Pill, you need to configure Arduino IDE with STM32 support. The official STM32duino core maintained by STMicroelectronics provides comprehensive board support.

Step-by-Step Arduino IDE Configuration

Step 1: Open Arduino IDE Preferences

Launch Arduino IDE and navigate to File → Preferences (or Arduino → Preferences on macOS).

Step 2: Add the STM32 Board Manager URL

In the “Additional Boards Manager URLs” field, add:

https://github.com/stm32duino/BoardManagerFiles/raw/main/package_stmicroelectronics_index.json

If you have other URLs already present, separate them with commas.

Step 3: Install STM32 Board Support

Navigate to Tools → Board → Boards Manager. Search for “STM32” and install “STM32 MCU based boards” by STMicroelectronics. This download includes several hundred megabytes of files, so be patient.

Step 4: Select Your Board

After installation, go to Tools → Board → STM32 boards groups → Generic STM32F1 series. Then select Tools → Board Part Number → BluePill F103C8.

Required Software Tools

ToolPurposeDownload Source
Arduino IDEDevelopment environmentarduino.cc
STM32CubeProgrammerFlashing and debuggingst.com
ST-Link DriversUSB driver for programmerst.com
CH340 DriversUSB-TTL adapter supportwch-ic.com
FTDI DriversAlternative USB-TTL supportftdichip.com

STM32CubeProgrammer is essential—it provides the backend that Arduino IDE uses for uploading code via ST-Link or serial bootloader methods.

Programming Methods for STM32 Blue Pill

Unlike Arduino boards that program directly over USB, the Blue Pill requires external hardware for initial programming. Three primary methods exist, each with distinct advantages.

Method 1: ST-Link V2 Programmer (Recommended)

The ST-Link V2 programmer provides the most reliable and fastest upload method. These clones cost $3-5 and work identically to genuine ST programmers for hobbyist purposes.

ST-Link Wiring Connections:

ST-Link PinBlue Pill Pin
SWDIOSWDIO (PA13)
SWCLKSWCLK (PA14)
GNDGND
3.3V3V3

Arduino IDE Settings for ST-Link:

  • Upload method: STM32CubeProgrammer (SWD)
  • No port selection required

ST-Link uploads take only 2-3 seconds compared to 10-15 seconds for serial methods. Additionally, ST-Link enables real-time debugging with breakpoints—something impossible with serial uploading.

Method 2: USB-to-Serial Adapter (FTDI/CH340)

The serial bootloader method uses the STM32’s built-in ROM bootloader accessible through UART1 pins. This requires a USB-to-TTL adapter operating at 3.3V logic levels.

Serial Adapter Wiring:

USB-TTL AdapterBlue Pill Pin
TXPA10 (RX1)
RXPA9 (TX1)
GNDGND
3.3V or 5V3V3 or 5V

Boot Mode Configuration:

To enter the serial bootloader:

  1. Move BOOT0 jumper to position 1 (HIGH)
  2. Keep BOOT1 jumper at position 0 (LOW)
  3. Press the Reset button

After uploading, return BOOT0 to position 0 for normal operation.

Arduino IDE Settings for Serial Upload:

  • Upload method: STM32CubeProgrammer (Serial)
  • Port: Select your USB-TTL adapter’s COM port

Method 3: USB HID Bootloader (After Initial Setup)

Once you’ve programmed a USB bootloader onto the Blue Pill using either method above, you can upload sketches directly through the board’s micro-USB port—just like a regular Arduino.

Installing the USB HID Bootloader:

  1. Download the HID bootloader binary (hid_generic_pc13.bin for standard Blue Pills)
  2. Flash it using ST-Link or serial method via STM32CubeProgrammer
  3. After flashing, move BOOT0 back to 0
  4. Connect Blue Pill via USB—it should enumerate as an HID device

Arduino IDE Settings for USB Bootloader:

  • Upload method: HID Bootloader 2.2
  • USB support: CDC (generic “Serial” supersede U(S)ART)
  • Port: Select the Blue Pill’s assigned COM port

Note: Using ST-Link or serial programming afterward will erase the USB bootloader, requiring reinstallation.

Programming Method Comparison

FeatureST-Link V2Serial (FTDI/CH340)USB Bootloader
Initial Cost$3-5$2-4Free (after setup)
Upload Speed~2-3 seconds~10-15 seconds~5-8 seconds
Debugging SupportYes (SWD)NoNo
Requires External HardwareYesYesNo
Boot Jumper ChangesNoYes (each upload)No
Ease of UseMediumLowHigh
ReliabilityExcellentGoodGood

For beginners, I recommend starting with ST-Link. The investment is minimal, uploads are fast, and you avoid the frustrating boot jumper dance required for serial uploads.

Your First STM32 Arduino Sketch: Blinking the LED

Every microcontroller journey starts with blinking an LED. The Blue Pill has an onboard LED connected to pin PC13 (active LOW—meaning the LED illuminates when the pin is LOW).

// STM32 Blue Pill Blink Example

// LED connected to PC13 (active LOW)

#define LED_PIN PC13

void setup() {

  pinMode(LED_PIN, OUTPUT);

}

void loop() {

  digitalWrite(LED_PIN, LOW);   // LED ON

  delay(500);

  digitalWrite(LED_PIN, HIGH);  // LED OFF

  delay(500);

}

Note the inverted logic compared to typical Arduino examples—LOW turns the LED on because PC13 sinks current through the LED to ground.

Uploading the Sketch

  1. Connect your programmer (ST-Link or USB-TTL adapter)
  2. For serial upload: Set BOOT0 jumper to 1, press Reset
  3. Select correct board settings in Tools menu
  4. Click Upload
  5. For serial upload: Return BOOT0 to 0 after successful upload

If the upload succeeds, you’ll see the onboard LED blinking at 1 Hz.

STM32 Blue Pill Pinout Reference

Understanding the Blue Pill pinout is essential for connecting peripherals:

FunctionPinsNotes
Digital I/OPA0-PA15, PB0-PB15, PC13-PC153.3V logic, many 5V tolerant
Analog InputPA0-PA7, PB0-PB112-bit ADC (0-4095)
PWM OutputPA0-PA3, PA6-PA10, PB0-PB1, PB6-PB916-bit timers
UART1PA9 (TX), PA10 (RX)Used for serial bootloader
UART2PA2 (TX), PA3 (RX)General purpose
UART3PB10 (TX), PB11 (RX)General purpose
I2C1PB6 (SCL), PB7 (SDA)Requires external pull-ups
I2C2PB10 (SCL), PB11 (SDA)Requires external pull-ups
SPI1PA5 (SCK), PA6 (MISO), PA7 (MOSI)High-speed capable
SPI2PB13 (SCK), PB14 (MISO), PB15 (MOSI)General purpose
CANPB8 (RX), PB9 (TX)Requires CAN transceiver
USBPA11 (D-), PA12 (D+)Full-speed USB
SWD DebugPA13 (SWDIO), PA14 (SWCLK)For ST-Link programming
Onboard LEDPC13Active LOW
User ButtonNoneMust add external

Common Issues and Troubleshooting

USB Resistor Problem

Many cheap Blue Pill clones have an incorrect resistor value on the USB D+ line. Instead of the required 1.5kΩ pull-up resistor, they ship with 10kΩ or 4.7kΩ. This causes USB enumeration failures.

Solution: Replace the R10 resistor (near the USB connector) with a 1.5kΩ resistor, or solder a 1.8kΩ resistor in parallel with the existing one.

Upload Failures via Serial

If serial uploads fail consistently:

  • Verify BOOT0 is set to 1 and BOOT1 is set to 0
  • Press Reset after setting jumpers
  • Check TX/RX connections (they should be crossed: adapter TX → Blue Pill RX)
  • Try pressing Reset during the upload process
  • Verify your USB-TTL adapter uses 3.3V logic (not 5V)

ST-Link Connection Issues

If ST-Link fails to connect:

  • Verify wiring connections match the table above
  • Install or reinstall STM32CubeProgrammer
  • Check that ST-Link appears in Device Manager
  • Try powering the Blue Pill separately via USB
  • Ensure BOOT0 is at position 0 for normal operation

Counterfeit Chips

Some extremely cheap Blue Pills contain counterfeit STM32 chips that may have reduced flash, erratic behavior, or complete non-functionality. Purchase from reputable sellers and expect to pay at least $2-3 per board.

STM32 Arduino Resources and Downloads

ResourceDescriptionURL
STM32duino CoreOfficial Arduino core for STM32github.com/stm32duino
STM32CubeProgrammerFlashing utilityst.com/stm32cubeprog
USB HID BootloaderFor USB programminggithub.com/Serasidis/STM32_HID_Bootloader
STM32F103C8T6 DatasheetOfficial specificationsst.com
Reference ManualDetailed peripheral documentationRM0008 on st.com
STM32duino ForumCommunity supportstm32duino.com
Arduino STM32 WikiTutorials and documentationgithub.com/stm32duino/wiki

Frequently Asked Questions

Can I program STM32 Blue Pill with Arduino IDE like a regular Arduino?

Yes, but with initial setup. You need to install the STM32 board support package and use either an ST-Link programmer, USB-to-serial adapter, or install a USB bootloader first. Once configured, programming works similarly to standard Arduino boards—write your sketch and click upload. The STM32duino core provides Arduino-compatible functions for most standard operations.

Why doesn’t the Blue Pill USB port work for programming out of the box?

Unlike Arduino boards, the STM32F103C8T6’s built-in ROM bootloader doesn’t support USB DFU (Device Firmware Upgrade). The USB port only provides power initially. To program via USB, you must first flash a USB bootloader (like HID Bootloader) using ST-Link or serial methods. After that, the USB port works for uploading sketches.

Is STM32 Blue Pill compatible with Arduino libraries?

Most Arduino libraries work with STM32, but some require modification. Libraries using standard Arduino functions (digitalWrite, analogRead, Serial, Wire, SPI) typically work directly. Libraries that manipulate AVR-specific registers or use AVR assembly instructions need STM32-compatible versions. The STM32duino community has ported many popular libraries.

What’s the difference between the Blue Pill and Black Pill?

The Blue Pill uses the STM32F103C8T6 (Cortex-M3, 72 MHz, 64-128KB flash, 20KB RAM). The Black Pill typically uses either STM32F401CCU6 or STM32F411CEU6 (Cortex-M4, 84-100 MHz, 256-512KB flash, 64-128KB RAM, hardware FPU). Black Pills offer more performance and memory but cost slightly more. Both program similarly through Arduino IDE with the STM32 core.

Should I use STM32CubeIDE instead of Arduino IDE?

For learning and rapid prototyping, Arduino IDE with STM32duino is faster to get started. For professional development, complex projects, or when you need advanced debugging, STM32CubeIDE offers superior tools including graphical peripheral configuration (CubeMX), real-time debugging, and access to ST’s HAL/LL drivers. Many developers prototype in Arduino IDE and move to CubeIDE for production code.

Conclusion: Unlocking STM32 Arduino Potential

The STM32 Arduino combination opens doors that traditional Arduino boards simply cannot. For $2-5, you get a development platform that handles real-time control, runs an RTOS, processes data faster than any 8-bit AVR could dream, and still programs with familiar Arduino syntax.

The initial setup hurdle—installing board support, configuring a programmer, understanding boot modes—pays dividends in capability. Once your Blue Pill is configured, you have a workhorse microcontroller suitable for projects ranging from hobby electronics to professional prototypes.

Start with the ST-Link method for reliability, get comfortable with the development workflow, then explore USB bootloader installation for cable-free convenience. The skills you develop transfer directly to the entire STM32 family, from tiny STM32G0 chips to powerful STM32H7 processors.

The Blue Pill remains the most cost-effective gateway into 32-bit ARM development. For any project where Arduino Uno limitations become frustrating, the STM32 Arduino approach delivers the performance upgrade you need without abandoning the ecosystem you already know.


Last updated: January 2026

Leave a Reply

Your email address will not be published. Required fields are marked *

Contact Sales & After-Sales Service

Contact & Quotation

  • Inquire: Call 0086-755-23203480, or reach out via the form below/your sales contact to discuss our design, manufacturing, and assembly capabilities.

  • Quote: Email your PCB files to Sales@pcbsync.com (Preferred for large files) or submit online. We will contact you promptly. Please ensure your email is correct.

Drag & Drop Files, Choose Files to Upload You can upload up to 3 files.

Notes:
For PCB fabrication, we require PCB design file in Gerber RS-274X format (most preferred), *.PCB/DDB (Protel, inform your program version) format or *.BRD (Eagle) format. For PCB assembly, we require PCB design file in above mentioned format, drilling file and BOM. Click to download BOM template To avoid file missing, please include all files into one folder and compress it into .zip or .rar format.