Skip to main navigation Skip to search Skip to main content

Power Profiling on Ultra-Low Power Environmental Sensing
: The effect of code performance optimization techniques on the power consumption of ESP32 SoC

  • Hamed Talebi

Student thesis: Bachelor

Abstract

Sensors used in environmental sensing are designed to abide by harsh weather and
last longer. Energy consumption is a significant factor for those sensors which are
mounted in remote areas and run on a limited battery source. This study investigates
code optimization techniques used to make sensors energy efficient. We are looking
for code optimization techniques proven to be energy efficient while used in batterydriven
sensors. A structured literature review followed by a controlled lab experiment
was conducted to find the code optimization techniques and put them under the test
with a power profiler hardware. We used the Espressif ESP32-C3 microcontroller and
Power Profiler Kit II from Nordic Semiconductor in this research and investigated the
techniques in native microcontroller C and MicroPython code.

The programing methods; loop unrolling, function inlining, and non-volatile memory
selected for the lab experiment. Detailed steps, design decisions, and techniques
used in data collection are presented for the selected methods. Our analysis showed
MicroPython consumes less energy while interacting with serial communications. The
native C beats MicroPython in all mathematical calculations and data accessing. Both
MicroPython and native C presented the same results for non-volatile memory access.
We conclude that both loop unrolling and function inlining could optimize runtime
speed and save energy while we do not use any serial port interaction inside. Overall
MicroPython consumes very more energy compared to native C when there is no serial
communication in the code.
Date of Award2023-Jun
Original languageEnglish
SupervisorAli Hassan Sodhro (Supervisor) & Åke Arvidsson (Examiner)

Educational program

  • International programme in Software Development and Engineering

University credits

  • 15 HE credits

Swedish Standard Keywords

  • Other Electrical Engineering, Electronic Engineering, Information Engineering (20299)

Keywords

  • power profiling
  • energy optimization,
  • code optimization,
  • ultra-low powers sensors
  • ESP32,
  • PPK2

Cite this

'