Code Monkey home page Code Monkey logo

blockchain-real-time-analysis-iota's Introduction

IOTA-MAM_Cold-Chain-Monitoring

This is a Blockchain Application based on IOTA Masked Authenticated Messaging API , to monitor sensor data delivered by embedded system.

The problem :

Today, more and more frauds related to non-compliance with the cold chain are identified through the high number of food poisoning and deaths each year. In France alone, according to the Revue de la santé Publique, there are 2.2 million cases of food poisoning per year, including 17,000 hospitalizations and more than 200 deaths annually.

Breaking this chain therefore involves risks.In fact, the rise in temperature may lead to the proliferation of certain germs (salmonella, staphylococcus aureus, listeria monocytogens, etc.) and then render the product unfit for consumption.

My Solution :

In order to remedy this lack of transparency and respect for health protocols on the part of the parties concerned, a solution to the problem has been devised:

Using the IOTA Tangle to our advantage by adapting a decentralized, secure but also reliable solution, dedicated specifically to connected objects, and which does not require fees as in other networks.

Getting Started :

# The easiest way to get started is to clone the repository:
git clone https://github.com/RayanAAY-ops/IOTA-MAM-cold_chain_monitoring.git myapp

Mongodb ATLAS :

I used mongodb ATLAS to store root data related to my sensor data ,you have to configure your details in both directory :

nodejs-application/.env 
raspberrypi/.env

And fill it with your credentials:

MONGO_ATLAS_USERNAME = my_username
MONGO_ATLAS_PW=   my_password
MONGO_ATLAS_CLUSTER=  my_cluster

Or connect it to a local Mongodb Database.

RaspberryPI :

Copy the rapsberrypi folder to your PI and connect to it:

scp -r myapp/raspberrypi/ pi@<ip_address>:/home/pi
ssh pi@<ip_address>

I used a pi 3 with 2GB of RAM connected with DTH11 Sensor through GPIO 4

# First update your pi
sudo apt-get update

# Change directory to raspberrypi
cd ~/pi/raspberrypi 

# Install NPM dependencies for raspberrypi 
npm install 

# Send data to the Tangle
node mam_API/send_mam.js

nodejs-application :

On your local machine ,run :

# Change directory to nodejsapplication 
cd myapp/nodejs-application  

# Install NPM dependencies for nodejs-application 
npm install

# Then simply start your app
npm start

you can check website will be up and running on localhost at 3000 port.
http://localhost:3000

Prerequisites :

you need to install following software

  1. Nodejs https://nodejs.org/en/download/
  2. Express setup in nodejs application using pug template
  3. Mongodb
  4. IOTA MAM API https://iota.org/

Project Structure :

nodejsapplication :

Name Description
bin/ create server and normalize port
db/ Mongodb connection + IOTA MAM Fetch
fetch_data.js fetch sensor data using root stored in mongodb ATLAS
public/ Static assets (css, img etc)
public/styleshees/style.css Main stylesheet for your app
routes/ controller for different routes
routes/charts.js controller for display line charts
routes/index.js controller for navigation bar
views/ Templates
views/dashboard Dashboard related templates
views/dashbaord/temperature.pug Display line chart
views/dashbaord/humidity.pug Display line chart
views/partials/about.pug About page(rendering test)
views/error.pug  Template for error messages
views/partials/navbar.pug Navbar partial template.
views/layout.pug Base template.
app.js The main application file.

raspberrypi :

Name Description
mam_API/ POST request to the tangle-chain and Mongodb ATLAS
send_mam.js send real time sensor data to the tangle and Mongodb ATLAS
sensors/ sensors scripts repository
dht11.js asynchronous function piped to the send_mam.js file

environment file :

Name Description
.env configuration file for environment variables

Authors :

License :

This project is licensed under the MIT License - see the LICENSE.md file for details

Acknowledgments

blockchain-real-time-analysis-iota's People

Contributors

rayanaay-ops avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

henry-un

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.