# Embedded
## `I. Requirement gathering`
### 1. Problem statement
Traditional way of shrimp farming is time-consuming with extra labour, extra cost and less efficiency. Intensive shrimp farming requires suitable solutions for those problems. We design a solution for shrimp farming, also a simple monitor and control system.
### 2. Scope definition
We design a shrimp farming system with separated ponds of, assume, an area of approximately 1000m², with some aerators and sensors for observing statistics. On the software side, we build a dashboard website for user to monitor the system.
### 3. Functional and non-functional requirements
**Functional requirements:**
- The system have separated ponds, each for a specific purpose:
- Water supplier
- Sedimentation pond (ao lắng):
- Pre-farming: to purify water
- Post-farming: for waste water treatment
- Hatchery pond (ao ươm tôm)
- Main farming pond (ao nuôi chính)
- Outlet valve (thoát nước)
- Ponds are equiped with sensors for detecting temperature, oxygen, pH and alkaline etc.
- Ponds are equiped with an aerator
- Dashboard website should display data collected within 30 days, also show simple graphs to users
- The website should have a feature for users to adjust constances (e.g. oxygen moderate range)
**Non-functional requirements:**
- Construct the ponds carefully so that they're not rusted, also provide roof covers
- System shall run 24/7
- Communication between microcontroller, server and software should not have much delay, especially if there are any warnings or errors
- Dashboard website UI should be user-friendly
### 4. Deployment parameter
The system is constructed in an area of approximatly up to 1000m², the area is used for both ponds, commuting and placing hardware devices, and should not be strongly affected by environment.
## `II. Requirement analysis`
### 1. Variables in performance
- Farming productivity (sales or amount of shrimp raised)
- Water temperature: The suitable temperature for raising black tiger shrimp is from 28 to 30℃ and white shrimp is from 25 to 30℃
- Water salinity: The ideal salinity for black tiger shrimp farming is 18 to 20‰ while white shrimp needs a salinity of 25 to 28‰
- Water clarity: The suitable clarity for shrimp ponds is usually from 30 to 45cm
- Dissolved oxygen: should be about 5mg/l or higher
- pH: between 7,2 and 8,8
- Delay in communication between blocks in the architecture
- Frequency of error occurrences
### 2. Cost & complexity
**Complexity:**
One typical point of a shrimp farming system is that they requires multiple ponds with different purposes, hence placing controller, hardware or network device could be a challenge. Moreover, since each ponds have specific size, placing sensors should be consider carefully.
**Cost:**
- Microcontrollers: 15 million vnd
- Sensors: 60 million vnd
- Ponds: 90 million vnd
- Aerators: 10 million vnd
- Others (server, software, networking devices): approximately 60 million vnd
- Overall: about 250 million vnd
### 3. Tradeoff
- Higher quality of aerators, sensors, or server, database requires higher budget
- Using lower cost solutions (LoRa, UDP protocol or low cost sensors) might provide unreliable output
## `III. System design`
### 1. System architecture
**Shrimp farming system architecture (approximately 30x34m²):**

Detailed architecture will be provided in Prototype below
**Mockup UI for software:**


**Mock UI preview:** https://www.figma.com/proto/NC7eAqpaQUtp1OGMyyoqvh/Untitled?node-id=1%3A128&scaling=scale-down
### 2. Hardware-software partitioning
**Hardware:**
- Platform: STM32
- Connection: Zigbee
- Communication protocol: MQTT
- Network devices, server gateway
- Sensors:
- Temperature
- Oxygen
- pH, alkaline
- Aerators
**Software:**
- Web application
- Backend
- Database
### 3. Hardware & software selection
**Hardware:**
- Controller: 2 for each sedimental and hatchary pond, 3 for main farming pond
- Temperature sensor: model Si7021, 3 for each sedimental and hatchary, 9 for main farming pond
- Oxygen sensor: model AQUA-DO, same amount as temperature sensor
- pH sensor: model PH-X-420-I, same amount as above
- Aerators: 1 for each sedimentals and hatchary pond, 2 for main farming pond
**Software:**
- Web application: React JS and SWR for data fetching enhancemence, displayy real-time data and graphs
- Backend: handle observing performance of the system, raise warnings/errors
- Database: MongoDB
### 4. Prototype & testing strategy

- Each sedimental and hatchary pond has 2 microcontrollers, 3 sensors node and an aerator
- Main farming pond has 4 microcontrollers, 3 times of sensors node as sedimental pond, and 2 aerators
- All farming ponds are centralized so that the process of collecting data is optimal
**Testing strategy:**
- Data received in server should be periodically and should not fluctuate a lot: observe in the web application's feed
---
## Nháp
Điều kiện cần khi nuôi tôm
Chất lượng nước
Quạt
Proposal chi tiết
Thiết kế, mô tả thiết bị, server
Mock UI for app
Kỹ thuật nuôi tôm 2 giai đoạn:
Ương tôm và nuôi thương phẩm

Thiết kế hệ thống nuôi tôm gồm nguồn nước, ao chứa và ương tôm, ao nuôi tôm, ao lắng và xử lý và hệ thống thoát nước.
Ao ương:
- Diện tích 20 - 25%, khoảng 200m2
- Chiều sâu tối đa 1,0m, thiết kế hình tròn để thuận lợi chuyển tôm
- Thiết kế di động, lót bạt, mái che
- Môi trường cần được kiểm soát chặt chẽ để tôm ít bệnh:
- Tôm khoẻ mạnh, không trong chu kỳ lột xác
- Bổ sung thêm khoáng, beta glucan, vitamin C giúp tôm khỏe lên rồi mới tiến hành san tôm
Ao nuôi:
- 75 - 80%, khoảng 800m2
- Chiều sâu 1,2 - 1,5m
## Reference
- https://tepbac.com/technical/full/334-nhung-giai-phap-ky-thuat-chinh-trong-nuoi-tom-hai-giai-doan.htm
- https://biogency.com.vn/yeu-to-anh-huong-den-nuoi-tom-can-quan-tam/
- https://chuyengiatom.com/thiet-ke-chuan-bi-ao-nuoi-tom-the-chan-trang-theo-chuan-vietgap-phan-1/
- https://tepbac.com/tin-tuc/full/ky-thuat-uong-tom-thuc-chien-33842.html#:~:text=M%E1%BA%ADt%20%C4%91%E1%BB%99%20%C6%B0%C6%A1ng%20t%C3%B4m%20th%E1%BA%BB&text=%C6%B0%C6%A1ng%20m%E1%BA%ADt%20%C4%91%E1%BB%99%201.000%20%E2%80%93%202.000,1.000%20%E2%80%93%202.000%20post%2Fm3
- https://bannhanong.vn/danhmuc/NQ==/baiviet/Quy-trinh-tam-thoi-nuoi-tom-nuoc-lo-an-toan-trong-vung-dich-benh-Phan-1-/NDg0NA==/index.bnn
- https://www.linkedin.com/pulse/lorawan-vs-zigbee-which-wireless-iot-protocol-best-me-luke-day/
- https://westerntechvn.com.vn/tieng-anh-chuyen-nganh-xu-ly-nuoc-thai-moi-truong.htm
- https://stackoverflow.com/questions/57388750/what-are-advantages-of-mqtt-over-tcp-ip-since-mqtt-is-based-on-tcp-why-dont-w