Raspberry Pi Pico weather display (MicroPython)
Your first MicroPython project: temperature and humidity on an OLED.
Shop by category
Shop all componentsSTM32 chips power many products. A Nucleo board has an ST-LINK programmer built in; small STM32F103 boards need a separate ST-LINK on their SWD pins. With the STM32duino core you can use familiar Arduino code on both, then move on to STM32CubeIDE when you need full control.
Power the small board from either the ST-LINK or USB, never both.
Tick anything you already have and the total updates.
Bonus: the same ST-LINK V2 programs this 8-bit STM8 board over SWIM
Follow the colours: red is power, dark grey is ground, blue is a signal.
stm32_blink_button.ino// Nucleo-F446RE: LED_BUILTIN is PA5, USER_BTN is PC13 (pressed = LOW)
// STM32F103 board: change LED to PC13 (lit when LOW) and use an external button on PB12
#ifndef USER_BTN
#define USER_BTN PB12
#endif
const int LED = LED_BUILTIN;
void setup() {
pinMode(LED, OUTPUT);
pinMode(USER_BTN, INPUT_PULLUP);
Serial.begin(115200);
}
void loop() {
static bool last = HIGH;
bool now = digitalRead(USER_BTN);
if (now == LOW && last == HIGH) Serial.println("Button pressed");
last = now;
digitalWrite(LED, (millis() / 500) % 2); // blink twice a second
delay(10);
}
The sketch above runs here on a simulated board. Move the sliders for the sensors and buttons it reads, and watch the Serial monitor, display and outputs change.
Update the ST-LINK firmware with STM32CubeProgrammer and check SWDIO and SWCLK are not swapped.
Some boards have a clone chip; set the BOOT0 jumper to 0 and press reset.
Its USB port needs a USB bootloader; use a USB-serial adapter on PA9/PA10 instead.
The Arduino core is quickest to start; CubeIDE gives full access to timers, DMA and low-power modes.
Many pins are, but not all; treat it as a 3.3 V part.
Yes, with the ST-LINK in STM32CubeIDE.
6 parts: STMicroelectronics NUCLEO-F446RE Development Board, STM32F103C8T6 Mini Development Board, ST-Link V2 Programmer for STM8 and STM32 MCUs, STM8S103F3P6 STM8 Minimum System Development Board, Solderless Breadboard and Dupont Jumper Wires (40 pcs). On this page you can tick the parts you already have and add only the rest to your cart.
It is a intermediate project and takes about 2 hours. The build on this page has 6 steps.
No. This page has the complete, tested code (stm32_blink_button.ino).
Yes. The Run it panel under the code runs this exact sketch on a simulated board. Move the sliders or press the buttons for the sensors it reads, and the Serial monitor, display and outputs react as they will on the real build. It is a simulation, so real readings depend on your parts and wiring.
About ₹2,979 for the parts at the prices on this page. Quantity price breaks lower the cost when you build several.
SWD programming with an ST-LINK; Pin names like PA5 and PC13; Serial over the ST-LINK virtual COM port.
Power the small board from either the ST-LINK or USB, never both.
Ideas that reuse this build: Program a bare AVR chip on a breadboard. They are listed under Take it further on this page.
Your first MicroPython project: temperature and humidity on an OLED.
A web page with ON and OFF buttons that switches a relay over Wi-Fi.
A warm ring light that fades up at dusk and down at dawn.
Turn a Pi and a touchscreen into a home command centre with a clock and to-do list.
Learning project. Check every circuit and the datasheet of each part before you power it up.
A simulation of the sketch above, so you know what to expect. Real readings vary with your parts and wiring.