ResourceHub API. Not for production. Changes in repository, not implemented sqlite, chages sensor data dto, Changes in Readme file, for update Concept for global collecting sensor's data from cities
This commit is contained in:
@@ -2,45 +2,84 @@
|
||||
|
||||
> [!NOTE]
|
||||
> **[DataCollector]** sends [**sensor's data] **like as *PH Level*, *Humidity*, *Temperature*, etc) as ++JSON++ to this **[API]**
|
||||
> **RESOURCE HUB - means a Public Storage with Sensors Data**
|
||||
> 
|
||||
> **RESOURCE HUB - means a Public Storage with Sensors Data,.****
|
||||
> 
|
||||
> ```json
|
||||
> {
|
||||
> {
|
||||
> name: "pH sensor",
|
||||
> id: 1,
|
||||
> city_codename_cords_sector_cell: "CERCELL-A1:[40.7128,-74.0060]::S1:C1"
|
||||
> name: "Acidity‑alkalinity of a solution:[PH 0-14]",
|
||||
> value: "5.5",
|
||||
> unit: "pH" // to measure the acidity or alkalinity of a solution
|
||||
> unit: "pH", // to measure the acidity or alkalinity of a solution
|
||||
> timestamp: 17000002 // decode_timestamp(17000002) -> (2024, 3, 8, 12, 34, 52) -> "2024.03.8:12:34:52" [year.month.day:hour:min:sec]
|
||||
> },
|
||||
> {
|
||||
> name: "DHT22",
|
||||
> id: 1,
|
||||
> city_codename_cords_sector_cell: "CERCELL-A2:[70.7128,-56,00012]::S1:C1"
|
||||
> name: "Acidity‑alkalinity of a solution:[PH 0-14]",
|
||||
> value: "5.7",
|
||||
> unit: "pH", // to measure the acidity or alkalinity of a solution
|
||||
> timestamp: 17000035
|
||||
> },
|
||||
> ....
|
||||
> {
|
||||
> id: 2,
|
||||
> city_codename_cords_sector_cell: "BETTA-A1:[40.7128,-74.0060]::S1:C1"
|
||||
> name: "Humidity:[DHT22]",
|
||||
> value: "20.7",
|
||||
> unit: "RH" // Relative Humidity (RH)
|
||||
> unit: "RH", // Relative Humidity (RH)
|
||||
> timestamp: 17000002
|
||||
> },
|
||||
> ...
|
||||
> {
|
||||
> name: "DHT22",
|
||||
> id: 3,
|
||||
> city_codename_cords_sector_cell: "ANLATIC-mAI:[40.7128,-74.0060]::S1:C1"
|
||||
> name: "Temperature:[DHT22]",
|
||||
> value: "35.0",
|
||||
> unit: "Celsius" // or Fahrenheit Temperature of room
|
||||
> unit: "°C", // or Fahrenheit Temperature of room '°C' preffered for UI Charts
|
||||
> timestamp: 17000002
|
||||
> }
|
||||
> ...
|
||||
> }
|
||||
> ```
|
||||
> # Redis database save recevied [sensor-data] into Table Sensor_data[S5-1]
|
||||
> - **[S5]** - means SECTOR-5,
|
||||
> - **"-1"** in [S5**-1**] means SECTOR-5-CELL-1
|
||||
> ### In concept
|
||||
> - SECTOR-5-CELL-1 can collect data about tomatos
|
||||
> - SECTOR-5-CELL-2 can collect data about potatos
|
||||
> > **In future can be added 'resource' journals,.**
|
||||
> > **a. "how much" system make a 'tomatos', 'gabbages,.' : 10 tomatos/month, 40 gabbeges/month, etc,.)**
|
||||
> > **b. "n/year"**
|
||||
> > **c. **
|
||||
> # Redis database save recevied [sensor-data] into Table Sensor_data
|
||||
> # CERCELL-A1:[40.7128,-74.0060]::S1:C1
|
||||
> - **CERCELL** - "**City** **name**"
|
||||
> - **-A1** - " City **codename" (can be empty)**
|
||||
> - **[40.7128,-74.0060] **- City,. **Coordinates** [° N,° W]
|
||||
> - [40.7128,-74.0060] ----> "**New York**"
|
||||
> - **S1:C1** - Means **SECTOR**:**CELL**
|
||||
> - **S1** - Means: **Sector** **1**
|
||||
> - **C1** - Means: **Cell** **1**
|
||||
> - **:** - field splitter (for future. May be parsers can use this for getting fields: cityid, cords, sector, cell)
|
||||
>
|
||||
> | id | Sector | Cell | sensor_name | value | unit |
|
||||
> | --- | ------ | ---- | ----------- | ----- | ------- |
|
||||
> | 1 | 1 | 1 | pH sensor | 5.5 | pH |
|
||||
> | 2 | 1 | 1 | DHT22 | 20.7 | RH |
|
||||
> | 3 | 1 | 1 | DHT22 | 35.0 | Celsius |
|
||||
> | 4 | 1 | 2 | pH sensor | 2.5 | pH |
|
||||
> | 5 | 1 | 2 | DHT22 | 20.0 | Celsius |
|
||||
> ### In concept
|
||||
> > SECTOR-5-CELL-1 can collect data about tomatos
|
||||
> > SECTOR-5-CELL-2 can collect data about potatos
|
||||
> > **In future can be added 'resource' journals,.**
|
||||
> > **a. "how much" system make a 'tomatos', 'gabbages,.' : 10 tomatos/month, 40 gabbeges/month, etc,.)**
|
||||
> > **b. "n/year"**
|
||||
> > **c. **
|
||||
> ## * Sensors Data Table * [**Example**]
|
||||
>
|
||||
> | id | city_codename_cords_sector_cell | sensor_name_and_model | value | unit | timestamp |
|
||||
> | --- | -------------------------------------------------------------------------------- | ---------------------------------------------------- | ----- | ------- | --------- |
|
||||
> | 1 | AQUA-A1:[[-18.7669,46.8691](https://maps.google.com/?q=-18.7669,46.8691)]:S1:C1 | Acidity‑alkalinity of a solution:[PH 0-14] | 5.5 | pH | 17000002 |
|
||||
> | 2 | CERCELL:[40.7128,-74.0060]::S1:C1 | Humidity:[DHT22] | 20.7 | % RH | 158371335 |
|
||||
> | 3 | AQUA:[[64.9631,-19.0208](https://maps.google.com/?q=64.9631,-19.0208)]::S2:C2 | O₂ sensor:[MiCS‑5524] | % vol | % vol | 23656547 |
|
||||
> | 4 | AQUA:[[64.9631,-19.0208](https://maps.google.com/?q=64.9631,-19.0208)]::S1:C1 | Acidity‑alkalinity of a solution:[PH 0-14] | 2.5 | pH | 23657524 |
|
||||
> | 5 | OCEAN:[[35.6895,139.6917](https://maps.google.com/?q=35.6895,139.6917)]::S1:C1 | Temperature:[DHT22] | 20.0 | °C | 45557562 |
|
||||
> | 6 | AQUA-B2:[[12.9716,77.5946](https://maps.google.com/?q=12.9716,77.5946)]:S2:C2 | Humidity:[DHT22] | 45.2 | % RH | 51234567 |
|
||||
> | 7 | DESERT:[[23.4241,53.8478](https://maps.google.com/?q=23.4241,53.8478)]:S1:C1 | Soil moisture:[Capacitive Soil Moisture Sensor v1.2] | 12.3 | % vol | 52345678 |
|
||||
> | 8 | MOUNTAIN:[[35.3606,138.7274](https://maps.google.com/?q=35.3606,138.7274)]:S3:C3 | Sound level:[Adafruit MEMS Mic] | 68 | dB SPL | 53456789 |
|
||||
> | 9 | RIVER:[[48.8566,2.3522](https://maps.google.com/?q=48.8566,2.3522)]:S1:C2 | Acidity‑alkalinity of a solution:[PH 0-14] | 6.8 | pH | 54567890 |
|
||||
> | 10 | OCEAN:[[34.0522,-118.2437](https://maps.google.com/?q=34.0522,-118.2437)]:S2:C1 | Pressure:[BMP280] | 22.1 | hPa | 55678901 |
|
||||
> | 11 | FOREST:[[51.5074,-0.1278](https://maps.google.com/?q=51.5074,-0.1278)]:S1:C3 | Wind speed:[Anemometer 3‑Axis 3000] | 30.5 | m / s | 56789012 |
|
||||
> | 12 | TUNDRA:[[55.7558,37.6173](https://maps.google.com/?q=55.7558,37.6173)]:S2:C2 | Light sensor:[TSL2591] | 5.9 | lux | 57890123 |
|
||||
> | 13 | VALLEY:[[40.7306,-73.9352](https://maps.google.com/?q=40.7306,-73.9352)]:S3:C1 | CO₂ sensor:[SenseAir S8] | 45.2 | RH | 58901234 |
|
||||
> | 14 | PLAINS:[[41.8781,-87.6298](https://maps.google.com/?q=41.8781,-87.6298)]:S1:C2 | UV sensor:[VEML6075] | 7.1 | mW /cm² | 59012345 |
|
||||
> | 15 | COAST:[[37.7749,-122.4194](https://maps.google.com/?q=37.7749,-122.4194)]:S2:C3 | Soil EC[EC‑Meter 5] | 1.8 | dS/m | 60123456 |
|
||||
|
||||
```mermaid
|
||||
sequenceDiagram
|
||||
@@ -127,17 +166,13 @@ cargo run
|
||||
> ```
|
||||
|
||||
> [!NOTE]
|
||||
> **DATA COLLECTOR - means a mini PC or Micro-controller with connected sensors, get data from all connected sensors and sends data in json format**
|
||||
> **to web server, likes RESOURCE HUB [REST API]**
|
||||
>
|
||||
> [**DataCollector**]
|
||||
> **Arduino->[USB]->OrangePiPC->Wifi/Eth - - -> [ResourceHUB API]**
|
||||
>
|
||||
> **In my system now i use "arduino nano with DHT22 and pH sensor" connected to Orange Pi PC, arduino sends all data from sensors to Orange Pi PC**
|
||||
> **Arduino nano connected by usb and use UART - serial port to send data to minipc, and then**
|
||||
> **Orange Pi PC use wifi/ethernet to sends getted data to web server (To our RESOURCE HUB API)**
|
||||
>
|
||||
> **[DataCollector]** sends a **Post** **requests**
|
||||
> **json** - - **- > **http:123.123.123/api/v1/sensor/data
|
||||
>
|
||||
> **DATA COLLECTOR - means a mini PC or Micro-controller with connected sensors, get data from all connected sensors and sends data in json format**
|
||||
> **to web server, likes RESOURCE HUB [REST API]**
|
||||
> [**DataCollector**]
|
||||
> **Arduino->[USB]->OrangePiPC->Wifi/Eth - - -> [ResourceHUB API]**
|
||||
> **In my system now i use "arduino nano with DHT22 and pH sensor" connected to Orange Pi PC, arduino sends all data from sensors to Orange Pi PC**
|
||||
> **Arduino nano connected by usb and use UART - serial port to send data to minipc, and then**
|
||||
> **Orange Pi PC use wifi/ethernet to sends getted data to web server (To our RESOURCE HUB API)**
|
||||
> **[DataCollector]** sends a **Post** **requests**
|
||||
> **json** - - **- > **http:123.123.123/api/v1/sensor/data
|
||||
> **[ResourceHUB] **save this data in redis dababase
|
||||
Reference in New Issue
Block a user