kramann.info
© Guido Kramann

Login: Passwort:










kramann.info
© Guido Kramann

Login: Passwort:




Use of the temperature sensor on the BMA423 chip (accelerometer)

(EN google-translate)

(PL google-translate)

  • In addition to the three-axis acceleration sensor, the BMA423 chip also has a temperature sensor.
  • The TTGO_TWatch_Library-1.4.3 library also provides a BMA class, which in turn contains the float temperature() method.
  • The following shows how to find this out:

STEP #1:
Examples that use the acceleration sensor use the acceleration() method:

void loop() 
{
    acceleration();
    ...
}

STEP #2:
Within the acceleration method in the functions.h tab, you will find:
bool res = sensor->getAccel(acc);
...which refers to the object sensor.

STEP #3:
The sensor object is created in the twatch.h tab.
You can see that it is of type BMA:

BMA *sensor;
...
sensor = watch->bma;

STEP #4:
Im Verzeichnis..
/home/fhbstud/Arduino/libraries/TTGO_TWatch_Library-1.4.3/src/drive/bma423/
...in the header file for class BMA bma.h, there is a reference to the method 
...there is the method float temperature();

...This is now being tested:

Code 0-1: Examination of the functions and libraries provided.


The methods in the BMA class indicate that additional functionality is directly supported, such as the pedometer.


Sample program for reading the temperature:

  • Again, this is a replacement for the first tab in the base project TWATCH_PROC023
  • The code for reading the temperature has been supplemented with a simple program for reading the acceleration values.
#include "twatch.h"
#include "variables.h"
#include "functions.h"

void setup() 
{
    setupTWATCH();
    setFont(1, 255,255,255,  255,0,0);
    backlight(true); 
}

void loop() 
{
    clear();
    acceleration();

    cursor(0,0);

    editor(accX); 
    editor('\n');

    editor(accY); 
    editor('\n');

    editor(accZ); 
    editor('\n');

    float temp = sensor->temperature();
    editor(temp);
    editor('\n');
    
    delay(100);
}

Code 0-2: Sample program for reading the temperature.

Experiment

  • When storing the watch in rooms with different temperatures, or after warming it in your hand, a relative temperature difference was noticeable.
  • However, the displayed temperature is significantly higher (31-34 degrees instead of 20-23 degrees) than the room temperature, which is probably due to the fact that the measurement is taken on the sensor chip and the watch itself generates heat.
  • It takes several minutes for the displayed temperature to stabilize at a stable value after a change in the outside temperature.