Anton Bondarenko
Created February 10, 2020

Transportation conditions logging monitor

A small pill to drop in any parcel or container or just wear which will monitor and log all physical conditions along the path.

BeginnerShowcase (no instructions)44

Things used in this project

Hardware components

RSL10-SENSE-DB-GEVK
ON Semiconductor RSL10-SENSE-DB-GEVK
×1
Raspberry Pi 4 Model B
Raspberry Pi 4 Model B
×1
SparkFun IMU Breakout - MPU-9250
SparkFun IMU Breakout - MPU-9250
×1
Jumper wires (generic)
Jumper wires (generic)
×1
Breadboard (generic)
Breadboard (generic)
×1

Software apps and online services

Raspbian
Raspberry Pi Raspbian
pygatt lib
draw.io by JGraph Inc.
Free icons for draw.io by Prosymbols, Freepik, Payungkead, Those Icons, srip, ultimatearm, monkik, Eucalyp, DinosoftLabs and Flat Icons
FaBo9AXIS-MPU9250-Python

Hand tools and fabrication machines

Soldering iron (generic)
Soldering iron (generic)

Story

Read more

Code

(Raspberry Pi) Python script for RSL10 Sense board sensors polling over BLE

Python
The script is using pygatt library for BLE (https://github.com/peplin/pygatt)
# RSL10 Sense Board Pooling
# Tested with Raspberry Pi 4
# anton_bondarenko at yahoo.com

import os
import sys
import traceback
import time
import datetime
import csv
import pygatt

#------------------------------------------------------------------------

# Sensor polling configuration
sensors = [
# token, node, prop, title, ...     
    ['a', 'AL', 'L',   'Ambient light, Lux', True, True, False],
    ['b', 'EV', 'T',   'Temperature, Deg.C', True, True, False],
    ['c', 'EV', 'P',   'Pressure, kPa', True, True, False],
    ['d', 'EV', 'H',   'Humidity, %', True, True, False],
    ['f', 'AO', 'H',   'Compas heading, Deg.', True, True, True],
    ['g', 'AO', 'P',   'Device pitch, Deg.', True, True, True],
    ['h', 'AO', 'R',   'Device roll, Deg.', True, True, True],
#    ['i', 'AO', 'GX',  'Gravity vector X axis, m/sqr(s)', True, True, True],
#    ['j', 'AO', 'GY',  'Gravity vector Y axis, m/sqr(s)', True, True, True],
#    ['k', 'AO', 'GZ',  'Gravity vector Z axis, m/sqr(s)', True, True, True],
    ['l', 'AO', 'AX',  'Linear acceleration X axis, m/sqr(s)', True, True, True],
    ['m', 'AO', 'AY',  'Linear acceleration Y axis, m/sqr(s)', True, True, True],
    ['n', 'AO', 'AZ',  'Linear acceleration Z axis, m/sqr(s)', True, True, True],
    ['o', 'AO', 'MX',  'Magnetic field strength X axis, muT (micro Tesla)', True, True, True],
    ['p', 'AO', 'MY',  'Magnetic field strength Y axis, muT (micro Tesla)', True, True, True],
    ['q', 'AO', 'MZ',  'Magnetic field strength Z axis, muT (micro Tesla)', True, True, True],
    ['r', 'AO', 'ARX', 'Angular rate X axis, Dps (Degrees per second)', True, True, True],
    ['s', 'AO', 'ARY', 'Angular rate Y axis, Dps (Degrees per second)', True, True, True],
    ['t', 'AO', 'ARZ', 'Angular rate Z axis, Dps (Degrees per second)', True, True, True],
#    ['0', 'AO', 'C',   'Calibration status', True, True, False]
]

#------------------------------------------------------------------------       

clear_scr = True
clear_timeout = 2

def sysexit():
    global adapter
    traceback.print_exc()
    adapter.stop()   
    sys.exit()

try:
    adapter = pygatt.GATTToolBackend()
    adapter.start()
    ADDR =  "60:C0:BF:28:93:8A"
    device  = adapter.connect(ADDR)

# Warm-up   
    rq_no = 0
    ts = time.time()
    if clear_scr:
        os.system('clear')
    print   '==== RSL10 Sense Board Sensor Polling Script =========================='
    print   'Poll No.: %i' % rq_no
    for i in range(len(sensors)):
        s = sensors[i]
        device.char_write('e093f3b7-00a3-a9e5-9eca-40036e0edc24',   
            bytearray(s[0]+'/'+s[1]+'/'+s[2]), wait_for_response=s[4])
        _, _,   prop = device.char_read('e093f3b6-00a3-a9e5-9eca-40026e0edc24', timeout=30).split('/')
        if s[6]:
            prop = float(prop)
        print sensors[i][3] + ':    ', prop 
    print   'Poll RTT: %0.2f' % (time.time() - ts)
    if clear_scr:
            time.sleep(clear_timeout)
        
# Polling loop      
    active = True
    while(active):
        ts = time.time()
        rq_no += 1
        if clear_scr:
            os.system('clear')
            print   '==== RSL10 Sense Board Sensor Polling Script =========================='
        else:   
            print   '======================================================================='
        print   'Poll No.: %i' % rq_no     
        for i in range(0, len(sensors)):
            s = sensors[i]
            device.char_write('e093f3b7-00a3-a9e5-9eca-40036e0edc24', 
                bytearray(s[0]+'/'+s[1]+'/'+s[2]),  wait_for_response=s[5])
            _, _, prop = device.char_read('e093f3b6-00a3-a9e5-9eca-40026e0edc24', timeout=4).split('/')
            if s[6]:
                prop = float(prop)
            print sensors[i][3] + ':    ', prop 
        print   'Poll RTT: %0.2f, sec.' % (time.time() - ts)
        if clear_scr:
            time.sleep(clear_timeout)
except:
    sysexit()
    
adapter.stop()
sys.exit()  

Transportation Condition Logging Monitor

Python
The main project application
#------------------------------------------------------------------------
# OnSemi RSL10Sense Board
# https://www.hackster.io/contests/OnSemi
# Transportation Condition Logging Monitor v.0.3
# Tested with Raspberry Pi 4
# anton_bondarenko at yahoo.com
#------------------------------------------------------------------------

import os
import sys
import traceback
import time
import math
import datetime
import csv
import pygatt
import FaBo9Axis_MPU9250
import numpy as np

#------------------------------------------------------------------------
# System configuration
#------------------------------------------------------------------------

_log                            =       True
_log_size                       =       1000
_debug                          =       False

#------------------------------------------------------------------------
# Detector configuration
#------------------------------------------------------------------------

_ambient_light_threshold        =       200                 # lux
_temperature_high_thresold      =       35                  # deg Celcius
_temperature_low_thresold       =       15                  # deg Celcius
_humidity_high_threshold        =       65                  # %
_humidity_low_threshold         =       20                  # %
_accelerometer_threshold        =       10                  # mpss
# _accelerometer_delta          =       25                  # mpss
_magnetometer_delta             =       10                  # %
_magnetometer_angle             =       math.radians(15)    # deg
_magnetometer_change_delta      =       15                  # %
_magnetometer_change_angle      =       15                  # %
# _position_delta               =       0.1                 # meter
# _orientation_delta            =       10                  # deg   

#------------------------------------------------------------------------
# Miscelaneous classes and functions
#------------------------------------------------------------------------
        
# Terminal output formats
class TermCo:
    OK = '\033[92m\033[1m'
    WARNING = '\033[93m\033[1m'
    ALARM = '\033[91m\033[1m'
    NORMAL = '\033[0m'
    BOLD = '\033[1m'
    UNDERLINE = '\033[4m'

def highlight(style, value):
    return style + str(value) + TermCo.NORMAL

def fstr(v):
    if isinstance(v, float):
        return "%.4f" % v
    else:
        return str(v)
    
# Encoder and Decoder for status variable
StatusDec = [highlight(TermCo.OK, 'Normal'), 
             highlight(TermCo.WARNING, 'Warning'), 
             highlight(TermCo.ALARM, 'Alarm')]

StatusText = ['Normal', 'Warning', 'Alarm']

class Status:
    normal = 0
    warning = 1
    alarm = 2

#------------------------------------------------------------------------
# RSL10 Sense Board
#------------------------------------------------------------------------

class Sensor:
    def __init__(self, device, id):
        self.device = device
        self.id = id
        self.current = 'Undefined'
        self.previous = 'Undefined'
        self.current_ts = -1
        self.previous_ts = -1
        
    def update(self, value):
        self.previous = self.current
        self.previous_ts = self.current_ts
        self.current = value
        self.current_ts = time.time()

def get_sensor(device, id, c, p, ts_c, ts_p):
    s = Sensor(device, id)
    s.device = device
    s.id = id
    s.current = c
    s.previous = p
    s.current_ts = ts_c
    s.previous_ts = ts_p
    return s        
        
def poll(sensors):
    for s in sensors:
        s.get()

class RSL10Sense:

    AMBIENT_LIGHT = 0
    TEMPERATURE = 1
    PRESSURE = 2
    HUMIDITY = 3
    YAW = 4
    PITCH = 5
    ROLL = 6
    AX = 7
    AY = 8
    AZ = 9
    MX = 10
    MY = 11
    MZ = 12
    AV = 13 # virtual aggegate
    OV = 14 # virtual aggegate
    MV = 15 # virtual aggegate
    
    sensor_cfg = [
        ['Ambient light', 'Lux', 'a', 'AL', 'L', True, True],
        ['Temperature', 'Deg.C', 'b', 'EV', 'T', True, True],
        ['Pressure', 'kPa', 'c', 'EV', 'P', True, True],
        ['Humidity', '%', 'd', 'EV', 'H', True, True],
        ['Compas yaw', 'Deg.', 'f', 'AO', 'H', True, True],
        ['Device pitch', 'Deg.', 'g', 'AO', 'P', True, True],
        ['Device roll', 'Deg.', 'h', 'AO', 'R', True, True],
        ['Linear acceleration X axis', 'mpss', 'l', 'AO', 'AX', True, True],
        ['Linear acceleration Y axis', 'mpss', 'm', 'AO', 'AY', True, True],
        ['Linear acceleration Z axis', 'mpss', 'n', 'AO', 'AZ', True, True],
        ['Magnetic field strength X axis', 'muT', 'o', 'AO', 'MX', True, False],
        ['Magnetic field strength Y axis', 'muT', 'p', 'AO', 'MY', True, False],
        ['Magnetic field strength Z axis', 'muT', 'q', 'AO', 'MZ', True, False],
        ['Acceleration vector', '3 x mpss'],
        ['Orientation vector', '3 x Deg.'],
        ['Magnetic field vector', '3 x muT']
]

    def __init__(self, addr = False):
        self.status = 'Disconnected'
        self.adapter = pygatt.GATTToolBackend()
        self.sensors = []
        if addr:
            self.adapter.start()
            self.ADDR = "60:C0:BF:28:93:8A"
            self.device = self.adapter.connect(self.ADDR, auto_reconnect=True)
            for i in range(16):
                s = Sensor(self, i)
                self.sensors.append(s)
                self.get(i, warm_up = True)
            self.status = 'Connected'   
        
    def connect(self, addr):
        self.adapter.start()
        self.ADDR = "60:C0:BF:28:93:8A"
        self.device = adapter.connect(self.ADDR, auto_reconnect=True)
        for i in range(16):
            s = Sensor(self, i)
            self.sensors.append(s)
            self.get(i, warm_up = True)
        self.status = 'Connected'

    def get(self, sensor, warm_up = False):
        s = self.sensor_cfg[sensor]
        if sensor >= 13:
            if sensor == self.AV:
                self.sensors[sensor].update([self.sensors[self.AX].current,
                                             self.sensors[self.AY].current,
                                             self.sensors[self.AZ].current])
                return self.sensors[sensor]
            elif sensor == self.OV:
                self.sensors[sensor].update([self.sensors[self.YAW].current,
                                             self.sensors[self.PITCH].current,
                                             self.sensors[self.ROLL].current])
                return self.sensors[sensor]
            elif sensor == self.MV:
                self.sensors[sensor].update([self.sensors[self.MX].current,
                                             self.sensors[self.MY].current,
                                             self.sensors[self.MZ].current])
                return self.sensors[sensor]
            else:
                return 'Unlnown sensor Id'
        else:   
            if warm_up:
                wfr = s[6]
            else: 
                wfr = s[5]
            try:    
                self.device.char_write('e093f3b7-00a3-a9e5-9eca-40036e0edc24', 
                    bytearray(s[2]+'/'+s[3]+'/'+s[4]), wait_for_response=wfr)
                _, _, prop = self.device.char_read('e093f3b6-00a3-a9e5-9eca-40026e0edc24', 
                                              timeout=4).split('/')
            except (KeyboardInterrupt, SystemExit):
                if _debug:  
                    print 'Aborted'
                rsl.adapter.stop()
                sys.exit()
            except:
                self.sensors[sensor].update('Timeout')
                if _debug:
                    print highlight(TermCo.ALARM, 'Sensor data acquizition failure')
                    exc_type, exc_value, exc_traceback = sys.exc_info()
                    print("*** Traceback:")
                    traceback.print_tb(exc_traceback, file=sys.stdout) # limit=1, 
                    print("*** Exception:")
                    traceback.print_exception(exc_type, exc_value, exc_traceback, file=sys.stdout)
                    print sys.exc_info()                               # limit=2,
            else:
                self.sensors[sensor].update(float(prop))
            """ if prop == 0:
                    self.sensors[sensor].update('Undefined')
                else:
                    self.sensors[sensor].update(float(prop)) """
            return self.sensors[sensor].current
        
    def poll(self):
        for i in range(16):
            self.get(i)
            
#------------------------------------------------------------------------
# MPU9250 Sense Board
#------------------------------------------------------------------------

class MPU9250:
    A = 0 # Aggregate
    G = 1 # Aggregate
    M = 2 # Aggregate
    AX = 3 # Virtual
    AY = 4 # Virtual
    AZ = 5 # Virtual
    GX = 6 # Virtual
    GY = 7 # Virtual
    GZ = 8 # Virtual
    MX = 9 # Virtual
    MY = 10 # Virtual
    MZ = 11 # Virtual
    
    sensor_cfg = [
        ['Acceleration vector', '3 x raw'],
        ['Gyroscope vector', '3 x raw.'],
        ['Magnetic field vector', '3 x raw'],
        ['Linear acceleration X axis', 'raw'],
        ['Linear acceleration Y axis', 'raw'],
        ['Linear acceleration Z axis', 'raw'],
        ['Gyrospope X axis', 'raw'],
        ['Gyrospope Y axis', 'raw'],
        ['Gyrospope Z axis', 'raw'],
        ['Magnetic field strength X axis', 'raw'],
        ['Magnetic field strength Y axis', 'raw'],
        ['Magnetic field strength Z axis', 'raw']
    ]   
    
    def __init__(self):
        self.device = FaBo9Axis_MPU9250.MPU9250()
        self.status = 'Connected'
        self.sensors = []
        for i in range(12):
            s = Sensor(self, i)
            self.sensors.append(s)
            self.get(i)
        
    def get(self, sensor):
        if sensor == self.A:
            s = self.device.readAccel()
            self.sensors[self.A].update([s['x'], s['y'], s['z']])
            return self.sensors[self.A]
        elif sensor == self.G:
            s = self.device.readGyro()
            self.sensors[self.G].update([s['x'], s['y'], s['z']])
            return self.sensors[self.G]
        elif sensor == self.M: 
            s = self.device.readMagnet()
            self.sensors[self.M].update([s['x'], s['y'], s['z']])
            return self.sensors[self.M]
        elif sensor <= 11:
            self.sensors[sensor].update(self.sensors[sensor / 3 - 1].current[sensor % 3])
            return self.sensors[sensor]
        else:
            return 'Unknown sensor Id'
        
    def poll(self):
        for i in range(12):
            self.get(i)
        
#------------------------------------------------------------------------
# Hardware-agnostic sensor value analysis
#------------------------------------------------------------------------       

""" Checks if scalar sensor value went below/above given threshold
Parameters:
    sensor - scalar sensor object
    threshold - value boundary
    less = true means check if value is below threshold. Otherwise checks if the value is above
Parameter check:
    sensor current value must be defined
Output:
    status, report message """
def scalar_threshold(sensor, threshold, less=True):
    status = Status.normal
    if sensor.current == 'Timeout' or sensor.current == 'Undefined':
        status = Status.warning
        message = sensor.device.sensor_cfg[sensor.id][0] + \
                  highlight(TermCo.WARNING, ' value is undefined')
    elif (less and sensor.current > threshold) or (not less and sensor.current < threshold):
        status = Status.alarm
        message = sensor.device.sensor_cfg[sensor.id][0] + ' threshold (' + \
                  str(threshold) + ') reached: ' +  highlight(TermCo.ALARM, str(sensor.current))
    else:
        message = sensor.device.sensor_cfg[sensor.id][0] + ' threshold (' + \
                  str(threshold) + ') check passed: ' +  highlight(TermCo.OK, str(sensor.current))
    return status, message      

# Checks if scalar sensor value varied more than given percent  
#def scalar_change(sensor, delta):

# Checks if scalar sensor value differs more than given percent from another value  
#def scalar_delta(sensor, delta):   

""" Checks if the length of 3-coordinated vector sensor went below/above given threshold
Parameters:
    vector - vector sensor object
    threshold - value boundary
    less = true means check if value is below threshold. Otherwise checks if the value is above
Parameter check:
    sensor current values must be defined
Output:
    status, report message """
def vector_threshold(vector, threshold, less=True):
    status = Status.normal
    if vector.current == 'Timeout' or vector.current == 'Undefined' or \
       vector.current[0] == 'Timeout' or vector.current[0] == 'Undefined' or \
       vector.current[1] == 'Timeout' or vector.current[1] == 'Undefined' or \
       vector.current[2] == 'Timeout' or vector.current[2] == 'Undefined':
        status = Status.warning
        message = vector.device.sensor_cfg[vector.id][0] + \
                  highlight(TermCo.WARNING, ' value is undefined')
    else:
        vc = np.array(vector.current)
        value = np.sqrt(vc.dot(vc))
        if (less and value > threshold) or (not less and value < threshold):
            status = Status.alarm
            message = vector.device.sensor_cfg[vector.id][0] + ' norm threshold (' + \
                      str(threshold) + ') reached: ' +  highlight(TermCo.ALARM, fstr(value))
        else:
            message = vector.device.sensor_cfg[vector.id][0] + ' threshold (' + \
                      str(threshold) + ') check passed: ' +  \
                      highlight(TermCo.OK, fstr(value))
    return status, message  

""" Checks if length or angle of 3-coordinated vector changed outside of the threshold   
Parameters:
    vector - vector sensor object
    delta - norm change boundary
    angle - direction change boundary
    sensor current and previous values must be defined
Output:
    status, report message """
def vector_change(vector, delta, angle):   
    status = Status.normal
    if vector.current == 'Timeout' or vector.current == 'Undefined' or \
       vector.current[0] == 'Timeout' or vector.current[0] == 'Undefined'or \
       vector.current[1] == 'Timeout' or vector.current[1] == 'Undefined'or \
       vector.current[2] == 'Timeout' or vector.current[2] == 'Undefined' or \
       vector.previous == 'Timeout' or vector.previous == 'Undefined'or \
       vector.previous[0] == 'Timeout' or vector.previous[0] == 'Undefined'or \
       vector.previous[1] == 'Timeout' or vector.previous[1] == 'Undefined'or \
       vector.previous[2] == 'Timeout' or vector.previous[2] == 'Undefined':
        status = Status.warning
        message = vector.device.sensor_cfg[vector.id][0] + \
                  highlight(TermCo.WARNING, ' value is undefined')
    else:
        vc = np.array(vector.current)
        vp = np.array(vector.previous)
        lc = np.sqrt(vc.dot(vc))
        lp = np.sqrt(vp.dot(vp))
        if abs(lc*lp) < 0.0000000000001:
            message = vector.device.sensor_cfg[vector.id][0] + highlight(TermCo.WARNING, ' is undefined')
            status = Status.warning
        else:   
            _delta = abs(lc - lp)*100/lp
            _angle = math.acos(vc.dot(vp)/(lc*lp))
            if (_delta > delta) or (_angle > angle):
                status = Status.alarm
                message = vector.device.sensor_cfg[vector.id][0] + ' change check failed, \n delta: ' + \
                          highlight(TermCo.ALARM, fstr(_delta)) + ' / ' + fstr(delta) + ',\n angle: ' + \
                          highlight(TermCo.ALARM, fstr(_angle)) + ' / ' + fstr(angle)
            else:
                message = vector.device.sensor_cfg[vector.id][0] + ' change check passed, \n delta:  ' + \
                          highlight(TermCo.OK, fstr(_delta)) + ' / ' + fstr(delta) + ',\n angle: ' + \
                          highlight(TermCo.OK, fstr(_angle)) + ' / ' + fstr(angle)
    return status, message  

""" Checks if the delta of length or angle between 3-dim vectors changed outside of the set threshold
Parameters:
    vector1, vector1 - compared vector sensor objects
    delta - norm delta boundary
    angle - angle delta boundary
    vectors' both current and previous values must be defined
Output:
    status, report message """
def vector_delta(vector1, vector2, delta, angle):      
    status = Status.normal
    if vector1.current == 'Timeout' or vector1.current == 'Undefined' or \
       vector1.current[0] == 'Timeout' or vector1.current[0] == 'Undefined'or \
       vector1.current[1] == 'Timeout' or vector1.current[1] == 'Undefined'or \
       vector1.current[2] == 'Timeout' or vector1.current[2] == 'Undefined' or \
       vector1.previous == 'Timeout' or vector1.previous == 'Undefined'or \
       vector1.previous[0] == 'Timeout' or vector1.previous[0] == 'Undefined'or \
       vector1.previous[1] == 'Timeout' or vector1.previous[1] == 'Undefined'or \
       vector1.previous[2] == 'Timeout' or vector1.previous[2] == 'Undefined'or \
       vector2.current == 'Timeout' or vector2.current == 'Undefined' or \
       vector2.current[0] == 'Timeout' or vector2.current[0] == 'Undefined'or \
       vector2.current[1] == 'Timeout' or vector2.current[1] == 'Undefined'or \
       vector2.current[2] == 'Timeout' or vector2.current[2] == 'Undefined' or \
       vector2.previous == 'Timeout' or vector2.previous == 'Undefined'or \
       vector2.previous[0] == 'Timeout' or vector2.previous[0] == 'Undefined'or \
       vector2.previous[1] == 'Timeout' or vector2.previous[1] == 'Undefined'or \
       vector2.previous[2] == 'Timeout' or vector2.previous[2] == 'Undefined':
        status = Status.warning
        message = vector1.device.sensor_cfg[vector.id][0] + \
                  highlight(TermCo.WARNING, ' value is undefined')
    else:
        vc1 = np.array(vector1.current)
        vp1 = np.array(vector1.previous)
        lc1 = np.sqrt(vc1.dot(vc1))
        lp1 = np.sqrt(vp1.dot(vp1))
        vc2 = np.array(vector2.current)
        vp2 = np.array(vector2.previous)
        lc2 = np.sqrt(vc2.dot(vc2))
        lp2 = np.sqrt(vp2.dot(vp2))
        if abs(lc1*lp1) < 0.0000000000001 or abs(lc2*lp2) < 0.0000000000001:
            message = vector1.device.sensor_cfg[vector.id][0] + \
                      highlight(TermCo.WARNING, ' is undefined')
            status = Status.warning
        else:
            _delta1 = abs(lc1 - lp1)*100/lp1
            _angle1 = math.acos(vc1.dot(vp1)/(lc1*lp1))
            _delta2 = abs(lc2 - lp2)*100/lp2
            _angle2 = math.acos(vc2.dot(vp2)/(lc2*lp2))
            
            if abs(_delta2 - _delta1) > delta or abs(_angle2 - _angle1) > angle:
                status = Status.alarm
                message = vector1.device.sensor_cfg[vector1.id][0] + \
                          ' delta change check failed, \n change delta: ' + \
                          highlight(TermCo.ALARM, fstr(abs(_delta2 - _delta1))) + \
                          ' / ' + fstr(delta) + ',\n angle change delta: ' + \
                          highlight(TermCo.ALARM, fstr(abs(_angle2 - _angle1))) + ' / ' + fstr(angle)
            else:
                message = vector1.device.sensor_cfg[vector1.id][0] + \
                          ' delta change check passed, \n change delta: ' + \
                          highlight(TermCo.OK, fstr(abs(_delta2 - _delta1))) + \
                          ' / ' + fstr(delta) + ',\n angle change delta: ' + \
                          highlight(TermCo.OK, fstr(abs(_angle2 - _angle1))) + ' / ' + fstr(angle)
    return status, message 
#------------------------------------------------------------------------
# main()
#------------------------------------------------------------------------
#------------------------------------------------------------------------
# Intialize sensor objects
#------------------------------------------------------------------------

try:
    rsl = RSL10Sense("60:C0:BF:28:93:8A")
    mpu = MPU9250()
except (KeyboardInterrupt, SystemExit):
    if _debug:  
        print 'Aborted'
        #rsl.adapter.stop()
        sys.exit()
except:
    if _debug:
        exc_type, exc_value, exc_traceback = sys.exc_info()
        print("*** Traceback:")
        traceback.print_tb(exc_traceback, file=sys.stdout) # limit=1, 
        print("*** Exception:")
        traceback.print_exception(exc_type, exc_value, exc_traceback, file=sys.stdout) #limit=2,
        print sys.exc_info()
    else:   
        print highlight(TermCo.ALARM, 'Initialization failure')
    #rsl.adapter.stop()
    sys.exit()
    
#------------------------------------------------------------------------ 
# Main loop
#------------------------------------------------------------------------ 

try:
    rq_no = 1 # Poll counter
    no_rec = 0 # record counter in the current file
    
    if _log:
        dt = datetime.datetime.fromtimestamp(time.time()).strftime('%Y_%m_%d_%H_%M_%S')
        logf = open('tclm_log_' + dt + '.csv', 'wb')
        logh = ['Poll No.', 'Timestamp', 'Status']
        
        for i in range(len(RSL10Sense.sensor_cfg)):
            logh.append(RSL10Sense.sensor_cfg[i][0])
        for i in range(len(MPU9250.sensor_cfg)):
            logh.append(MPU9250.sensor_cfg[i][0]) 
        writer = csv.writer(logf, delimiter = ',')
        writer.writerow(logh)
    
    while(True):    
        # poll sensors
        rsl.poll()
        mpu.poll()
        # print values to console
        print '\n==== Transaportation Condition Logging Monitor ================='
        print   '>>> Poll iteration No.: %i' % rq_no,  '>>> Date/Time:', dt
        print   '==== Collected Data: RSL10 Sense ===============================\n'
        for i in range(len(rsl.sensors)):
            print RSL10Sense.sensor_cfg[i][0] + ': ' + str(rsl.sensors[i].current) 
        print '\n==== Collected Data: MPU-9250 ==================================\n'
        for i in range(len(mpu.sensors)):
            print MPU9250.sensor_cfg[i][0] + ': ' + str(mpu.sensors[i].current)  
        print '\n==== Sensor Data Analysis ======================================\n'
        
        # Do all checks
        # Ambient Light
        status = Status.normal
        s, m = scalar_threshold(rsl.sensors[RSL10Sense.AMBIENT_LIGHT], 
                                 _ambient_light_threshold)
        if s > status:
            status = s
        print m
        # Temperature
        s, m = scalar_threshold(rsl.sensors[RSL10Sense.TEMPERATURE], 
                                 _temperature_high_thresold)
        if s > status:
            status = s
        print m
        s, m = scalar_threshold(rsl.sensors[RSL10Sense.TEMPERATURE], 
                                 _temperature_low_thresold, less = False)
        if s > status:
            status = s
        print m
        # Humidity
        s, m = scalar_threshold(rsl.sensors[RSL10Sense.HUMIDITY], 
                                 _humidity_high_threshold)
        if s > status:
            status = s
        print m
        s, m = scalar_threshold(rsl.sensors[RSL10Sense.HUMIDITY], 
                                 _humidity_low_threshold, less = False)
        if s > status:
            status = s
        print m
        # Acceleration (RSL10)
        s, m = vector_threshold(rsl.sensors[RSL10Sense.AV], 
                                 _accelerometer_threshold)
        if s > status:
            status = s
        print m
        # Magnetic Field Change (RSL10)
        s, m = vector_change(rsl.sensors[RSL10Sense.MV], 
                             _magnetometer_delta,
                             _magnetometer_angle)
        if s > status:
            status = s
        print m
        # Magnetic Field Change (MPU9250)
        s, m = vector_change(mpu.sensors[MPU9250.M], 
                             _magnetometer_delta,
                             _magnetometer_angle)
        if s > status:
            status = s
        print m
        # Magnetic Field Change Deta (RSL10 - MPU9250)
        s, m = vector_delta(rsl.sensors[RSL10Sense.MV],
                            mpu.sensors[MPU9250.M], 
                            _magnetometer_change_delta,
                            _magnetometer_change_angle)        
        if s > status:
            status = s
        print m
        
        print '\n==== Status ===================================================='
        print   '>>>>', StatusDec[status]        
        print   '==== Press Ctrl-c for exit ====================================='

        # Write to log
        if _log:
            dt = datetime.datetime.fromtimestamp(time.time()).strftime('%Y-%m-%d %H:%M:%S')
            if no_rec >= _log_size: # Open new file
                logf.close()
                logf = open('tclm_log_' + dt + '.csv', 'wb')
                writer = csv.writer(logf, delimiter = ',')
                writer.writerow(logh)
                no_rec = 0
            poll = [rq_no, dt, StatusText[status]]
            for i in range(len(rsl.sensors)):
                poll.append(rsl.sensors[i].current)
            for i in range(len(mpu.sensors)):
                poll.append(mpu.sensors[i].current)
            writer.writerow(poll)   
            no_rec += 1
        
        rq_no += 1
                            
except (KeyboardInterrupt, SystemExit):
    if _debug:  
        print 'Aborted'
    rsl.adapter.stop()
    sys.exit()
except:
    if _debug:
        exc_type, exc_value, exc_traceback = sys.exc_info()
        print("*** Traceback:")
        traceback.print_tb(exc_traceback, file=sys.stdout) # limit=1, 
        print("*** Exception:")
        traceback.print_exception(exc_type, exc_value, exc_traceback, file=sys.stdout) #limit=2,
        print sys.exc_info()
    else:   
        print highlight(TermCo.ALARM, 'Main loop failure')
    rsl.adapter.stop()
    sys.exit()
    
rsl.adapter.stop()
sys.exit()              
#------------------------------------------------------------------------ 
# Mar 09, 2020 - anton_bondarenko at yahoo.com 
#------------------------------------------------------------------------   
        
    

Example log file (.csv)

Plain text
Example log session used for examples described in the project description
Poll No.,Timestamp,Status,Ambient light,Temperature,Pressure,Humidity,Compas yaw,Device pitch,Device roll,Linear acceleration X axis,Linear acceleration Y axis,Linear acceleration Z axis,Magnetic field strength X axis,Magnetic field strength Y axis,Magnetic field strength Z axis,Acceleration vector,Orientation vector,Magnetic field vector,Acceleration vector,Gyroscope vector,Magnetic field vector,Linear acceleration X axis,Linear acceleration Y axis,Linear acceleration Z axis,Gyrospope X axis,Gyrospope Y axis,Gyrospope Z axis,Magnetic field strength X axis,Magnetic field strength Y axis,Magnetic field strength Z axis
1,2020-03-13 23:15:13,Alarm,41.0,25.4,97.37,29.37,359.967041,2.93335,0.736084,0.029928,-0.175974,0.223858,-28.869629,-55.358887,34.484863,"[0.029928, -0.175974, 0.223858]","[359.967041, 2.93335, 0.736084]","[-28.869629, -55.358887, 34.484863]","[0.047, 0.009, 1.032]","[0.175, 0.237, 0.168]","[-1.457, 55.01, 48.144]",0.047,0.009,1.032,0.175,0.237,0.168,-1.457,55.01,48.144
2,2020-03-13 23:15:17,Normal,41.0,25.38,97.37,28.74,359.945068,2.955322,0.769043,0.003591,-0.177171,0.326809,-26.794434,-53.588867,32.470703,"[0.003591, -0.177171, 0.326809]","[359.945068, 2.955322, 0.769043]","[-26.794434, -53.588867, 32.470703]","[0.048, 0.01, 1.03]","[0.183, 0.244, 0.053]","[-2.914, 55.01, 50.604]",0.048,0.01,1.03,0.183,0.244,0.053,-2.914,55.01,50.604
3,2020-03-13 23:15:21,Normal,41.0,25.38,97.38,28.34,359.934082,2.977295,0.780029,-0.007183,-0.175974,0.233435,-27.587891,-54.382324,32.897949,"[-0.007183, -0.175974, 0.233435]","[359.934082, 2.977295, 0.780029]","[-27.587891, -54.382324, 32.897949]","[0.048, 0.013, 1.038]","[0.107, 0.229, 0.13]","[-3.097, 55.921, 47.969]",0.048,0.013,1.038,0.107,0.229,0.13,-3.097,55.921,47.969
4,2020-03-13 23:15:25,Alarm,41.0,25.38,97.37,27.96,3.273926,-5.921631,-31.552734,8.761581,-11.160571,1.322796,13.85498,-30.395508,6.591797,"[8.761581, -11.160571, 1.322796]","[3.273926, -5.921631, -31.552734]","[13.85498, -30.395508, 6.591797]","[0.051, 0.008, 1.035]","[0.191, 0.229, 0.099]","[-2.004, 56.285, 47.617]",0.051,0.008,1.035,0.191,0.229,0.099,-2.004,56.285,47.617
5,2020-03-13 23:15:29,Alarm,20.0,25.43,97.37,30.82,55.415039,-1.845703,5.734863,-0.568623,-0.227449,-0.96606,18.188477,-56.884766,93.566895,"[-0.568623, -0.227449, -0.96606]","[55.415039, -1.845703, 5.734863]","[18.188477, -56.884766, 93.566895]","[0.048, 0.01, 1.033]","[0.214, 0.244, 0.168]","[-1.093, 56.832, 48.496]",0.048,0.01,1.033,0.214,0.244,0.168,-1.093,56.832,48.496
6,2020-03-13 23:15:33,Alarm,0.0,26.09,97.37,35.3,328.930664,3.823242,0.351562,0.539892,2.044648,-0.117316,-6.896973,21.484375,-32.592773,"[0.539892, 2.044648, -0.117316]","[328.930664, 3.823242, 0.351562]","[-6.896973, 21.484375, -32.592773]","[0.051, 0.01, 1.033]","[0.153, 0.427, 0.061]","[-3.825, 57.014, 48.32]",0.051,0.01,1.033,0.153,0.427,0.061,-3.825,57.014,48.32
7,2020-03-13 23:15:37,Alarm,20.0,26.15,97.38,45.0,23.90625,31.783447,6.152344,-0.604536,16.393099,3.5099,-11.291504,16.052246,27.770996,"[-0.604536, 16.393099, 3.5099]","[23.90625, 31.783447, 6.152344]","[-11.291504, 16.052246, 27.770996]","[0.049, 0.009, 1.034]","[-0.031, 0.145, 0.092]","[-5.647, 55.556, 48.672]",0.049,0.009,1.034,-0.031,0.145,0.092,-5.647,55.556,48.672
8,2020-03-13 23:15:41,Alarm,20.0,26.3,97.37,48.86,20.961914,1.878662,0.0,-0.007183,-0.005986,0.240617,-25.939941,63.293457,-22.338867,"[-0.007183, -0.005986, 0.240617]","[20.961914, 1.878662, 0.0]","[-25.939941, 63.293457, -22.338867]","[0.048, 0.01, 1.032]","[0.214, 0.191, 0.145]","[-3.643, 56.467, 49.55]",0.048,0.01,1.032,0.214,0.191,0.145,-3.643,56.467,49.55
9,2020-03-13 23:15:45,Normal,20.0,26.18,97.37,44.98,20.961914,1.878662,0.0,-0.016759,-0.026336,0.234632,-25.146484,63.293457,-22.338867,"[-0.016759, -0.026336, 0.234632]","[20.961914, 1.878662, 0.0]","[-25.146484, 63.293457, -22.338867]","[0.05, 0.008, 1.033]","[0.114, 0.214, 0.168]","[-2.368, 55.921, 48.672]",0.05,0.008,1.033,0.114,0.214,0.168,-2.368,55.921,48.672
10,2020-03-13 23:15:49,Normal,20.0,26.1,97.38,40.17,20.961914,1.878662,0.0,-0.02873,-0.016759,0.2478,-26.245117,62.561035,-23.498535,"[-0.02873, -0.016759, 0.2478]","[20.961914, 1.878662, 0.0]","[-26.245117, 62.561035, -23.498535]","[0.05, 0.009, 1.033]","[0.221, 0.191, 0.145]","[-3.097, 57.378, 47.969]",0.05,0.009,1.033,0.221,0.191,0.145,-3.097,57.378,47.969
11,2020-03-13 23:15:53,Normal,20.0,26.05,97.37,36.57,20.961914,1.878662,0.0,-0.025139,0.00838,0.189142,-27.038574,62.561035,-22.766113,"[-0.025139, 0.00838, 0.189142]","[20.961914, 1.878662, 0.0]","[-27.038574, 62.561035, -22.766113]","[0.049, 0.008, 1.031]","[0.237, 0.198, 0.145]","[-3.461, 56.649, 47.969]",0.049,0.008,1.031,0.237,0.198,0.145,-3.461,56.649,47.969
12,2020-03-13 23:15:57,Alarm,1132.0,26.01,97.37,32.87,20.961914,1.867676,0.0,-0.015562,-0.001197,0.241814,-26.672363,62.866211,-22.766113,"[-0.015562, -0.001197, 0.241814]","[20.961914, 1.867676, 0.0]","[-26.672363, 62.866211, -22.766113]","[0.052, 0.01, 1.034]","[0.153, 0.175, 0.099]","[-2.368, 57.014, 48.672]",0.052,0.01,1.034,0.153,0.175,0.099,-2.368,57.014,48.672
13,2020-03-13 23:16:01,Alarm,1142.0,25.99,97.37,31.72,20.961914,1.867676,0.0,-0.022745,-0.017957,0.226252,-27.038574,63.659668,-22.338867,"[-0.022745, -0.017957, 0.226252]","[20.961914, 1.867676, 0.0]","[-27.038574, 63.659668, -22.338867]","[0.048, 0.011, 1.034]","[0.191, 0.275, 0.053]","[-2.55, 55.374, 49.199]",0.048,0.011,1.034,0.191,0.275,0.053,-2.55,55.374,49.199
14,2020-03-13 23:16:05,Alarm,1142.0,25.98,97.37,30.53,20.961914,1.867676,0.0,-0.034716,-0.013168,0.222661,-26.672363,63.293457,-23.193359,"[-0.034716, -0.013168, 0.222661]","[20.961914, 1.867676, 0.0]","[-26.672363, 63.293457, -23.193359]","[0.048, 0.009, 1.036]","[0.214, 0.252, 0.061]","[-3.097, 57.742, 47.617]",0.048,0.009,1.036,0.214,0.252,0.061,-3.097,57.742,47.617
15,2020-03-13 23:16:09,Normal,20.0,25.94,97.37,28.96,20.961914,1.867676,0.0,-0.014365,-0.005986,0.227449,-26.672363,64.086914,-22.338867,"[-0.014365, -0.005986, 0.227449]","[20.961914, 1.867676, 0.0]","[-26.672363, 64.086914, -22.338867]","[0.052, 0.011, 1.033]","[0.229, 0.244, 0.0]","[-4.007, 56.832, 48.847]",0.052,0.011,1.033,0.229,0.244,0.0,-4.007,56.832,48.847
16,2020-03-13 23:16:13,Normal,20.0,25.95,97.37,28.68,20.961914,1.867676,0.0,-0.017957,0.001197,0.222661,-25.939941,63.659668,-22.338867,"[-0.017957, 0.001197, 0.222661]","[20.961914, 1.867676, 0.0]","[-25.939941, 63.659668, -22.338867]","[0.049, 0.007, 1.033]","[0.206, 0.206, 0.107]","[-5.465, 55.374, 48.847]",0.049,0.007,1.033,0.206,0.206,0.107,-5.465,55.374,48.847
17,2020-03-13 23:16:17,Alarm,20.0,25.93,97.37,28.89,20.961914,1.647949,0.615234,-0.169988,-0.041899,0.219069,-13.671875,51.269531,-16.845703,"[-0.169988, -0.041899, 0.219069]","[20.961914, 1.647949, 0.615234]","[-13.671875, 51.269531, -16.845703]","[0.054, 0.012, 1.034]","[0.244, 0.229, 0.008]","[6.193, 70.311, 48.847]",0.054,0.012,1.034,0.244,0.229,0.008,6.193,70.311,48.847
18,2020-03-13 23:16:21,Normal,20.0,25.93,97.37,28.59,73.937988,1.702881,0.186768,-0.077812,-0.034716,0.241814,-12.145996,49.194336,-16.540527,"[-0.077812, -0.034716, 0.241814]","[73.937988, 1.702881, 0.186768]","[-12.145996, 49.194336, -16.540527]","[0.054, 0.01, 1.033]","[0.183, 0.237, 0.084]","[4.918, 70.129, 48.32]",0.054,0.01,1.033,0.183,0.237,0.084,4.918,70.129,48.32
19,2020-03-13 23:16:25,Alarm,31.0,25.93,97.37,28.6,43.417969,1.362305,-0.494385,0.059855,-0.11133,0.257377,-2.685547,50.598145,-21.54541,"[0.059855, -0.11133, 0.257377]","[43.417969, 1.362305, -0.494385]","[-2.685547, 50.598145, -21.54541]","[0.05, 0.01, 1.034]","[0.214, 0.183, 0.275]","[-5.829, 55.739, 47.793]",0.05,0.01,1.034,0.214,0.183,0.275,-5.829,55.739,47.793
20,2020-03-13 23:16:29,Normal,20.0,25.93,97.37,29.03,16.842041,1.494141,-0.406494,0.051475,-0.068235,0.228646,-1.89209,49.865723,-22.644043,"[0.051475, -0.068235, 0.228646]","[16.842041, 1.494141, -0.406494]","[-1.89209, 49.865723, -22.644043]","[0.049, 0.011, 1.032]","[0.191, 0.237, 0.122]","[-4.554, 58.107, 49.023]",0.049,0.011,1.032,0.191,0.237,0.122,-4.554,58.107,49.023
21,2020-03-13 23:16:33,Normal,20.0,25.92,97.37,29.19,16.842041,1.494141,-0.406494,0.051475,-0.070629,0.223858,-2.685547,50.964355,-20.751953,"[0.051475, -0.070629, 0.223858]","[16.842041, 1.494141, -0.406494]","[-2.685547, 50.964355, -20.751953]","[0.048, 0.012, 1.029]","[0.252, 0.183, 0.046]","[-4.736, 57.924, 47.793]",0.048,0.012,1.029,0.252,0.183,0.046,-4.736,57.924,47.793
22,2020-03-13 23:16:37,Normal,20.0,25.92,97.37,28.91,16.842041,1.494141,-0.406494,0.05387,-0.07422,0.238223,-3.356934,50.964355,-21.179199,"[0.05387, -0.07422, 0.238223]","[16.842041, 1.494141, -0.406494]","[-3.356934, 50.964355, -21.179199]","[0.048, 0.011, 1.029]","[0.275, 0.107, 0.137]","[-2.732, 57.742, 46.563]",0.048,0.011,1.029,0.275,0.107,0.137,-2.732,57.742,46.563
23,2020-03-13 23:16:41,Normal,20.0,25.91,97.37,28.59,16.842041,1.494141,-0.406494,0.049081,-0.09098,0.235829,-3.356934,50.964355,-22.277832,"[0.049081, -0.09098, 0.235829]","[16.842041, 1.494141, -0.406494]","[-3.356934, 50.964355, -22.277832]","[0.05, 0.008, 1.033]","[0.122, 0.145, 0.114]","[-3.461, 55.556, 50.077]",0.05,0.008,1.033,0.122,0.145,0.114,-3.461,55.556,50.077
24,2020-03-13 23:16:45,Alarm,20.0,25.9,97.38,27.82,16.842041,1.494141,-0.406494,0.041899,-0.081403,0.178368,-1.586914,77.087402,-20.141602,"[0.041899, -0.081403, 0.178368]","[16.842041, 1.494141, -0.406494]","[-1.586914, 77.087402, -20.141602]","[0.051, 0.009, 1.034]","[0.244, 0.198, 0.114]","[-4.19, 55.921, 49.023]",0.051,0.009,1.034,0.244,0.198,0.114,-4.19,55.921,49.023
25,2020-03-13 23:16:49,Normal,20.0,25.93,97.38,27.72,22.17041,3.812256,6.855469,0.37589,-0.07422,0.158017,-12.573242,80.444336,-25.45166,"[0.37589, -0.07422, 0.158017]","[22.17041, 3.812256, 6.855469]","[-12.573242, 80.444336, -25.45166]","[0.051, 0.011, 1.031]","[0.229, 0.229, 0.191]","[-3.643, 57.924, 48.847]",0.051,0.011,1.031,0.229,0.229,0.191,-3.643,57.924,48.847
26,2020-03-13 23:16:53,Alarm,20.0,26.3,97.37,30.27,17.600098,19.006348,15.281982,-1.572991,0.629675,0.266953,-0.183105,57.739258,-15.686035,"[-1.572991, 0.629675, 0.266953]","[17.600098, 19.006348, 15.281982]","[-0.183105, 57.739258, -15.686035]","[0.052, 0.012, 1.032]","[0.092, 0.191, 0.153]","[-4.007, 57.196, 47.442]",0.052,0.012,1.032,0.092,0.191,0.153,-4.007,57.196,47.442
27,2020-03-13 23:16:57,Normal,31.0,26.52,97.37,34.72,12.513428,4.724121,0.725098,-0.102951,0.049081,0.294487,1.281738,57.495117,-16.479492,"[-0.102951, 0.049081, 0.294487]","[12.513428, 4.724121, 0.725098]","[1.281738, 57.495117, -16.479492]","[0.051, 0.01, 1.033]","[0.168, 0.244, 0.183]","[-4.736, 55.739, 48.144]",0.051,0.01,1.033,0.168,0.244,0.183,-4.736,55.739,48.144
28,2020-03-13 23:17:01,Alarm,31.0,26.4,97.38,33.72,93.065186,4.328613,-0.12085,-0.016759,-0.011971,0.266953,-10.070801,30.761719,-11.962891,"[-0.016759, -0.011971, 0.266953]","[93.065186, 4.328613, -0.12085]","[-10.070801, 30.761719, -11.962891]","[0.05, 0.01, 1.034]","[0.259, 0.267, 0.145]","[-3.461, 55.556, 49.023]",0.05,0.01,1.034,0.259,0.267,0.145,-3.461,55.556,49.023
29,2020-03-13 23:17:05,Normal,20.0,26.44,97.37,33.54,18.369141,4.449463,-0.12085,-0.025139,-0.023942,0.290895,-8.972168,31.860352,-11.84082,"[-0.025139, -0.023942, 0.290895]","[18.369141, 4.449463, -0.12085]","[-8.972168, 31.860352, -11.84082]","[0.049, 0.009, 1.035]","[0.183, 0.145, 0.069]","[-2.186, 55.739, 50.604]",0.049,0.009,1.035,0.183,0.145,0.069,-2.186,55.739,50.604
30,2020-03-13 23:17:09,Alarm,20.0,26.35,97.38,32.62,16.864014,49.119873,-21.280518,7.529764,10.059238,-0.010774,-14.099121,27.893066,29.846191,"[7.529764, 10.059238, -0.010774]","[16.864014, 49.119873, -21.280518]","[-14.099121, 27.893066, 29.846191]","[0.051, 0.009, 1.031]","[0.214, 0.145, 0.092]","[-2.732, 55.192, 49.374]",0.051,0.009,1.031,0.214,0.145,0.092,-2.732,55.192,49.374
31,2020-03-13 23:17:13,Normal,10.0,26.61,97.38,32.84,29.256592,-29.025879,21.368408,-0.264559,-0.452504,0.09098,-12.268066,29.052734,25.45166,"[-0.264559, -0.452504, 0.09098]","[29.256592, -29.025879, 21.368408]","[-12.268066, 29.052734, 25.45166]","[0.049, 0.01, 1.032]","[0.191, 0.267, 0.069]","[-5.1, 55.739, 48.847]",0.049,0.01,1.032,0.191,0.267,0.069,-5.1,55.739,48.847
32,2020-03-13 23:17:17,Alarm,10.0,26.84,97.38,36.57,344.696045,-41.418457,51.624756,-5.390545,-8.119935,4.292804,-2.075195,27.770996,6.896973,"[-5.390545, -8.119935, 4.292804]","[344.696045, -41.418457, 51.624756]","[-2.075195, 27.770996, 6.896973]","[0.051, 0.01, 1.032]","[0.29, 0.259, 0.092]","[-2.732, 55.921, 49.374]",0.051,0.01,1.032,0.29,0.259,0.092,-2.732,55.921,49.374
33,2020-03-13 23:17:21,Normal,0.0,28.0,97.38,43.88,294.44458,30.849609,18.226318,-0.027533,-0.05387,0.608127,0.854492,24.780273,7.751465,"[-0.027533, -0.05387, 0.608127]","[294.44458, 30.849609, 18.226318]","[0.854492, 24.780273, 7.751465]","[0.051, 0.014, 1.035]","[0.191, 0.267, 0.183]","[-3.461, 55.921, 48.32]",0.051,0.014,1.035,0.191,0.267,0.183,-3.461,55.921,48.32
34,2020-03-13 23:17:25,Normal,10.0,30.03,97.38,53.67,285.578613,27.784424,3.603516,0.464475,0.05387,0.288501,4.394531,24.475098,6.04248,"[0.464475, 0.05387, 0.288501]","[285.578613, 27.784424, 3.603516]","[4.394531, 24.475098, 6.04248]","[0.05, 0.01, 1.032]","[0.198, 0.153, 0.191]","[-3.643, 57.196, 48.144]",0.05,0.01,1.032,0.198,0.153,0.191,-3.643,57.196,48.144
35,2020-03-13 23:17:29,Alarm,0.0,29.15,97.39,68.61,279.975586,28.78418,14.18335,-1.021127,0.050278,0.205901,5.371094,22.949219,5.79834,"[-1.021127, 0.050278, 0.205901]","[279.975586, 28.78418, 14.18335]","[5.371094, 22.949219, 5.79834]","[0.049, 0.01, 1.036]","[0.145, 0.206, 0.122]","[-4.007, 56.832, 48.847]",0.049,0.01,1.036,0.145,0.206,0.122,-4.007,56.832,48.847
36,2020-03-13 23:17:33,Alarm,10.0,30.23,97.38,75.68,283.502197,25.268555,47.427979,-6.14831,-12.077551,9.640253,-0.671387,0.488281,-7.751465,"[-6.14831, -12.077551, 9.640253]","[283.502197, 25.268555, 47.427979]","[-0.671387, 0.488281, -7.751465]","[0.05, 0.008, 1.029]","[0.053, 0.175, 0.153]","[-4.736, 56.832, 48.847]",0.05,0.008,1.029,0.053,0.175,0.153,-4.736,56.832,48.847
37,2020-03-13 23:17:37,Alarm,31.0,30.16,97.39,78.87,352.957764,3.922119,0.12085,0.025139,0.013168,0.055067,-1.464844,7.446289,4.272461,"[0.025139, 0.013168, 0.055067]","[352.957764, 3.922119, 0.12085]","[-1.464844, 7.446289, 4.272461]","[0.05, 0.009, 1.034]","[0.259, 0.214, 0.122]","[-5.282, 55.192, 47.969]",0.05,0.009,1.034,0.259,0.214,0.122,-5.282,55.192,47.969
38,2020-03-13 23:17:41,Alarm,41.0,28.85,97.39,86.72,272.032471,4.54834,-1.878662,1.106121,0.6608,0.113725,4.272461,-12.756348,-13.977051,"[1.106121, 0.6608, 0.113725]","[272.032471, 4.54834, -1.878662]","[4.272461, -12.756348, -13.977051]","[0.034, 0.023, 1.037]","[0.13, 0.084, 0.275]","[-2.914, 57.196, 48.144]",0.034,0.023,1.037,0.13,0.084,0.275,-2.914,57.196,48.144
39,2020-03-13 23:17:45,Alarm,20.0,28.17,97.39,86.52,286.413574,1.2854,0.582275,-0.002394,-0.003591,0.00838,5.79834,-12.756348,-8.056641,"[-0.002394, -0.003591, 0.00838]","[286.413574, 1.2854, 0.582275]","[5.79834, -12.756348, -8.056641]","[0.049, 0.01, 1.035]","[0.221, 0.252, 0.099]","[-4.736, 56.103, 49.199]",0.049,0.01,1.035,0.221,0.252,0.099,-4.736,56.103,49.199
40,2020-03-13 23:17:49,Alarm,20.0,27.38,97.39,89.12,286.413574,1.2854,0.582275,0.020351,-0.001197,-0.084994,6.591797,-11.962891,-8.239746,"[0.020351, -0.001197, -0.084994]","[286.413574, 1.2854, 0.582275]","[6.591797, -11.962891, -8.239746]","[0.048, 0.01, 1.033]","[0.214, 0.229, 0.053]","[-4.007, 58.653, 47.09]",0.048,0.01,1.033,0.214,0.229,0.053,-4.007,58.653,47.09
41,2020-03-13 23:17:53,Alarm,20.0,27.06,97.4,89.72,286.413574,1.2854,0.582275,-0.108936,-0.089783,0.214281,6.896973,-14.160156,-7.446289,"[-0.108936, -0.089783, 0.214281]","[286.413574, 1.2854, 0.582275]","[6.896973, -14.160156, -7.446289]","[0.049, 0.01, 1.028]","[0.191, 0.168, 0.229]","[-4.372, 54.646, 49.199]",0.049,0.01,1.028,0.191,0.168,0.229,-4.372,54.646,49.199
42,2020-03-13 23:17:57,Alarm,20.0,26.57,97.39,84.43,286.413574,1.2854,0.582275,-0.125696,-0.108936,0.257377,6.591797,-12.695312,-8.239746,"[-0.125696, -0.108936, 0.257377]","[286.413574, 1.2854, 0.582275]","[6.591797, -12.695312, -8.239746]","[0.052, 0.01, 1.031]","[0.183, 0.267, 0.168]","[-4.918, 55.556, 50.077]",0.052,0.01,1.031,0.183,0.267,0.168,-4.918,55.556,50.077
43,2020-03-13 23:18:01,Alarm,20.0,26.78,97.39,76.35,286.413574,1.2854,0.582275,-0.138864,-0.095768,0.240617,5.493164,-12.390137,-7.080078,"[-0.138864, -0.095768, 0.240617]","[286.413574, 1.2854, 0.582275]","[5.493164, -12.390137, -7.080078]","[0.051, 0.01, 1.03]","[0.198, 0.244, 0.092]","[-5.647, 57.378, 49.023]",0.051,0.01,1.03,0.198,0.244,0.092,-5.647,57.378,49.023
44,2020-03-13 23:18:05,Alarm,20.0,26.89,97.39,65.95,286.413574,1.2854,0.582275,-0.105345,-0.104148,0.243011,6.164551,-12.756348,-8.178711,"[-0.105345, -0.104148, 0.243011]","[286.413574, 1.2854, 0.582275]","[6.164551, -12.756348, -8.178711]","[0.049, 0.01, 1.029]","[0.191, 0.237, 0.076]","[-5.1, 57.196, 49.199]",0.049,0.01,1.029,0.191,0.237,0.076,-5.1,57.196,49.199
45,2020-03-13 23:18:09,Normal,20.0,26.98,97.39,49.46,286.413574,1.2854,0.582275,-0.102951,-0.093374,0.254982,6.164551,-11.962891,-7.446289,"[-0.102951, -0.093374, 0.254982]","[286.413574, 1.2854, 0.582275]","[6.164551, -11.962891, -7.446289]","[0.052, 0.01, 1.032]","[0.183, 0.229, 0.13]","[-5.647, 57.378, 48.32]",0.052,0.01,1.032,0.183,0.229,0.13,-5.647,57.378,48.32
46,2020-03-13 23:18:13,Normal,20.0,27.0,97.39,44.07,286.413574,1.2854,0.582275,-0.114922,-0.087388,0.25618,6.164551,-12.756348,-7.446289,"[-0.114922, -0.087388, 0.25618]","[286.413574, 1.2854, 0.582275]","[6.164551, -12.756348, -7.446289]","[0.049, 0.009, 1.033]","[0.32, 0.229, 0.122]","[-2.732, 55.556, 50.78]",0.049,0.009,1.033,0.32,0.229,0.122,-2.732,55.556,50.78
47,2020-03-13 23:18:17,Normal,20.0,27.0,97.39,40.02,286.413574,1.2854,0.582275,-0.100556,-0.083797,0.259771,6.591797,-12.390137,-7.080078,"[-0.100556, -0.083797, 0.259771]","[286.413574, 1.2854, 0.582275]","[6.591797, -12.390137, -7.080078]","[0.052, 0.008, 1.034]","[0.175, 0.252, 0.145]","[-5.1, 57.196, 49.902]",0.052,0.008,1.034,0.175,0.252,0.145,-5.1,57.196,49.902
48,2020-03-13 23:18:21,Normal,20.0,26.98,97.39,34.6,286.413574,1.2854,0.582275,-0.101754,-0.071826,0.232238,6.591797,-12.756348,-7.751465,"[-0.101754, -0.071826, 0.232238]","[286.413574, 1.2854, 0.582275]","[6.591797, -12.756348, -7.751465]","[0.049, 0.01, 1.031]","[0.046, 0.214, 0.008]","[-4.736, 56.467, 49.199]",0.049,0.01,1.031,0.046,0.214,0.008,-4.736,56.467,49.199
49,2020-03-13 23:18:25,Normal,20.0,26.97,97.38,32.96,286.413574,1.2854,0.582275,-0.144849,-0.102951,0.253785,6.896973,-11.657715,-7.446289,"[-0.144849, -0.102951, 0.253785]","[286.413574, 1.2854, 0.582275]","[6.896973, -11.657715, -7.446289]","[0.05, 0.009, 1.033]","[0.244, 0.198, 0.153]","[-4.372, 57.56, 48.144]",0.05,0.009,1.033,0.244,0.198,0.153,-4.372,57.56,48.144
50,2020-03-13 23:18:29,Normal,20.0,26.95,97.38,32.21,286.413574,1.2854,0.582275,-0.096965,-0.076614,0.222661,6.164551,-13.061523,-8.239746,"[-0.096965, -0.076614, 0.222661]","[286.413574, 1.2854, 0.582275]","[6.164551, -13.061523, -8.239746]","[0.05, 0.008, 1.033]","[0.313, 0.221, 0.168]","[-6.375, 57.014, 48.672]",0.05,0.008,1.033,0.313,0.221,0.168,-6.375,57.014,48.672

Example console output

Plain text
This is console output of the sample session used in the project description
==== Transaportation Condition Logging Monitor =================
>>>> Poll iteration No.: 1
==== Collected Data: RSL10 Sense ===============================

Ambient light: 41.0
Temperature: 25.4
Pressure: 97.37
Humidity: 29.37
Compas yaw: 359.967041
Device pitch: 2.93335
Device roll: 0.736084
Linear acceleration X axis: 0.029928
Linear acceleration Y axis: -0.175974
Linear acceleration Z axis: 0.223858
Magnetic field strength X axis: -28.869629
Magnetic field strength Y axis: -55.358887
Magnetic field strength Z axis: 34.484863
Acceleration vector: [0.029928, -0.175974, 0.223858]
Orientation vector: [359.967041, 2.93335, 0.736084]
Magnetic field vector: [-28.869629, -55.358887, 34.484863]

==== Collected Data: MPU-9250 ==================================

Acceleration vector: [0.047, 0.009, 1.032]
Gyroscope vector: [0.175, 0.237, 0.168]
Magnetic field vector: [-1.457, 55.01, 48.144]
Linear acceleration X axis: 0.047
Linear acceleration Y axis: 0.009
Linear acceleration Z axis: 1.032
Gyrospope X axis: 0.175
Gyrospope Y axis: 0.237
Gyrospope Z axis: 0.168
Magnetic field strength X axis: -1.457
Magnetic field strength Y axis: 55.01
Magnetic field strength Z axis: 48.144

==== Sensor Data Analysis ======================================

Ambient light threshold (200) check passed: 41.0
Temperature threshold (35) check passed: 25.4
Temperature threshold (15) check passed: 25.4
Humidity threshold (65) check passed: 29.37
Humidity threshold (20) check passed: 29.37
Acceleration vector threshold (10) check passed: 0.2863
Magnetic field vector change check failed, 
 delta: 8.4485 / 10,
 angle: 0.4168 / 0.2618
Magnetic field vector change check passed, 
 delta:  3.0668 / 10,
 angle: 0.0461 / 0.2618
Magnetic field vector delta change check passed, 
 change delta: 5.3817 / 15,
 angle change delta: 0.3707 / 15

==== Status ====================================================
>>>> Alarm
==== Press Ctrl-c for exit =====================================

==== Transaportation Condition Logging Monitor =================
>>>> Poll iteration No.: 2
==== Collected Data: RSL10 Sense ===============================

Ambient light: 41.0
Temperature: 25.38
Pressure: 97.37
Humidity: 28.74
Compas yaw: 359.945068
Device pitch: 2.955322
Device roll: 0.769043
Linear acceleration X axis: 0.003591
Linear acceleration Y axis: -0.177171
Linear acceleration Z axis: 0.326809
Magnetic field strength X axis: -26.794434
Magnetic field strength Y axis: -53.588867
Magnetic field strength Z axis: 32.470703
Acceleration vector: [0.003591, -0.177171, 0.326809]
Orientation vector: [359.945068, 2.955322, 0.769043]
Magnetic field vector: [-26.794434, -53.588867, 32.470703]

==== Collected Data: MPU-9250 ==================================

Acceleration vector: [0.048, 0.01, 1.03]
Gyroscope vector: [0.183, 0.244, 0.053]
Magnetic field vector: [-2.914, 55.01, 50.604]
Linear acceleration X axis: 0.048
Linear acceleration Y axis: 0.01
Linear acceleration Z axis: 1.03
Gyrospope X axis: 0.183
Gyrospope Y axis: 0.244
Gyrospope Z axis: 0.053
Magnetic field strength X axis: -2.914
Magnetic field strength Y axis: 55.01
Magnetic field strength Z axis: 50.604

==== Sensor Data Analysis ======================================

Ambient light threshold (200) check passed: 41.0
Temperature threshold (35) check passed: 25.38
Temperature threshold (15) check passed: 25.38
Humidity threshold (65) check passed: 28.74
Humidity threshold (20) check passed: 28.74
Acceleration vector threshold (10) check passed: 0.3718
Magnetic field vector change check passed, 
 delta:  4.4553 / 10,
 angle: 0.0170 / 0.2618
Magnetic field vector change check passed, 
 delta:  2.3049 / 10,
 angle: 0.0312 / 0.2618
Magnetic field vector delta change check passed, 
 change delta: 2.1504 / 15,
 angle change delta: 0.0143 / 15

==== Status ====================================================
>>>> Normal
==== Press Ctrl-c for exit =====================================

==== Transaportation Condition Logging Monitor =================
>>>> Poll iteration No.: 3
==== Collected Data: RSL10 Sense ===============================

Ambient light: 41.0
Temperature: 25.38
Pressure: 97.38
Humidity: 28.34
Compas yaw: 359.934082
Device pitch: 2.977295
Device roll: 0.780029
Linear acceleration X axis: -0.007183
Linear acceleration Y axis: -0.175974
Linear acceleration Z axis: 0.233435
Magnetic field strength X axis: -27.587891
Magnetic field strength Y axis: -54.382324
Magnetic field strength Z axis: 32.897949
Acceleration vector: [-0.007183, -0.175974, 0.233435]
Orientation vector: [359.934082, 2.977295, 0.780029]
Magnetic field vector: [-27.587891, -54.382324, 32.897949]

==== Collected Data: MPU-9250 ==================================

Acceleration vector: [0.048, 0.013, 1.038]
Gyroscope vector: [0.107, 0.229, 0.13]
Magnetic field vector: [-3.097, 55.921, 47.969]
Linear acceleration X axis: 0.048
Linear acceleration Y axis: 0.013
Linear acceleration Z axis: 1.038
Gyrospope X axis: 0.107
Gyrospope Y axis: 0.229
Gyrospope Z axis: 0.13
Magnetic field strength X axis: -3.097
Magnetic field strength Y axis: 55.921
Magnetic field strength Z axis: 47.969

==== Sensor Data Analysis ======================================

Ambient light threshold (200) check passed: 41.0
Temperature threshold (35) check passed: 25.38
Temperature threshold (15) check passed: 25.38
Humidity threshold (65) check passed: 28.34
Humidity threshold (20) check passed: 28.34
Acceleration vector threshold (10) check passed: 0.2924
Magnetic field vector change check passed, 
 delta:  1.6736 / 10,
 angle: 0.0055 / 0.2618
Magnetic field vector change check passed, 
 delta:  1.4182 / 10,
 angle: 0.0348 / 0.2618
Magnetic field vector delta change check passed, 
 change delta: 0.2554 / 15,
 angle change delta: 0.0293 / 15

==== Status ====================================================
>>>> Normal
==== Press Ctrl-c for exit =====================================

==== Transaportation Condition Logging Monitor =================
>>>> Poll iteration No.: 4
==== Collected Data: RSL10 Sense ===============================

Ambient light: 41.0
Temperature: 25.38
Pressure: 97.37
Humidity: 27.96
Compas yaw: 3.273926
Device pitch: -5.921631
Device roll: -31.552734
Linear acceleration X axis: 8.761581
Linear acceleration Y axis: -11.160571
Linear acceleration Z axis: 1.322796
Magnetic field strength X axis: 13.85498
Magnetic field strength Y axis: -30.395508
Magnetic field strength Z axis: 6.591797
Acceleration vector: [8.761581, -11.160571, 1.322796]
Orientation vector: [3.273926, -5.921631, -31.552734]
Magnetic field vector: [13.85498, -30.395508, 6.591797]

==== Collected Data: MPU-9250 ==================================

Acceleration vector: [0.051, 0.008, 1.035]
Gyroscope vector: [0.191, 0.229, 0.099]
Magnetic field vector: [-2.004, 56.285, 47.617]
Linear acceleration X axis: 0.051
Linear acceleration Y axis: 0.008
Linear acceleration Z axis: 1.035
Gyrospope X axis: 0.191
Gyrospope Y axis: 0.229
Gyrospope Z axis: 0.099
Magnetic field strength X axis: -2.004
Magnetic field strength Y axis: 56.285
Magnetic field strength Z axis: 47.617

==== Sensor Data Analysis ======================================

Ambient light threshold (200) check passed: 41.0
Temperature threshold (35) check passed: 25.38
Temperature threshold (15) check passed: 25.38
Humidity threshold (65) check passed: 27.96
Humidity threshold (20) check passed: 27.96
Acceleration vector norm threshold (10) reached: 14.2504
Magnetic field vector change check failed, 
 delta: 50.8594 / 10,
 angle: 0.8885 / 0.2618
Magnetic field vector change check passed, 
 delta:  0.0149 / 10,
 angle: 0.0163 / 0.2618
Magnetic field vector delta change check failed, 
 change delta: 50.8445 / 15,
 angle change delta: 0.8722 / 15

==== Status ====================================================
>>>> Alarm
==== Press Ctrl-c for exit =====================================

==== Transaportation Condition Logging Monitor =================
>>>> Poll iteration No.: 5
==== Collected Data: RSL10 Sense ===============================

Ambient light: 20.0
Temperature: 25.43
Pressure: 97.37
Humidity: 30.82
Compas yaw: 55.415039
Device pitch: -1.845703
Device roll: 5.734863
Linear acceleration X axis: -0.568623
Linear acceleration Y axis: -0.227449
Linear acceleration Z axis: -0.96606
Magnetic field strength X axis: 18.188477
Magnetic field strength Y axis: -56.884766
Magnetic field strength Z axis: 93.566895
Acceleration vector: [-0.568623, -0.227449, -0.96606]
Orientation vector: [55.415039, -1.845703, 5.734863]
Magnetic field vector: [18.188477, -56.884766, 93.566895]

==== Collected Data: MPU-9250 ==================================

Acceleration vector: [0.048, 0.01, 1.033]
Gyroscope vector: [0.214, 0.244, 0.168]
Magnetic field vector: [-1.093, 56.832, 48.496]
Linear acceleration X axis: 0.048
Linear acceleration Y axis: 0.01
Linear acceleration Z axis: 1.033
Gyrospope X axis: 0.214
Gyrospope Y axis: 0.244
Gyrospope Z axis: 0.168
Magnetic field strength X axis: -1.093
Magnetic field strength Y axis: 56.832
Magnetic field strength Z axis: 48.496

==== Sensor Data Analysis ======================================

Ambient light threshold (200) check passed: 20.0
Temperature threshold (35) check passed: 25.43
Temperature threshold (15) check passed: 25.43
Humidity threshold (65) check passed: 30.82
Humidity threshold (20) check passed: 30.82
Acceleration vector threshold (10) check passed: 1.1438
Magnetic field vector change check failed, 
 delta: 226.0118 / 10,
 angle: 0.8130 / 0.2618
Magnetic field vector change check passed, 
 delta:  1.3108 / 10,
 angle: 0.0132 / 0.2618
Magnetic field vector delta change check failed, 
 change delta: 224.7010 / 15,
 angle change delta: 0.7997 / 15

==== Status ====================================================
>>>> Alarm
==== Press Ctrl-c for exit =====================================

==== Transaportation Condition Logging Monitor =================
>>>> Poll iteration No.: 6
==== Collected Data: RSL10 Sense ===============================

Ambient light: 0.0
Temperature: 26.09
Pressure: 97.37
Humidity: 35.3
Compas yaw: 328.930664
Device pitch: 3.823242
Device roll: 0.351562
Linear acceleration X axis: 0.539892
Linear acceleration Y axis: 2.044648
Linear acceleration Z axis: -0.117316
Magnetic field strength X axis: -6.896973
Magnetic field strength Y axis: 21.484375
Magnetic field strength Z axis: -32.592773
Acceleration vector: [0.539892, 2.044648, -0.117316]
Orientation vector: [328.930664, 3.823242, 0.351562]
Magnetic field vector: [-6.896973, 21.484375, -32.592773]

==== Collected Data: MPU-9250 ==================================

Acceleration vector: [0.051, 0.01, 1.033]
Gyroscope vector: [0.153, 0.427, 0.061]
Magnetic field vector: [-3.825, 57.014, 48.32]
Linear acceleration X axis: 0.051
Linear acceleration Y axis: 0.01
Linear acceleration Z axis: 1.033
Gyrospope X axis: 0.153
Gyrospope Y axis: 0.427
Gyrospope Z axis: 0.061
Magnetic field strength X axis: -3.825
Magnetic field strength Y axis: 57.014
Magnetic field strength Z axis: 48.32

==== Sensor Data Analysis ======================================

Ambient light threshold (200) check passed: 0.0
Temperature threshold (35) check passed: 26.09
Temperature threshold (15) check passed: 26.09
Humidity threshold (65) check passed: 35.3
Humidity threshold (20) check passed: 35.3
Acceleration vector threshold (10) check passed: 2.1180
Magnetic field vector change check failed, 
 delta: 64.2878 / 10,
 angle: 3.1041 / 0.2618
Magnetic field vector change check passed, 
 delta:  0.1532 / 10,
 angle: 0.0367 / 0.2618
Magnetic field vector delta change check failed, 
 change delta: 64.1346 / 15,
 angle change delta: 3.0675 / 15

==== Status ====================================================
>>>> Alarm
==== Press Ctrl-c for exit =====================================

==== Transaportation Condition Logging Monitor =================
>>>> Poll iteration No.: 7
==== Collected Data: RSL10 Sense ===============================

Ambient light: 20.0
Temperature: 26.15
Pressure: 97.38
Humidity: 45.0
Compas yaw: 23.90625
Device pitch: 31.783447
Device roll: 6.152344
Linear acceleration X axis: -0.604536
Linear acceleration Y axis: 16.393099
Linear acceleration Z axis: 3.5099
Magnetic field strength X axis: -11.291504
Magnetic field strength Y axis: 16.052246
Magnetic field strength Z axis: 27.770996
Acceleration vector: [-0.604536, 16.393099, 3.5099]
Orientation vector: [23.90625, 31.783447, 6.152344]
Magnetic field vector: [-11.291504, 16.052246, 27.770996]

==== Collected Data: MPU-9250 ==================================

Acceleration vector: [0.049, 0.009, 1.034]
Gyroscope vector: [-0.031, 0.145, 0.092]
Magnetic field vector: [-5.647, 55.556, 48.672]
Linear acceleration X axis: 0.049
Linear acceleration Y axis: 0.009
Linear acceleration Z axis: 1.034
Gyrospope X axis: -0.031
Gyrospope Y axis: 0.145
Gyrospope Z axis: 0.092
Magnetic field strength X axis: -5.647
Magnetic field strength Y axis: 55.556
Magnetic field strength Z axis: 48.672

==== Sensor Data Analysis ======================================

Ambient light threshold (200) check passed: 20.0
Temperature threshold (35) check passed: 26.15
Temperature threshold (15) check passed: 26.15
Humidity threshold (65) check passed: 45.0
Humidity threshold (20) check passed: 45.0
Acceleration vector norm threshold (10) reached: 16.7755
Magnetic field vector change check failed, 
 delta: 14.2161 / 10,
 angle: 1.9368 / 0.2618
Magnetic field vector change check passed, 
 delta:  1.0116 / 10,
 angle: 0.0300 / 0.2618
Magnetic field vector delta change check passed, 
 change delta: 13.2045 / 15,
 angle change delta: 1.9067 / 15

==== Status ====================================================
>>>> Alarm
==== Press Ctrl-c for exit =====================================

==== Transaportation Condition Logging Monitor =================
>>>> Poll iteration No.: 8
==== Collected Data: RSL10 Sense ===============================

Ambient light: 20.0
Temperature: 26.3
Pressure: 97.37
Humidity: 48.86
Compas yaw: 20.961914
Device pitch: 1.878662
Device roll: 0.0
Linear acceleration X axis: -0.007183
Linear acceleration Y axis: -0.005986
Linear acceleration Z axis: 0.240617
Magnetic field strength X axis: -25.939941
Magnetic field strength Y axis: 63.293457
Magnetic field strength Z axis: -22.338867
Acceleration vector: [-0.007183, -0.005986, 0.240617]
Orientation vector: [20.961914, 1.878662, 0.0]
Magnetic field vector: [-25.939941, 63.293457, -22.338867]

==== Collected Data: MPU-9250 ==================================

Acceleration vector: [0.048, 0.01, 1.032]
Gyroscope vector: [0.214, 0.191, 0.145]
Magnetic field vector: [-3.643, 56.467, 49.55]
Linear acceleration X axis: 0.048
Linear acceleration Y axis: 0.01
Linear acceleration Z axis: 1.032
Gyrospope X axis: 0.214
Gyrospope Y axis: 0.191
Gyrospope Z axis: 0.145
Magnetic field strength X axis: -3.643
Magnetic field strength Y axis: 56.467
Magnetic field strength Z axis: 49.55

==== Sensor Data Analysis ======================================

Ambient light threshold (200) check passed: 20.0
Temperature threshold (35) check passed: 26.3
Temperature threshold (15) check passed: 26.3
Humidity threshold (65) check passed: 48.86
Humidity threshold (20) check passed: 48.86
Acceleration vector threshold (10) check passed: 0.2408
Magnetic field vector change check failed, 
 delta: 111.6048 / 10,
 angle: 1.2856 / 0.2618
Magnetic field vector change check passed, 
 delta:  1.5343 / 10,
 angle: 0.0279 / 0.2618
Magnetic field vector delta change check failed, 
 change delta: 110.0705 / 15,
 angle change delta: 1.2577 / 15

==== Status ====================================================
>>>> Alarm
==== Press Ctrl-c for exit =====================================

==== Transaportation Condition Logging Monitor =================
>>>> Poll iteration No.: 9
==== Collected Data: RSL10 Sense ===============================

Ambient light: 20.0
Temperature: 26.18
Pressure: 97.37
Humidity: 44.98
Compas yaw: 20.961914
Device pitch: 1.878662
Device roll: 0.0
Linear acceleration X axis: -0.016759
Linear acceleration Y axis: -0.026336
Linear acceleration Z axis: 0.234632
Magnetic field strength X axis: -25.146484
Magnetic field strength Y axis: 63.293457
Magnetic field strength Z axis: -22.338867
Acceleration vector: [-0.016759, -0.026336, 0.234632]
Orientation vector: [20.961914, 1.878662, 0.0]
Magnetic field vector: [-25.146484, 63.293457, -22.338867]

==== Collected Data: MPU-9250 ==================================

Acceleration vector: [0.05, 0.008, 1.033]
Gyroscope vector: [0.114, 0.214, 0.168]
Magnetic field vector: [-2.368, 55.921, 48.672]
Linear acceleration X axis: 0.05
Linear acceleration Y axis: 0.008
Linear acceleration Z axis: 1.033
Gyrospope X axis: 0.114
Gyrospope Y axis: 0.214
Gyrospope Z axis: 0.168
Magnetic field strength X axis: -2.368
Magnetic field strength Y axis: 55.921
Magnetic field strength Z axis: 48.672

==== Sensor Data Analysis ======================================

Ambient light threshold (200) check passed: 20.0
Temperature threshold (35) check passed: 26.18
Temperature threshold (15) check passed: 26.18
Humidity threshold (65) check passed: 44.98
Humidity threshold (20) check passed: 44.98
Acceleration vector threshold (10) check passed: 0.2367
Magnetic field vector change check passed, 
 delta:  0.3922 / 10,
 angle: 0.0103 / 0.2618
Magnetic field vector change check passed, 
 delta:  1.3819 / 10,
 angle: 0.0170 / 0.2618
Magnetic field vector delta change check passed, 
 change delta: 0.9897 / 15,
 angle change delta: 0.0067 / 15

==== Status ====================================================
>>>> Normal
==== Press Ctrl-c for exit =====================================

==== Transaportation Condition Logging Monitor =================
>>>> Poll iteration No.: 10
==== Collected Data: RSL10 Sense ===============================

Ambient light: 20.0
Temperature: 26.1
Pressure: 97.38
Humidity: 40.17
Compas yaw: 20.961914
Device pitch: 1.878662
Device roll: 0.0
Linear acceleration X axis: -0.02873
Linear acceleration Y axis: -0.016759
Linear acceleration Z axis: 0.2478
Magnetic field strength X axis: -26.245117
Magnetic field strength Y axis: 62.561035
Magnetic field strength Z axis: -23.498535
Acceleration vector: [-0.02873, -0.016759, 0.2478]
Orientation vector: [20.961914, 1.878662, 0.0]
Magnetic field vector: [-26.245117, 62.561035, -23.498535]

==== Collected Data: MPU-9250 ==================================

Acceleration vector: [0.05, 0.009, 1.033]
Gyroscope vector: [0.221, 0.191, 0.145]
Magnetic field vector: [-3.097, 57.378, 47.969]
Linear acceleration X axis: 0.05
Linear acceleration Y axis: 0.009
Linear acceleration Z axis: 1.033
Gyrospope X axis: 0.221
Gyrospope Y axis: 0.191
Gyrospope Z axis: 0.145
Magnetic field strength X axis: -3.097
Magnetic field strength Y axis: 57.378
Magnetic field strength Z axis: 47.969

==== Sensor Data Analysis ======================================

Ambient light threshold (200) check passed: 20.0
Temperature threshold (35) check passed: 26.1
Temperature threshold (15) check passed: 26.1
Humidity threshold (65) check passed: 40.17
Humidity threshold (20) check passed: 40.17
Acceleration vector threshold (10) check passed: 0.2500
Magnetic field vector change check passed, 
 delta:  0.1696 / 10,
 angle: 0.0244 / 0.2618
Magnetic field vector change check passed, 
 delta:  0.9148 / 10,
 angle: 0.0220 / 0.2618
Magnetic field vector delta change check passed, 
 change delta: 0.7452 / 15,
 angle change delta: 0.0024 / 15

==== Status ====================================================
>>>> Normal
==== Press Ctrl-c for exit =====================================

==== Transaportation Condition Logging Monitor =================
>>>> Poll iteration No.: 11
==== Collected Data: RSL10 Sense ===============================

Ambient light: 20.0
Temperature: 26.05
Pressure: 97.37
Humidity: 36.57
Compas yaw: 20.961914
Device pitch: 1.878662
Device roll: 0.0
Linear acceleration X axis: -0.025139
Linear acceleration Y axis: 0.00838
Linear acceleration Z axis: 0.189142
Magnetic field strength X axis: -27.038574
Magnetic field strength Y axis: 62.561035
Magnetic field strength Z axis: -22.766113
Acceleration vector: [-0.025139, 0.00838, 0.189142]
Orientation vector: [20.961914, 1.878662, 0.0]
Magnetic field vector: [-27.038574, 62.561035, -22.766113]

==== Collected Data: MPU-9250 ==================================

Acceleration vector: [0.049, 0.008, 1.031]
Gyroscope vector: [0.237, 0.198, 0.145]
Magnetic field vector: [-3.461, 56.649, 47.969]
Linear acceleration X axis: 0.049
Linear acceleration Y axis: 0.008
Linear acceleration Z axis: 1.031
Gyrospope X axis: 0.237
Gyrospope Y axis: 0.198
Gyrospope Z axis: 0.145
Magnetic field strength X axis: -3.461
Magnetic field strength Y axis: 56.649
Magnetic field strength Z axis: 47.969

==== Sensor Data Analysis ======================================

Ambient light threshold (200) check passed: 20.0
Temperature threshold (35) check passed: 26.05
Temperature threshold (15) check passed: 26.05
Humidity threshold (65) check passed: 36.57
Humidity threshold (20) check passed: 36.57
Acceleration vector threshold (10) check passed: 0.1910
Magnetic field vector change check passed, 
 delta:  0.0814 / 10,
 angle: 0.0150 / 0.2618
Magnetic field vector change check passed, 
 delta:  0.7231 / 10,
 angle: 0.0082 / 0.2618
Magnetic field vector delta change check passed, 
 change delta: 0.6418 / 15,
 angle change delta: 0.0068 / 15

==== Status ====================================================
>>>> Normal
==== Press Ctrl-c for exit =====================================

==== Transaportation Condition Logging Monitor =================
>>>> Poll iteration No.: 12
==== Collected Data: RSL10 Sense ===============================

Ambient light: 1132.0
Temperature: 26.01
Pressure: 97.37
Humidity: 32.87
Compas yaw: 20.961914
Device pitch: 1.867676
Device roll: 0.0
Linear acceleration X axis: -0.015562
Linear acceleration Y axis: -0.001197
Linear acceleration Z axis: 0.241814
Magnetic field strength X axis: -26.672363
Magnetic field strength Y axis: 62.866211
Magnetic field strength Z axis: -22.766113
Acceleration vector: [-0.015562, -0.001197, 0.241814]
Orientation vector: [20.961914, 1.867676, 0.0]
Magnetic field vector: [-26.672363, 62.866211, -22.766113]

==== Collected Data: MPU-9250 ==================================

Acceleration vector: [0.052, 0.01, 1.034]
Gyroscope vector: [0.153, 0.175, 0.099]
Magnetic field vector: [-2.368, 57.014, 48.672]
Linear acceleration X axis: 0.052
Linear acceleration Y axis: 0.01
Linear acceleration Z axis: 1.034
Gyrospope X axis: 0.153
Gyrospope Y axis: 0.175
Gyrospope Z axis: 0.099
Magnetic field strength X axis: -2.368
Magnetic field strength Y axis: 57.014
Magnetic field strength Z axis: 48.672

==== Sensor Data Analysis ======================================

Ambient light threshold (200) reached: 1132.0
Temperature threshold (35) check passed: 26.01
Temperature threshold (15) check passed: 26.01
Humidity threshold (65) check passed: 32.87
Humidity threshold (20) check passed: 32.87
Acceleration vector threshold (10) check passed: 0.2423
Magnetic field vector change check passed, 
 delta:  0.1800 / 10,
 angle: 0.0064 / 0.2618
Magnetic field vector change check passed, 
 delta:  0.9288 / 10,
 angle: 0.0155 / 0.2618
Magnetic field vector delta change check passed, 
 change delta: 0.7488 / 15,
 angle change delta: 0.0092 / 15

==== Status ====================================================
>>>> Alarm
==== Press Ctrl-c for exit =====================================

==== Transaportation Condition Logging Monitor =================
>>>> Poll iteration No.: 13
==== Collected Data: RSL10 Sense ===============================

Ambient light: 1142.0
Temperature: 25.99
Pressure: 97.37
Humidity: 31.72
Compas yaw: 20.961914
Device pitch: 1.867676
Device roll: 0.0
Linear acceleration X axis: -0.022745
Linear acceleration Y axis: -0.017957
Linear acceleration Z axis: 0.226252
Magnetic field strength X axis: -27.038574
Magnetic field strength Y axis: 63.659668
Magnetic field strength Z axis: -22.338867
Acceleration vector: [-0.022745, -0.017957, 0.226252]
Orientation vector: [20.961914, 1.867676, 0.0]
Magnetic field vector: [-27.038574, 63.659668, -22.338867]

==== Collected Data: MPU-9250 ==================================

Acceleration vector: [0.048, 0.011, 1.034]
Gyroscope vector: [0.191, 0.275, 0.053]
Magnetic field vector: [-2.55, 55.374, 49.199]
Linear acceleration X axis: 0.048
Linear acceleration Y axis: 0.011
Linear acceleration Z axis: 1.034
Gyrospope X axis: 0.191
Gyrospope Y axis: 0.275
Gyrospope Z axis: 0.053
Magnetic field strength X axis: -2.55
Magnetic field strength Y axis: 55.374
Magnetic field strength Z axis: 49.199

==== Sensor Data Analysis ======================================

Ambient light threshold (200) reached: 1142.0
Temperature threshold (35) check passed: 25.99
Temperature threshold (15) check passed: 25.99
Humidity threshold (65) check passed: 31.72
Humidity threshold (20) check passed: 31.72
Acceleration vector threshold (10) check passed: 0.2281
Magnetic field vector change check passed, 
 delta:  0.9679 / 10,
 angle: 0.0094 / 0.2618
Magnetic field vector change check passed, 
 delta:  1.1789 / 10,
 angle: 0.0200 / 0.2618
Magnetic field vector delta change check passed, 
 change delta: 0.2110 / 15,
 angle change delta: 0.0106 / 15

==== Status ====================================================
>>>> Alarm
==== Press Ctrl-c for exit =====================================

==== Transaportation Condition Logging Monitor =================
>>>> Poll iteration No.: 14
==== Collected Data: RSL10 Sense ===============================

Ambient light: 1142.0
Temperature: 25.98
Pressure: 97.37
Humidity: 30.53
Compas yaw: 20.961914
Device pitch: 1.867676
Device roll: 0.0
Linear acceleration X axis: -0.034716
Linear acceleration Y axis: -0.013168
Linear acceleration Z axis: 0.222661
Magnetic field strength X axis: -26.672363
Magnetic field strength Y axis: 63.293457
Magnetic field strength Z axis: -23.193359
Acceleration vector: [-0.034716, -0.013168, 0.222661]
Orientation vector: [20.961914, 1.867676, 0.0]
Magnetic field vector: [-26.672363, 63.293457, -23.193359]

==== Collected Data: MPU-9250 ==================================

Acceleration vector: [0.048, 0.009, 1.036]
Gyroscope vector: [0.214, 0.252, 0.061]
Magnetic field vector: [-3.097, 57.742, 47.617]
Linear acceleration X axis: 0.048
Linear acceleration Y axis: 0.009
Linear acceleration Z axis: 1.036
Gyrospope X axis: 0.214
Gyrospope Y axis: 0.252
Gyrospope Z axis: 0.061
Magnetic field strength X axis: -3.097
Magnetic field strength Y axis: 57.742
Magnetic field strength Z axis: 47.617

==== Sensor Data Analysis ======================================

Ambient light threshold (200) reached: 1142.0
Temperature threshold (35) check passed: 25.98
Temperature threshold (15) check passed: 25.98
Humidity threshold (65) check passed: 30.53
Humidity threshold (20) check passed: 30.53
Acceleration vector threshold (10) check passed: 0.2257
Magnetic field vector change check passed, 
 delta:  0.2583 / 10,
 angle: 0.0135 / 0.2618
Magnetic field vector change check passed, 
 delta:  1.0664 / 10,
 angle: 0.0374 / 0.2618
Magnetic field vector delta change check passed, 
 change delta: 0.8081 / 15,
 angle change delta: 0.0239 / 15

==== Status ====================================================
>>>> Alarm
==== Press Ctrl-c for exit =====================================

==== Transaportation Condition Logging Monitor =================
>>>> Poll iteration No.: 15
==== Collected Data: RSL10 Sense ===============================

Ambient light: 20.0
Temperature: 25.94
Pressure: 97.37
Humidity: 28.96
Compas yaw: 20.961914
Device pitch: 1.867676
Device roll: 0.0
Linear acceleration X axis: -0.014365
Linear acceleration Y axis: -0.005986
Linear acceleration Z axis: 0.227449
Magnetic field strength X axis: -26.672363
Magnetic field strength Y axis: 64.086914
Magnetic field strength Z axis: -22.338867
Acceleration vector: [-0.014365, -0.005986, 0.227449]
Orientation vector: [20.961914, 1.867676, 0.0]
Magnetic field vector: [-26.672363, 64.086914, -22.338867]

==== Collected Data: MPU-9250 ==================================

Acceleration vector: [0.052, 0.011, 1.033]
Gyroscope vector: [0.229, 0.244, 0.0]
Magnetic field vector: [-4.007, 56.832, 48.847]
Linear acceleration X axis: 0.052
Linear acceleration Y axis: 0.011
Linear acceleration Z axis: 1.033
Gyrospope X axis: 0.229
Gyrospope Y axis: 0.244
Gyrospope Z axis: 0.0
Magnetic field strength X axis: -4.007
Magnetic field strength Y axis: 56.832
Magnetic field strength Z axis: 48.847

==== Sensor Data Analysis ======================================

Ambient light threshold (200) check passed: 20.0
Temperature threshold (35) check passed: 25.94
Temperature threshold (15) check passed: 25.94
Humidity threshold (65) check passed: 28.96
Humidity threshold (20) check passed: 28.96
Acceleration vector threshold (10) check passed: 0.2280
Magnetic field vector change check passed, 
 delta:  0.5897 / 10,
 angle: 0.0149 / 0.2618
Magnetic field vector change check passed, 
 delta:  0.1856 / 10,
 angle: 0.0237 / 0.2618
Magnetic field vector delta change check passed, 
 change delta: 0.4040 / 15,
 angle change delta: 0.0087 / 15

==== Status ====================================================
>>>> Normal
==== Press Ctrl-c for exit =====================================

==== Transaportation Condition Logging Monitor =================
>>>> Poll iteration No.: 16
==== Collected Data: RSL10 Sense ===============================

Ambient light: 20.0
Temperature: 25.95
Pressure: 97.37
Humidity: 28.68
Compas yaw: 20.961914
Device pitch: 1.867676
Device roll: 0.0
Linear acceleration X axis: -0.017957
Linear acceleration Y axis: 0.001197
Linear acceleration Z axis: 0.222661
Magnetic field strength X axis: -25.939941
Magnetic field strength Y axis: 63.659668
Magnetic field strength Z axis: -22.338867
Acceleration vector: [-0.017957, 0.001197, 0.222661]
Orientation vector: [20.961914, 1.867676, 0.0]
Magnetic field vector: [-25.939941, 63.659668, -22.338867]

==== Collected Data: MPU-9250 ==================================

Acceleration vector: [0.049, 0.007, 1.033]
Gyroscope vector: [0.206, 0.206, 0.107]
Magnetic field vector: [-5.465, 55.374, 48.847]
Linear acceleration X axis: 0.049
Linear acceleration Y axis: 0.007
Linear acceleration Z axis: 1.033
Gyrospope X axis: 0.206
Gyrospope Y axis: 0.206
Gyrospope Z axis: 0.107
Magnetic field strength X axis: -5.465
Magnetic field strength Y axis: 55.374
Magnetic field strength Z axis: 48.847

==== Sensor Data Analysis ======================================

Ambient light threshold (200) check passed: 20.0
Temperature threshold (35) check passed: 25.95
Temperature threshold (15) check passed: 25.95
Humidity threshold (65) check passed: 28.68
Humidity threshold (20) check passed: 28.68
Acceleration vector threshold (10) check passed: 0.2234
Magnetic field vector change check passed, 
 delta:  0.8794 / 10,
 angle: 0.0076 / 0.2618
Magnetic field vector change check passed, 
 delta:  1.3387 / 10,
 angle: 0.0242 / 0.2618
Magnetic field vector delta change check passed, 
 change delta: 0.4594 / 15,
 angle change delta: 0.0165 / 15

==== Status ====================================================
>>>> Normal
==== Press Ctrl-c for exit =====================================

==== Transaportation Condition Logging Monitor =================
>>>> Poll iteration No.: 17
==== Collected Data: RSL10 Sense ===============================

Ambient light: 20.0
Temperature: 25.93
Pressure: 97.37
Humidity: 28.89
Compas yaw: 20.961914
Device pitch: 1.647949
Device roll: 0.615234
Linear acceleration X axis: -0.169988
Linear acceleration Y axis: -0.041899
Linear acceleration Z axis: 0.219069
Magnetic field strength X axis: -13.671875
Magnetic field strength Y axis: 51.269531
Magnetic field strength Z axis: -16.845703
Acceleration vector: [-0.169988, -0.041899, 0.219069]
Orientation vector: [20.961914, 1.647949, 0.615234]
Magnetic field vector: [-13.671875, 51.269531, -16.845703]

==== Collected Data: MPU-9250 ==================================

Acceleration vector: [0.054, 0.012, 1.034]
Gyroscope vector: [0.244, 0.229, 0.008]
Magnetic field vector: [6.193, 70.311, 48.847]
Linear acceleration X axis: 0.054
Linear acceleration Y axis: 0.012
Linear acceleration Z axis: 1.034
Gyrospope X axis: 0.244
Gyrospope Y axis: 0.229
Gyrospope Z axis: 0.008
Magnetic field strength X axis: 6.193
Magnetic field strength Y axis: 70.311
Magnetic field strength Z axis: 48.847

==== Sensor Data Analysis ======================================

Ambient light threshold (200) check passed: 20.0
Temperature threshold (35) check passed: 25.93
Temperature threshold (15) check passed: 25.93
Humidity threshold (65) check passed: 28.89
Humidity threshold (20) check passed: 28.89
Acceleration vector threshold (10) check passed: 0.2804
Magnetic field vector change check failed, 
 delta: 22.9791 / 10,
 angle: 0.1205 / 0.2618
Magnetic field vector change check failed, 
 delta: 15.9308 / 10,
 angle: 0.1863 / 0.2618
Magnetic field vector delta change check passed, 
 change delta: 7.0483 / 15,
 angle change delta: 0.0658 / 15

==== Status ====================================================
>>>> Alarm
==== Press Ctrl-c for exit =====================================

==== Transaportation Condition Logging Monitor =================
>>>> Poll iteration No.: 18
==== Collected Data: RSL10 Sense ===============================

Ambient light: 20.0
Temperature: 25.93
Pressure: 97.37
Humidity: 28.59
Compas yaw: 73.937988
Device pitch: 1.702881
Device roll: 0.186768
Linear acceleration X axis: -0.077812
Linear acceleration Y axis: -0.034716
Linear acceleration Z axis: 0.241814
...

This file has been truncated, please download it to see its full contents.

Credits

Anton Bondarenko

Anton Bondarenko

1 project • 2 followers

Comments