VictorKwong / DataSense-PRJ666-team-5

https://prj666deploy-9xd1.vercel.app
MIT License
0 stars 0 forks source link

Use Case 5: Transmit Sensor Data to the Server #5

Closed VictorKwong closed 1 month ago

VictorKwong commented 1 month ago

Transmit sensor data to the server

User Story

As a Raspberry Pi device, I want to send sensor data to the server via HTTP so that the data can be stored and processed.

Description

This use case describes how the Raspberry Pi sends data collected from sensors to a central server. Sensor data from the Raspberry Pi must be transmitted to a central server for further processing and display

Acceptance Criteria

Testing

Normal Flow of Events

The Raspberry Pi packages the sensor data (temperature, humidity, and moisture) into an HTTP request. The Raspberry Pi sends the data to the server endpoint via an HTTP POST request. The server receives the data, validates it, and stores it in a database. The server responds with a success message (HTTP 200 OK).

Alternate/Exceptional Flows:

S-1: Network connection failure

he Raspberry Pi fails to send data due to network issues. The Raspberry Pi retries sending data after a specified interval (e.g., 30 seconds).

S-2: Invalid data format

The server rejects the data due to invalid formatting (e.g., missing fields). The Raspberry Pi logs the error and resends properly formatted data.

VictorKwong commented 1 month ago

R-pi connect to wifi hotspot

local computer connect to SAME wifi hotspot

Using Thonny to record the data (Temp, Hum, Moist)

Using Visual Studio to run local server (ngrok.py)

Visual Studio receive data from R-pi (Thonny - wifi_local_dht11_moisture.py), and sending the json data to ngrok

ngrok redirect the data to back end (CSV, {'temperature': temperature, 'humidity': humidity, 'moisture': moisture})