sense

Sensor Layer

In this project we use iot-lab m3 boards provided by FIT IOT-LAB which has 4 different types of sensors mounted to it. They are,

In our project we used only the LPS331AP sensor to measure temperature values.

IOT-LAB M3 board architecture

IOT test bed m3 architecture

More details about IOT-LAB M3 board can be found here: IoT-LAB M3 · FIT IoT-LAB

Noise in temperature readings

Noise in sensor readings refers to unwanted or random variations in the data collected by sensors. This noise can be caused by various factors and can have a significant impact on the accuracy and reliability of the sensor readings. Here are some common sources of noise in IoT sensor data.

Noise reduction technique we used

To eliminate those noises we implemented moving averaging filtering method.

Moving average filtering is a common technique used in signal processing and data analysis to smooth out fluctuations or noise in a time series data set. It is particularly useful in situations where the data contains random variations that may obscure underlying trends or patterns. Moving average filtering works by calculating the average of a set of consecutive data points over a specified window or period, and this average value is then used to represent the smoothed data.

There are different variations of moving averages, including:

In our project we used Simple Moving Average Method with window size equal to 5.

Moving average method implementation

Data Resilience

To ensure that the exact data we sent received to the server, we used a parity bit after the each temperature value. When the data is received by the CoAP cloud server, the server extracts the data, including the parity bit assigned to each temperature value. The server then performs a parity check, verifying the integrity of each temperature value. If a discrepancy is detected, indicating that the data has been corrupted during transmission, the server average out the corrupted data to ensure the accuracy and reliability of the received information.

Parity bit

There are two common types of parity:

  1. Even Parity:

    • In even parity, the total number of bits set to 1 in a given set of bits, including the parity bit, is made even.
    • If the number of 1s is already even, the parity bit is set to 0. If the number of 1s is odd, the parity bit is set to 1.
  2. Odd Parity:

    • In odd parity, the total number of bits set to 1 is made odd.
    • If the number of 1s is already odd, the parity bit is set to 0. If the number of 1s is even, the parity bit is set to 1.

In our project we have used odd parity.

Parity bit calculator

Power optimization

Calibration

Sensor needed some setup to work properly. In IOT test bed examples they initialize the sensor and reads data. But that code is not properly written and sensor needs to be reset to work in properly to get good enough data.

Res conf Res conf 1

     ztimer_sleep(ZTIMER_MSEC, 5000);

We wrote some helper functions. There may already be functions provided by RIOT but due to time limitation we wrote our own.

int write_register_value(const lpsxxx_t *dev, uint16_t reg, uint8_t value)
{
  i2c_acquire(DEV_I2C);
  if (i2c_write_reg(DEV_I2C, DEV_ADDR, reg, value, 0) < 0)
  {
    i2c_release(DEV_I2C);
    return -LPSXXX_ERR_I2C;
  }
  i2c_release(DEV_I2C);

  return LPSXXX_OK; // Success
}

int temp_sensor_write_CTRL_REG2_value(const lpsxxx_t *dev, uint8_t value)
{
  return write_register_value(dev, LPSXXX_REG_CTRL_REG2, value);
}

int temp_sensor_write_res_conf(const lpsxxx_t *dev, uint8_t value)
{
  return write_register_value(dev, LPSXXX_REG_RES_CONF, value);
}

References