Tutorial : using a real time clock (RTC) to perform  Measurements at regular intervals

Document created by jean-christophe Toussaint on Jun 23, 2018Last modified by Francesco Cariati on Jul 9, 2018
Version 3Show Document
  • View in full screen mode

A real-time clock (rtc) is a computer clock that keeps track of the current time.

RTCs are present in almost all electronic devices that require accurate timing.  


This presentation is aimed at helping users to make temperature, pressure and humidity

measurements at regular intervals. A BME280 sensor is used and communicates with a

stm32l476rg board via an I2C bus. Between two measurement times, both systems are placed in stop mode 2. A balance of current consumption is finally carried out.

A small library for driving I2C-BME280 sensor is provided strongly inspired by the one

kindly given by Baptiste Verneau.


The following equipment is used

  • NUCLEO-L476RG Board or equivalent and an I2C BME280 sensor
  • sw4stm32  with the necessary packages for Nucleo boards installed
  • OpenOCD or STLink USB Driver - STM32CubeMX


JC Toussaint full professor @ phelma Grenoble Institute of Technology

3 people found this helpful