Skip to content
/ Artim Public

Artim is an Arduino Runtime Control and Measurement library.

License

Notifications You must be signed in to change notification settings

thweit00/Artim

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Arduino Runtime Control and Measurement

Arduino Lint Compile Examples Doxygen Action

Introduction

The Arduino Runtime Control and Measurement library is a piece of code for the specific use-case of time discrete execution of the main loop e.g. for time triggered operations. Please check the Use Case section to see if this use case fits your needs.
In general there are two features supported:

  • Timing Control
  • Load Measurement

Timing Control

Artim checks the execution time consumed by the loop function. It compares the time with a configured desired loop cycle time (e.g. 200ms). If the desired loop time is not reached yet, it will wait till the desired loop time is reached. This helps you to have a time discrete behaviour of your loop function. If the desired loop time is already reached or the loop took longer, there will be no delay.

Load Measurement

Base on the desired loop time and the actual time needed, the load is calculated. Artim provides several API functions to read the load values.

  • Average Load
    The average load in %. The load for the last loop is calculated at the beginning of each new loop and the overall average is calculated.

  • Min Load
    Minimum observed load in % for a loop execution.

  • Max Load
    Maximum observed load in % for a loop execution.

  • Load Histogram
    The load histogram is a nice feature that gives you an overview in which load ranges your application runs.
    For each loop execution, the load is checked and a interval counter is incremented for the given load range. The range of 100% is diveded in 10% segments (0..9,9%, 10..19,9%, 20..20,9%, ...). There is also a counter for overload events available, when the acutal loop time exceeds the desired loop time.

Use Case

  • You want to execute your arduino loop-function in a fixed time interval (configurable at startup). E.g. you are in need of a fixed timing (e.g. 200ms, 1000ms, etc.).

API description

The API description can be found in the generated doxygen files:
API Documentation
Doxygen Documentation Start Page

Installation

To install the library, download the zip-file of the latest version and import it in the Arduino IDE.
The official Arduino documentation might help you: Arduino Tutorial
After you installed the library, you need to include the Artim.h header file. Have a look at the example code, provided with the library.

Closing Words

This code is the result of a hobby project. It was never inteded to be perfect. Nevertheless, I hope that it will help one or the other to achieve their goals with a little less effort.
Improvement proposals or pull requests are welcome.