Giter Club home page Giter Club logo

exam2-bkcloud's Introduction

1. Thiết kế cơ sở dữ liệu để lưu trữ dữ liệu từ các sensors:

MySQL: tên database: iot

User: root - Pass: bklcoud

Các bảng trong mysql:

device

location_id | location_name | device_id | type | created_at | status

CREATE TABLE device (
location_id 	VARCHAR(255) 	NOT NULL,
location_name 	VARCHAR(255) 	NOT NULL,
device_id 	VARCHAR(255) 	NOT NULL,
type		VARCHAR(255) 	NOT NULL,
status 		VARCHAR(255) 	NOT NULL,
created_at 	DATETIME 	NOT NULL,
PRIMARY KEY (location_id)
)

sensor

location_id | name | unit | created_at | status

CREATE TABLE sensor (
name 		VARCHAR(255)	NOT NULL,
location_id 	VARCHAR(255) 	NOT NULL,
unit 		VARCHAR(255),
status 		VARCHAR(255) 	NOT NULL,
type 		VARCHAR(255) 	NOT NULL,
created_at 	DATETIME	NOT NULL,
PRIMARY KEY (name, location_id),
CONSTRAINT fk_device FOREIGN KEY (location_id) REFERENCES device(location_id) ON DELETE CASCADE
)

InFluxDB: tên database: iot

Các measurement    

data

time | location_id (tag)  | name (tag) | unit (field - String) | value (field - Float)

2. Các topic trên MQTT

esp/data từ ESP gửi lên Node-red với 2 định dạng:

{
	location_id: "", 
	type: "data",
	sensorsData: [
		{name: "DHT11-t", value: 24, unit: "C"},
		{name: "DHT11-h", value: 70, unit: "%"},
	]
}

esp/newDevice

{
	location_id: "HN",
	location_name: "Ha Noi",
	type: "ESP8266",
	deviceID: "team01",
	sensors:  [
		{ name: "DHT11-t", unit: "C"},
		{ name: "DHT11-h", unit: "%"}
	]
}

exam2-bkcloud's People

Contributors

hamanhdong avatar thaonguyentien avatar haminhcong avatar

Watchers

James Cloos avatar  avatar  avatar  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.