sense

Contributors Forks Issues MIT License


Logo

Sense

Sensor to Cloud - CoAP enabled system
Explore the docs »

View Demo · Report Bug · Request Feature

Table of Contents
  1. About The Project
  2. Getting Started
  3. Roadmap
  4. Documentation
  5. License
  6. Contact
  7. Acknowledgments

About The Project

High Level Architecture

High Level Architecture

Sensor Layer

More details about sensor layer is here : <li>Sensor Layer Detailed Informaton | Sense</li>

(back to top)

Network Layer

More details about network layer is here : docs/Network

References

(back to top)

Data Management Layer

More details about data management layer is here : docs/Server

Overview of Data Flow

  1. Data Ingestion: CoAP data is ingested into the EC2 instance, where the CoAP listener Docker container captures and extracts the temperature values along with parity bits.
  2. Data Storage: Extracted and verified data, is written into InfluxDB for persistent storage.
  3. Data Visualization: Grafana connects to InfluxDB to fetch time-series data and displays it through customizable dashboards.

The integration of InfluxDB and Grafana within the EC2 environment provides a robust foundation for handling, storing, and visualizing time-series data efficiently.

References

(back to top)

Security

(back to top)

Built With

Getting Started

Prerequisites

Test bed,

Server,

References,

(back to top)

Installation

Server side

Following the below guide you will be setting up the server. Below are the points we are goint to address.

More details server setup is here : docs/Server

(back to top)

Testbed side

Testbed already has relevant environment and tool and our make command make run_mini_project_1 will completely run the sensor layer once you properly set it up according the section below.

If you already tried our [How to Run Hello Sense Wiki](https://github.com/KRVPerera/sense/wiki/Running-our-Hello-world-in-F-I-T-IOT%E2%80%90LAB) example you can skip 1-5
  1. Clone the repo ideally to the home folder in an SSH from end of the IOT test bed
  2. If this is your first time, you have to authenticate using iotlab-auth command
  3. Run this command in the sense folder to get RIOT. git submodule update --init
  4. Change the site here (SENSE_SITE) in [setup_env.sh#L4 Sense](https://github.com/KRVPerera/sense/blob/main/scripts/setup_env.sh#L4). Without running the system from the same site we cannot ssh directly into nodes.
  5. Border router IP.

    • We are automatically assigning this according the site name you provided in above point 4.
    • But you can do it manually as well.Change the boarder router IP here (BORDER_ROUTER_IP) in [setup_env.sh Sense](https://github.com/KRVPerera/sense/blob/27b935a44a8a17de54a6b4f463ea0e086fbcb665/scripts/setup_env.sh#L70) according to [IPv6 FIT IoT Testbed](https://www.iot-lab.info/docs/getting-started/ipv6/)
  6. Set the CoAP server IP (amazon in our case) in the terminal using export COAP_SERVER_IP="[2001:660:4403:497:a417:1216:7ea7:9acb]:5683". How to setup the server is explained in our docs docs/Server.
  7. Run the command make run_mini_project_1 from the sense home directory.
  8. If the default nodes are busy, change the initial node number here [setup_env.sh#L29 Sense](https://github.com/KRVPerera/sense/blob/27b935a44a8a17de54a6b4f463ea0e086fbcb665/scripts/setup_env.sh#L29)

[!TIP] Our demo video can be a hand one experience setup for you here IoT mini project Group 12 | Youtube video.

(back to top)

How to run the project

If the server is ready and everything is setup correctly, Run the command make run_mini_project_1 from the sense home directory. You will start to see receving data from the server (coap server -> database -> grafana)

(back to top)

Documentation

Sensor Layer Detailed Informaton

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

doas/SENSOR

docs/NETWORK

docs/SERVER

docs/COMPRESSION

License

Distributed under the MIT License. See LICENSE.txt for more information.

(back to top)

Acknowledgments

(back to top)