Engineers Garage

  • Electronic Projects & Tutorials
    • Electronic Projects
      • Arduino Projects
      • AVR
      • Raspberry pi
      • ESP8266
      • BeagleBone
      • 8051 Microcontroller
      • ARM
      • PIC Microcontroller
      • STM32
    • Tutorials
      • Audio Electronics
      • Battery Management
      • Brainwave
      • Electric Vehicles
      • EMI/EMC/RFI
      • Hardware Filters
      • IoT tutorials
      • Power Tutorials
      • Python
      • Sensors
      • USB
      • VHDL
    • Circuit Design
    • Project Videos
    • Components
  • Articles
    • Tech Articles
    • Insight
    • Invention Stories
    • How to
    • What Is
  • News
    • Electronic Product News
    • Business News
    • Company/Start-up News
    • DIY Reviews
    • Guest Post
  • Forums
    • EDABoard.com
    • Electro-Tech-Online
    • EG Forum Archive
  • DigiKey Store
    • Cables, Wires
    • Connectors, Interconnect
    • Discrete
    • Electromechanical
    • Embedded Computers
    • Enclosures, Hardware, Office
    • Integrated Circuits (ICs)
    • Isolators
    • LED/Optoelectronics
    • Passive
    • Power, Circuit Protection
    • Programmers
    • RF, Wireless
    • Semiconductors
    • Sensors, Transducers
    • Test Products
    • Tools
  • Learn
    • eBooks/Tech Tips
    • Design Guides
    • Learning Center
    • Tech Toolboxes
    • Webinars & Digital Events
  • Resources
    • Digital Issues
    • EE Training Days
    • LEAP Awards
    • Podcasts
    • Webinars / Digital Events
    • White Papers
    • Engineering Diversity & Inclusion
    • DesignFast
  • Guest Post Guidelines
  • Advertise
  • Subscribe

Microcontroller Project: STM32 low power modes analysis

By Usman ali Butt March 22, 2024

Power constraint is a critical consideration undertaken by designers when selecting a microcontroller for an application — particularly with IoT applications where power plays a vital role. IoT nodes are only useful in the field if they last for years or even a decade on a single battery.

The race for lower power devices between semiconductor manufactures is high, and every manufacturer has a dedicated line of SOC/MPU/MCU’s, which are categorized as low- or ultra-low power.

ATTINY 8-bit microcontroller series by ATMEL (now Microchip Technology) was considered to be the king of hibernation a decade ago. The fact that an ATTINY consumes 0.2µA in deep sleep mode earned them respect from engineers and became the top priority of designers for low power applications.

Today, ATtiny is incorporated various other microcontroller chips because of its rapid development in semiconductor scaling and power management benefits. However, due to diversity in applications and user requirements even in sleep mode (RTC, DMA, DAC active, etc.), it’s hard to develop consensus on who is pioneering the low power race.

In recent decades, 32-bit microcontrollers gained popularity. 8-bit microcontrollers mostly are 5 volts tolerant, whereas 32-bit microcontrollers stand at 3.3 volts. This power difference with compact design and more general-purpose input/output pins resulted in a sizeable market share for 32-bit MCU’s. Not only do 32-bit microcontrollers consume low power, but they offer other peripherals and protocols in a single chip.

In this tutorial, I will discuss and measure the power consumption of STM32F0xx 32-bit series microcontrollers offered by STMicroelectronics.

Stm32f0xx has three types of low power modes.

  • Stop Mode
  • Sleep Mode
  • Standby Mode

Stop mode features
In stop mode, the real-time clock is powered by LSI (low speed internal) clock source. HIS (High speed internal) and HSE (External) clock buses are turned off. The power regulator is in low power mode. The regulator in low power mode means flash is also in power-down mode. In stop mode, all clocks are stopped except the one connected to RTC. Exiting from stop mode is possible with real-time clock interrupt or any other global interrupt.

Sleep mode features
In sleep mode, the CPU of the processor goes to power-down mode. All the peripherals in the MCU are awake and running. For exiting from sleep mode, any global interrupt can be utilized, or any event(external/internal) can bring out the device from sleep to awake state.

Power can also be saved by disabling the peripherals and GPIO pins before going in the stop or sleep mode. This prevents any leakage current from draining out the battery.

Standby mode
In standby mode, all the clocks are stopped, and static RAM loses all its content. Only the RTC clock is active. Exiting from stand by mode starts the booting process, similar to resetting the MCU. The only difference is, with standby reset, RTC register contents are not lost, and RTC maintains data. Exiting from standby mode is possible with an external event on some dedicated MCU pins, or RTC alarm can bring the MCU out of standby mode.

Comparing the results

Ideal State
According to datasheet, STM32 consumes 12.7 mA of current during ideal conditions in run mode.

In my program code, I disabled all peripherals, made all GPIO’s analog to reduce any leakage, and save as much power as I can. Using an ammeter, the current consumption by MCU in run mode is recorded at 13.26 mA.

Sleep Mode State
The sleep mode code snap shoot is below. I enter the sleep mode by configuring all GPIOS as analog and disabling the GPIO’s clocks. Exiting from sleep mode is on EXTI external interrupt. push-button is mapped to EXTI pin.

According to datasheet, current consumption in sleep, state is 0.8mA.


Measuring the current consumption in sleep state, an ammeter shows 0.82mA.

Standby and stop modes
The easiest low power state in which MCU can enter is standby. Just one bit of a global power register is required to be set for entering into the standby mode. Before entering the standby mode, we must define the exit pin/protocol from standby mode. The code below is invoking the standby mode for stm32f051 microcontroller.

Stop mode requires plenty of registers to be updated for entering in it. Exiting from stop mode also requires many registers to be manipulated. To see the stop mode code, download the project code.

According to the data sheet in stop mode, 4uA of current is consumed, and standby consumes 3.3uA of current.

On the ammeter current consumption in stop mode is recorded as 7.4uA, and in standby mode, it is 4.6uA.

Exiting from all the low power states requires some bits/flags to be cleared. External and internal interrupts play a vital role in exiting from low power states. Peripheral interrupts, especially the real-time clock, need to be mastered to wake up from low power states.

I used the STM32F0 discovery development board to test the low power states.

I defined everything in the project code. On startup, the LEDs on the board blinks, and then MCU enters in the stop mode. RTC (real-time clock) interrupt is utilized to wake up from stop mode. RTC is programmed for 5 seconds. After 5 seconds, the MCU will exit from the stop mode.

Upon exiting from the stop mode led’s again blink, and after few blinks, MCU enters in sleep mode. To wake up from sleep mode, press the push button on the board. Again, upon exiting from sleep mode led’s blink, and finally, the MCU goes in standby mode. To exit from standby, press the pushbutton. Standby resets the MCU and execution starts from the beginning.

The project code is written and compiled in Keil uVision ide. You can Download Code.

Where can you buy parts?
STM32f0 discovery

Ammeter

You may also like:


  • What are the top development boards for AI and ML?
  • beginners guide
    Basic Electronics 01 – Beginners guide to setting up an…

  • What are LoRa gateways and what types are available?

  • What are the components of robotic arms and industrial robots?

  • What are the top tools for developing embedded software?

  • What is the Modbus protocol and how does it work?

Filed Under: Electronic Projects, STM32
Tagged With: stmicroelectronicsinc
 

Next Article

← Previous Article
Next Article →

Questions related to this article?
👉Ask and discuss on Electro-Tech-Online.com and EDAboard.com forums.



Tell Us What You Think!! Cancel reply

You must be logged in to post a comment.

EE TECH TOOLBOX

“ee
Tech Toolbox: 5G Technology
This Tech Toolbox covers the basics of 5G technology plus a story about how engineers designed and built a prototype DSL router mostly from old cellphone parts. Download this first 5G/wired/wireless communications Tech Toolbox to learn more!

EE Learning Center

EE Learning Center
“engineers
EXPAND YOUR KNOWLEDGE AND STAY CONNECTED
Get the latest info on technologies, tools and strategies for EE professionals.

HAVE A QUESTION?

Have a technical question about an article or other engineering questions? Check out our engineering forums EDABoard.com and Electro-Tech-Online.com where you can get those questions asked and answered by your peers!


RSS EDABOARD.com Discussions

  • No Output Voltage from Voltage Doubler Circuit in Ansys Nexxim (Harmonic Balance Simulation)
  • Discrete IrDA receiver circuit
  • How do loop recording and G-sensors work on front and rear dash cams?
  • Getting different output for op amp circuit
  • Resistor Selection for Amplifier Layout

RSS Electro-Tech-Online.com Discussions

  • PIC KIT 3 not able to program dsPIC
  • Wideband matching an electrically short bowtie antenna; 50 ohm, 434 MHz
  • using a RTC in SF basic
  • Relay buzzing after transformer change?
  • Back to the old BASIC days

Featured – RPi Python Programming (27 Part)

  • RPi Python Programming 21: The SIM900A AT commands
  • RPi Python Programming 22: Calls & SMS using a SIM900A GSM-GPRS modem
  • RPi Python Programming 23: Interfacing a NEO-6MV2 GPS module with Raspberry Pi
  • RPi Python Programming 24: I2C explained
  • RPi Python Programming 25 – Synchronous serial communication in Raspberry Pi using I2C protocol
  • RPi Python Programming 26 – Interfacing ADXL345 accelerometer sensor with Raspberry Pi

Recent Articles

  • GigaDevice launches GD32C231 MCU series with 48MHz Cortex-M23 core and 64KB Flash
  • Advanced Energy releases 425 W CF-rated medical power supply in 3.5 x 6 x 1.5-inch format”
  • LEM combines shunt and Hall effect sensing in 2000 A current measurement unit
  • What is AWS IoT Core and when should you use it?
  • AC-DC power supply extends voltage range to 800 V DC

EE ENGINEERING TRAINING DAYS

engineering

Submit a Guest Post

submit a guest post
Engineers Garage
  • Analog IC TIps
  • Connector Tips
  • Battery Power Tips
  • DesignFast
  • EDABoard Forums
  • EE World Online
  • Electro-Tech-Online Forums
  • EV Engineering
  • Microcontroller Tips
  • Power Electronic Tips
  • Sensor Tips
  • Test and Measurement Tips
  • 5G Technology World
  • Subscribe to our newsletter
  • About Us
  • Contact Us
  • Advertise

Copyright © 2025 WTWH Media LLC. All Rights Reserved. The material on this site may not be reproduced, distributed, transmitted, cached or otherwise used, except with the prior written permission of WTWH Media
Privacy Policy

Search Engineers Garage

  • Electronic Projects & Tutorials
    • Electronic Projects
      • Arduino Projects
      • AVR
      • Raspberry pi
      • ESP8266
      • BeagleBone
      • 8051 Microcontroller
      • ARM
      • PIC Microcontroller
      • STM32
    • Tutorials
      • Audio Electronics
      • Battery Management
      • Brainwave
      • Electric Vehicles
      • EMI/EMC/RFI
      • Hardware Filters
      • IoT tutorials
      • Power Tutorials
      • Python
      • Sensors
      • USB
      • VHDL
    • Circuit Design
    • Project Videos
    • Components
  • Articles
    • Tech Articles
    • Insight
    • Invention Stories
    • How to
    • What Is
  • News
    • Electronic Product News
    • Business News
    • Company/Start-up News
    • DIY Reviews
    • Guest Post
  • Forums
    • EDABoard.com
    • Electro-Tech-Online
    • EG Forum Archive
  • DigiKey Store
    • Cables, Wires
    • Connectors, Interconnect
    • Discrete
    • Electromechanical
    • Embedded Computers
    • Enclosures, Hardware, Office
    • Integrated Circuits (ICs)
    • Isolators
    • LED/Optoelectronics
    • Passive
    • Power, Circuit Protection
    • Programmers
    • RF, Wireless
    • Semiconductors
    • Sensors, Transducers
    • Test Products
    • Tools
  • Learn
    • eBooks/Tech Tips
    • Design Guides
    • Learning Center
    • Tech Toolboxes
    • Webinars & Digital Events
  • Resources
    • Digital Issues
    • EE Training Days
    • LEAP Awards
    • Podcasts
    • Webinars / Digital Events
    • White Papers
    • Engineering Diversity & Inclusion
    • DesignFast
  • Guest Post Guidelines
  • Advertise
  • Subscribe