Using Low Power STM32 MCU for Car Monitoring – Advice Needed

  • sikandarali's Avatar
    Banned
    Hi everyone,
    I’m working on a project that involves monitoring vehicle data using an STM32L4 microcontroller and Mbed OS. The idea is to keep the power consumption really low since the system needs to stay in the car and run off the battery long-term.
    I want the microcontroller to go into deep sleep and wake up every 10 seconds — probably using either the RTC or a low-power timer. I’ve tried a few things like ThisThread::sleep_for() and LowPowerTimer, but not sure which is actually best for keeping power usage down without affecting performance.
    If anyone has experience with this kind of setup, I’d really appreciate some pointers:

    • What’s the best way to handle periodic wake-ups in deep sleep using Mbed OS?
    • Is LowPowerTicker better than using the RTC interrupt?
    • Also, any tips for shutting off unused peripherals or GPIOs before going to sleep?
    The system is being built for a real-world auto service project: https://hqautocentre.co.uk/
    Any help would be great — cheers in advance!
  • 2 Replies

  • olduser's Avatar
    I looks as though you are you making a data logger, can you pick up a signal from the car system if new data is present, using this to wakeup the data logger avoiding the need for the ticker?

    If you look at ChatGPT, it appears to cover the different ways of shutting down the CPU and auxiliaries to conserve power in Mbed OS.
  • NMNeil's Avatar
    I've never used ST microcontrollers but I did something similar with a PIC16.
    From memory.

    Set the config file to have the watchdog timer set it's flag after 10 seconds.
    Set it to use the internal oscillator.
    Set it to use the sleep mode.
    So after boot the MCU immediately goes to sleep and the power consumption drops to nanoamps. After 10 seconds the watchdog timer flag sets, the MCU 'wakes up' and you temporarily disable the watchdog time so that your code can run, then you reset the watchdog timer and put the MCU back to sleep.
    ST has a help sheet if you want to go that way.
    https://wiki.st.com/stm32mcu/wiki/Ge...at_is_a_WDG_--