ktageja / DataSense-PRJ666-team-5

MIT License
0 stars 0 forks source link

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

Closed ktageja closed 1 month ago

ktageja commented 2 months 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
  1. R-pi connect to wifi hotspot

  2. local computer connect to SAME wifi hotspot

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

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

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

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