02Lesson
Robotics Lab: STM32 Blue Pill Lesson and Pinout
Select a board in Robotics Lab to see its specifications, pin functions and component guide.
Board overview
Robotics Lab board guide · Generic (STM32F103C8T6 board) · 2014
A tiny blue board built around the STM32F103C8T6 — a 32-bit ARM Cortex-M3 microcontroller running at 72 MHz. It is several times faster than a classic Arduino, has lots of timers and communication ports, and costs about as much as a chocolate bar. A great second board once you have outgrown the Uno or Nano.
- Clock
- 72 MHz
- Flash
- 64 KB
- RAM
- 20 KB
- GPIO pins
- 32
- Logic level
- 3.3 V
- Price
- ≈ $2–3
Specs
Compare the electrical specs with other Robotics Lab boards. See the hardware references.
- Microcontroller
- STM32F103C8T6 (ARM Cortex-M3, 32-bit)
- Clock speed
- 72 MHz (8 MHz crystal × 9)
- Flash memory
- 64 KB
- RAM
- 20 KB
- Logic level
- 3.3 V (many pins tolerate 5 V inputs)
- I/O pins on the headers
- 32
- Analog inputs
- 10 channels, 12-bit ADC
- PWM outputs
- 15
- Interfaces
- 3 × USART, 2 × SPI, 2 × I2C, CAN, USB 2.0 full speed
- Power
- 5 V from micro-USB or the 5V pin; 3.3 V regulator on board
- Programming
- ST-Link over SWD, or USB-UART adapter via the serial bootloader
- Size
- 53.3 × 22.9 mm
What’s on the board
13 parts match the numbered labels in Robotics Lab. Click one and the camera flies to it.
Strengths and pitfalls
Use these trade-offs when choosing a board in Robotics Lab.
Strengths
- 32-bit ARM core at 72 MHz — plenty of speed for motor control, filters and fast sensors
- Hardware-rich: 15 PWM channels, 12-bit ADC, three serial ports, CAN bus and native USB
- Fits a breadboard and leaves room for wires
- Real debugger support: step through code and watch variables with a cheap ST-Link
Watch out
- It is a 3.3 V board. Pins PA0–PA7, PB0, PB1, PB5 and PC13–PC15 are NOT 5 V tolerant — 5 V on them can kill the chip.
- Do not connect USB and an external supply on the 5V pin at the same time: there is no protection diode between them.
- The small 3.3 V regulator is only meant for light loads (roughly 100–300 mA depending on the clone). Power servos and motors from a separate supply, never from the board.
- PC13, PC14 and PC15 are weak pins (about 3 mA). The on-board LED on PC13 is inverted: LOW turns it on.
- After uploading through the serial bootloader, move the BOOT0 jumper back to 0 — otherwise your program will not start after reset.
Pins
Learn which pins to use on the Robotics Lab workbench.
Power
5V is connected straight to the USB socket; 3.3 is the regulator output. The chip itself runs on 3.3 V. Feed the board through USB or the 5V pin — not both — and keep the load on 3.3 small.
5 V tolerance
Most port B pins and PA8–PA15 accept 5 V signals as inputs. The analog-capable pins PA0–PA7, PB0, PB1, plus PB5 and PC13–PC15, do not: use a voltage divider or level shifter there.
Analog and PWM
Ten 12-bit analog inputs (0–3.3 V → 0–4095) sit on A0–A7, B0 and B1. Fifteen pins can output PWM from four hardware timers — enough for several motors and servos at once.
Communication
Serial 1 is on A9 (TX) and A10 (RX) — also used by the bootloader. I2C1 is on B6 (SCL) and B7 (SDA), SPI1 on A5/A6/A7, SPI2 on B13/B14/B15, USB on A11/A12.
Programming pins
The four pins on the end are the SWD port for an ST-Link. A13 and A14 are reserved for it, which is why they are not on the side rows. R is the reset line.
Hover over a pin in the Robotics Lab viewer to see its name and function.
- Power
- Ground
- Digital
- Analog
- Buses: UART, I²C, SPI
- Control: RESET, EN, BOOT
- Not connected
First code
Try the Robotics Lab starter example on your physical board.
// Arduino IDE with the "STM32 boards" core (STM32duino).// The on-board LED is wired between 3.3 V and pin PC13,// so it is inverted: LOW = on, HIGH = off.void setup() { pinMode(PC13, OUTPUT); // PC13 becomes an output}void loop() { digitalWrite(PC13, LOW); // LED on delay(200); // wait 0.2 s digitalWrite(PC13, HIGH); // LED off delay(800); // wait 0.8 s}
Where it shines
Use the Robotics Lab workbench to plan the wiring for a project.
- Line-follower or balancing robot with fast PID control loops
- Reading quadrature encoders with hardware timers
- CAN-bus node for a bigger robot (with an external transceiver)
- Custom USB device: gamepad, keyboard or sensor dongle
- Multi-servo and multi-motor controller using the 15 PWM channels
Board background
See how this hardware fits into the Robotics Lab board collection.
The nickname comes from the film The Matrix: the STM32duino community named this blue board the “Blue Pill”, and its red and black cousins the “Red Pill” and “Black Pill”.
The chip is sold as having 64 KB of flash, but on many boards the upper half of a 128 KB memory turns out to be there and usable — an unofficial bonus.
Many Blue Pills were built with the wrong USB pull-up resistor (10 kΩ instead of 1.5 kΩ). On some computers USB then refuses to work until the resistor is swapped.
Practice with this board
Try the same board in these Robotics Lab activities.
- Inspect the Robotics Lab 3D model to locate a component or connector.
- Try the Robotics Lab component quiz to check what you remember.
- Open the Robotics Lab workbench to simulate your wiring.
Sources
Manufacturer and hardware project documentation.
- STMicroelectronics STM32F103C8 product page
Microcontroller specifications and datasheet. The reference covers the chip, and carrier board layouts can vary.