diff --git a/README.md b/README.md index 070e21a..8e2e3c9 100644 --- a/README.md +++ b/README.md @@ -9,17 +9,14 @@ [![Status](https://img.shields.io/badge/status-active-success.svg)]() - --- -

SmartAgri

- ## 📝 Table of Contents - [About](#about) @@ -33,7 +30,6 @@ - [Built Using](#built_using) - [Authors](#authors) - ## 🧐 About This repo contains @@ -45,8 +41,6 @@ This repo contains for Smart SmartAgri. - - ## Getting Started These instructions will get you a copy of the project up and running on your system. @@ -67,40 +61,37 @@ A step by step series that tell you how to get the Firmware and Backend running You should have Arduino IDE Installed - 1. Add ESP32 Board to your Arduino IDE - 1. In your Arduino IDE, go to File> Preferences - Installing ESP32 Add-on in Arduino IDE Windows, Mac OS X, Linux open preferences - 2. Enter ```https://dl.espressif.com/dl/package_esp32_index.json``` - into the “Additional Board Manager URLs” field then, click the “OK” button: - Note: if you already have the ESP32 boards URL, you can separate the URLs with a comma(each board will go to neaw line) as follows: - ```https://dl.espressif.com/dl/package_esp32_index.json,\n http://arduino.esp8266.com/stable/package_esp8266com_index.json``` - - - 2. Open the Boards Manager. Go to Tools > Board > Boards Manager… - 3. Search for ESP32 and press install button for the ESP32 by Espressif Systems“: - 4. That’s it. It should be installed after a few seconds. - 5. In your Arduino sketchbook directory, create tools directory if it doesn't exist yet. - 6. Unpack the tool into tools directory(present in libs/ESP32FS-1.0.zip) (the path will look like /Arduino/tools/ESP32FS/tool/esp32fs.jar). - 7. Close and re-open the Arduino IDE. - - 8. Now copy the contents of the libs folder to the libraries directory of your Arduino - 1. If you are using windows, the libraries directory will be Documents/Arduino/libraries +1. Add ESP32 Board to your Arduino IDE +1. In your Arduino IDE, go to File> Preferences + Installing ESP32 Add-on in Arduino IDE Windows, Mac OS X, Linux open preferences +1. Enter `https://dl.espressif.com/dl/package_esp32_index.json` + into the “Additional Board Manager URLs” field then, click the “OK” button: + Note: if you already have the ESP32 boards URL, you can separate the URLs with a comma(each board will go to neaw line) as follows: + `https://dl.espressif.com/dl/package_esp32_index.json,\n http://arduino.esp8266.com/stable/package_esp8266com_index.json` + +1. Open the Boards Manager. Go to Tools > Board > Boards Manager… +1. Search for ESP32 and press install button for the ESP32 by Espressif Systems“: +1. That’s it. It should be installed after a few seconds. +1. In your Arduino sketchbook directory, create tools directory if it doesn't exist yet. +1. Unpack the tool into tools directory(present in libs/ESP32FS-1.0.zip) (the path will look like /Arduino/tools/ESP32FS/tool/esp32fs.jar). +1. Close and re-open the Arduino IDE. + +1. Now copy the contents of the libs folder to the libraries directory of your Arduino + 1. If you are using windows, the libraries directory will be Documents/Arduino/libraries ##### ESP32 Node FW Uploading - 1. Select ESP32 Dev Module from Tools->Board->ESP32 - 2. Select the correct port from Tools->Port - 3. Then open Firmware.ino file, - 4. Select Tools > ESP32 Sketch Data Upload menu item. This should start uploading the files into ESP32 flash file system. - 5. Now Upload the Code to your ESP32 Dev Module. - 6. Your ESP32 is now ready to be used. +1. Select ESP32 Dev Module from Tools->Board->ESP32 +2. Select the correct port from Tools->Port +3. Then open Firmware.ino file, +4. Select Tools > ESP32 Sketch Data Upload menu item. This should start uploading the files into ESP32 flash file system. +5. Now Upload the Code to your ESP32 Dev Module. +6. Your ESP32 is now ready to be used. ## Circuit - ### ESP32 Dev Module Pinout - Follow the pinout diagram given below to connect different components to your ESP32 Dev Module board. ![Pinout](Circuit/ESP32-Pinout.jpg) @@ -111,12 +102,11 @@ Here's the complete circuit diagram of the system. ![CircuitDiagram](Circuit/Circuit_bb.png) - ## Server Details -```diff +```diff - [THIS SETCTION WILL BE IMPLEMENTED/UPDATED IN THE UPCOMING MILESTONES] -```` +``` ### Monitoring @@ -131,6 +121,7 @@ Here's the complete circuit diagram of the system. - ufw - mongod - mongo-express + ### Version Details - Node v12.16.1 @@ -139,37 +130,45 @@ Here's the complete circuit diagram of the system. ### Server Links - MQTT Broker Link: hivemq.com -- Backend Link: -- Frontend Link: +- Backend Link: http://sensors.production.rehanshakir.com/ +- Frontend Link: ### Backend - Backend is based on NodeJS and it is being managed by PM2. It starts automatically on server start. ## MQTT Topic Details -```diff + +```diff - [THIS SETCTION WILL BE IMPLEMENTED/UPDATED IN THE UPCOMING MILESTONES] -```` +``` + ### Topics List + #### Logs + 1. smart-agri/logs `(all log messages are published to this topic) READ-ONLY` #### Fimrware 1. smart-agri/deviceExists `(Publish DeviceMAC on this topic to check if device exisits in DB) WRITE-ONLY` 1. smart-agri/deviceExistance `(Response from the above command {null or device MAC}) READ-ONLY` -2. -3. smart-agri/createNew `(Publish data to create a new device in DB.) WRITE-ONLY` +2. +3. smart-agri/createNew `(Publish data to create a new device in DB.) WRITE-ONLY` + + - Data Format: DeviceMAC;SENSORS_LIST + 4. smart-agri/updateDevice `(Publish data to update a device in DB based on its MAC Address.) WRITE-ONLY` - Data Format: DeviceMAC;SENSORS_LIST - ## API Details -```diff -- [THIS SETCTION WILL BE IMPLEMENTED/UPDATED IN THE UPCOMING MILESTONES] -```` +```diff +- Routes +* /api/users +* /api/mqtt +``` - ### Responses -```diff + +```diff - [THIS SETCTION WILL BE IMPLEMENTED/UPDATED IN THE UPCOMING MILESTONES] -```` +``` Many API endpoints return the JSON representation of the resources created or edited. However, if an invalid request is submitted, or some other error occurs, Gophish returns a JSON response in the following format: @@ -249,22 +248,22 @@ Many API endpoints return the JSON representation of the resources created or ed "message" : string } ``` + The `message` attribute contains a message commonly used to indicate errors or to return the logged status/ The `status` attribute describes if the transaction was successful or not. - ### Status Codes IoTManagementSystem Backend returns the following status codes in its API: -| Status Code | Description | -| :--- | :--- | -| 200 | `OK` | -| 201 | `CREATED` | -| 400 | `BAD REQUEST` | -| 404 | `NOT FOUND` | -| 500 | `INTERNAL SERVER ERROR` | +| Status Code | Description | +| :---------- | :---------------------- | +| 200 | `OK` | +| 201 | `CREATED` | +| 400 | `BAD REQUEST` | +| 404 | `NOT FOUND` | +| 500 | `INTERNAL SERVER ERROR` | ## Usage @@ -276,20 +275,14 @@ IoTManagementSystem Backend returns the following status codes in its API: Dashboard Login Page![SCRD1](Circuit/scrd1.png) Dashboard Home Page![SCRD2](Circuit/scrd2.png) -Dashboard Profile Page![SCRD3](Circuit/scrd3.png) -3. You can also download the logs in CSV format from the dashboard home page. -4. Power on your ESP32, it will present you with an AP named ```SmartA-abc``` (while ```SmartA``` can be changed in the portal and ```abc``` is a unique id for each esp32) -5. Default captive portal password `12345678AP` which can be changed in captive portal. -6. Connect to the ESP32 access point and open the web-browser and navigate to the link ```http://esp32.local/_ac```. This link will work on most of the operating systems but if your operating system is not allowing to open it, you may want to check the captive portal IP Address from the serial monitor and can use that IP address inplace of the above mentioned URL. -7. The default access IP Address is ```http://192.168.4.1/_ac``` -8. You will be presented with a main dashboard as shown below(based on your device) - ![SCR1](Circuit/scr1.png) +Dashboard Profile Page![SCRD3](Circuit/scrd3.png) 3. You can also download the logs in CSV format from the dashboard home page. 4. Power on your ESP32, it will present you with an AP named `SmartA-abc` (while `SmartA` can be changed in the portal and `abc` is a unique id for each esp32) 5. Default captive portal password `12345678AP` which can be changed in captive portal. 6. Connect to the ESP32 access point and open the web-browser and navigate to the link `http://esp32.local/_ac`. This link will work on most of the operating systems but if your operating system is not allowing to open it, you may want to check the captive portal IP Address from the serial monitor and can use that IP address inplace of the above mentioned URL. 7. The default access IP Address is `http://192.168.4.1/_ac` 8. You will be presented with a main dashboard as shown below(based on your device) +![SCR1](Circuit/scr1.png) 9. Once connected to a WiFi network, you can again access the captive portal using same URL or the IP Address from the Serial monitor. -10. The data is published to the MQTT Topic ```SmartA/{hostname}``` while the hostname is the one which you can define in Settings page of the captive portal. -11. You can open settings page with following default credentials - 1. User: **AP Name (SmartA)** - 2. Password: **admin** +10. The data is published to the MQTT Topic `SmartA/{hostname}` while the hostname is the one which you can define in Settings page of the captive portal. +11. You can open settings page with following default credentials +12. User: **AP Name (SmartA)** +13. Password: **admin** ## List of Components @@ -314,7 +307,6 @@ Following components are used to make this project 9. 9V to 5V Buck Converter ○ https://www.amazon.com/UCTRONICS-Converter-Transformer-Voltage-Regulator/dp/B07XXWQ49N/ref=sr_1_1?dchild=1&keywords=9v+to+5v+step+down+converter&qid=1631287177&sr=8-1 - ## ⛏️ Built Using - [NodeJS](https://nodejs.org/en/) - JS Framework for Backend Programming @@ -322,7 +314,6 @@ Following components are used to make this project - [Arduino](https://www.arduino.cc/) - Embedded Framework and IDE - For Sensor Node Design - [VueJS](https://vuejs.org/) - For Dashboard Design - ## ✍️ Authors - [@Nauman3S](https://github.com/Nauman3S) - Development and Deployment