Code Monkey home page Code Monkey logo

iot-project's Introduction

IoT Mini Project 1

Introduction

Welcome to the IoT Mini Project 1 repository! This project aims to demonstrate the implementation of a simple Internet of Things (IoT) solution. Whether you're a student, developer, or enthusiast, this project provides a hands-on experience in building a basic IoT system.

Members

Student name Student ID
Toseef Ahmed 2307270
Hung Trinh 2307229
Mazen Hassaan 2307227

Project Overview

The project focuses on getting data from IOT sensor via IOT Testbed and send it to cloud database. Key features include:

  • Create a firmware based on RIOT (https://riot-os.org).
  • The firmware should periodically read sensor data and send it towards an IoT Cloud provider.
  • Program nodes on FIT-IoT Testbed with our firmware.
  • Sending data to the cloud requires
  • a border router
  • multi-hop forwarding towards the border router
  • Create a driver for an emulated sensor

Getting Started

Follow these steps to get the project up and running on your local machine or IoT device.

Prerequisites

In order to run this code, you need to have account in

Installation

Here is all steps by steps installing this project.

  1. Create your IOT Testbed account. https://www.iot-lab.info/testbed

  2. Link your SSH key to IOT Testbed by following this instruction https://www.iot-lab.info/docs/getting-started/ssh-access/ Alt text

  3. Open Visual Studio Code and connect to host:

  • Firstly, modify config file like this: Alt text Host and Hostname you must keep the same, and change your User to your Testbed's username and IdentityFile is the link to your private key.
  • Then you now can connect to your Testbed folder like this: Alt text Alt text Alt text

After seeing SSH: grenoble.iot-lab.info appeared on your bottom left corner, you has successfully connected to your Testbed. Now click on "Open folder" button. Alt text

Then click OK Alt text

  1. Clone our repository to your IOT Testbed folder at the default branch.
  • Open terminal on VScode Alt text
  • Clone our repo:
git clone https://github.com/manhhungking/IOT-project-1.git

Alt text

  • Clone RIOT
git clone https://github.com/RIOT-OS/RIOT.git

Alt text After that, you should have 2 folders like this: Alt text

  • Navigate to project folder
cd IOT_Mini_Project1

Alt text

  • Building RIOT on the SSH frontend requires a recent ARM gcc toolchain, the default is 4.9 and is not compatible. You just have to issue the source /opt/riot.source command like this:

Alt text

Usage

  1. Build Border Router Firmware Source RIOT environment
source /opt/riot.source

Build border router firmware for M3 node with baudrate 500000 Note: Use a different 802.15.4 channel if needed

make ETHOS_BAUDRATE=500000 DEFAULT_CHANNEL=<channel> BOARD=iotlab-m3 -C examples/gnrc_border_router clean all
  1. Flash Border Router Firmware Flash the border router firmware to the first M3 node (m3-1 in this case)
iotlab-node --flash examples/gnrc_border_router/bin/iotlab-m3/gnrc_border_router.elf -l grenoble,m3,<id>
  1. Configure Border Router Network

Configure the network of the border router on m3- Propagate an IPv6 prefix with ethos_uhcpd.py

sudo ethos_uhcpd.py m3-<id> tap0 2001:660:5307:3100::1/64
  1. Setup MQTT Broker and Mosquitto Bridge on A8 Node Now, in another terminal, SSH to the SSH frontend, and login into clone the mqtt_broker and mosquitto bridge configuration files in A8 shared directory. SSH into the A8 node
ssh root@node-a8-1

Check the global IPv6 address of the A8 node

ifconfig
  1. Start MQTT Broker From the A8 shared directory, start the MQTT broker using config.conf
cd ~/A8
broker_mqtts config.conf

Configure and Start Mosquitto Bridge From another terminal on the A8 node, check for existing mosquitto service and stop it

Modify mosquitto.conf with the IPv6 address of AWS-EC2 instance

Start Mosquitto service using the modified configuration file

root@node-a8-3:~/A8# mosquitto -c mosquitto.conf

Tests

Build and Flash Sensor Node Firmware

From another terminal log into SSH front end of grenoble site Clone the sensor node directory containing Makefile and main.c Build the firmware for the sensor node using A8 node's IPv6 address and tap-id

make DEFAULT_CHANNEL=15 SERVER_ADDR=<EC2 IPv6> EMCUTE_ID=station<tap-id> BOARD=iotlab-m3 -C . clean all

Flash the sensor node firmware on an M3 node

iotlab-node --flash ./bin/iotlab-m3/SensorNode.elf -l grenoble,m3,<id>

Connect to Sensor Node

Log into the M3 node

nc m3-<id> 20000

Setting Up EC2 Instance

  1. Create a new Subnet and VPC. Make sure to add IPV6 CIDRs on the Subnet and VPC.
  2. Enable Public Routes for both IPV4 and IPv6 on internet gateway.
  3. Create a new Security Group and enable PORT 1883. Also enable ICMP for IPv4 and IPv6.
  4. Create a new EC2 Instance and assign these newly created resources to it. Also assign a IPv6 to the instance.
  5. Generate key pair to ssh in to the EC2.

Make sure you have configured your Security group, ACL and Subnet just like snapshots below:

Security Group: Alt text

Route table: Alt text

Access Control List (ACL):

Alt text

55ae4b770bf588b994e61ad633a83e4065b2ba84

Access the EC2 instance via SSH and execute the following commands to install the Mosquitto broker:

ssh -i key.pem unbuntu@<public dns of the ec2>

Add Mosquitto PPA repository: sudo apt-add-repository ppa:mosquitto-dev/mosquitto-ppa

Update the package list: sudo apt-get update

Install Mosquitto: sudo apt-get install mosquitto

Install Mosquitto clients: sudo apt-get install mosquitto-clients

Clean the package cache: sudo apt clean

Check the status of the Mosquitto service to ensure it's running:

sudo service mosquitto status

Run the node Influxdb container on EC2 instance:

docker run --name influxdb -p 8086:8086 influxdb:2.2.0

Run the node Grafana container on EC2 instance:

docker run -d --name=grafana -p 3000:3000 grafana/grafana

We used influx DB as it is open source, light weight and efficient for time series data. Since our application is small, this seemed like a better option compared to other DB Options such as MongoDB or PostgreSQL.

After the data is transmitted, influx DB will store it and pulled by grafana, where user can see the data in realtime.

Alt text

Alt text

Alt text

iot-project's People

Contributors

toseef-ahmd avatar manhhungking avatar

Watchers

 avatar

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.