Skip to content

An interface to the Arduino's internal temperature (diode reference) and supply voltage (bandgap reference).

License

Notifications You must be signed in to change notification settings

sekdiy/CoreSensors

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CoreSensors Library Version Build Status analytics

CoreSensors is an Arduino library that supports measuring the AVR's internal temperature and supply voltage.

What

The CoreSensors library allows arduino programs to determine the actual MCU temperature and supply voltage without external components.

Why

Your arduino might run on battery power. In that case CoreSensors helps to supervise the voltage without having to rely on external components.

Or your project might get hot (or cold). CoreSensors can tell you how hot the Arduino MCU chip gets, independent of sensors in other parts of your project.

Example

#include "CoreSensors.h"

void setup()
{
  Serial.begin(115200);
}

void loop()
{
  // update sensor measurements
  CoreSensor.process();

  // output results
  Serial.print(CoreSensor.getTemperature()); Serial.print(" degC, ");
  Serial.print(CoreSensor.getTemperature(true)); Serial.print(" degF, ");
  Serial.print(CoreSensor.getVoltage()); Serial.println(" V");

  // wait a second
  delay(1000);
}

This example takes a measurement, displays the core temperature (both in °C and in °F) as well as the core voltage and then repeats.

A more complex example is also provided with the library. It demonstrates scheduling and processing the two sensors independently.

How

CoreSensors employs two properties that are built into the Arduino:

  • an internal substrate diode that can measure temperature,
  • an internal bandgap reference that works independent of the supply voltage.

The library is aware of different Arduino types, clock speeds and supply voltages. It also features a noise reduction mode and averaging, which improves speed and repeatability.

Calibration

Since the sensors aren't comparable with high precision external sensors, they can use some individual calibration in order to improve precision.

The CoreSensors library provides you with a way to calibrate each individual Arduino (by taking two reference measurements and applying a simple formula, e.g. see Albert van Dalen and Oregon Embedded).

Note

This library defines a dummy ADC_vect interrupt service handler routine. In case your code requires its own ADC_vect routine, you can simply replace the one in this library without any negative impact. But please keep in mind that the order of include statements in your code might influence which ADC_vect routine will actually be applied.

About

An interface to the Arduino's internal temperature (diode reference) and supply voltage (bandgap reference).

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published