Skip to content

Conversation

MayureshMore
Copy link
Collaborator

This pull request marks the completion and full integration of the embedded code for the Plant Water System. The following key components have been implemented and tested:

Sensor Data Acquisition: The system reads sensor data through the ADS1115 and GPIO interfaces on the Raspberry Pi. Sensor readings (analog and digital states) are correctly converted and logged.

Data Storage and Logging: Sensor readings are stored in a SQLite database (plant_sensor_data.db) using the established schema (with data retention and backward compatibility ALTER statements). In addition, the data is concurrently logged into a CSV file (if enabled).

Backend API Communication: The send_data_api.py component has been integrated and thoroughly tested. It retrieves unsent rows from the database, assembles them into the expected JSON payload (wrapped within a "data" key), and sends the data to the backend endpoints (for auto-sending and on-demand current data) using curl. The system processes data in batches and uses persistent tracking (via last_sent_id.txt) to ensure that data is sent every minute without gaps or duplicates.

Error Handling and Scheduling: The system features robust error handling with exponential backoff for transient errors during data transmission. A scheduler continuously triggers the data sending process every minute, ensuring continuous and reliable data delivery to the backend.

Additional Integration: The project includes utility functions, a weather API module to retrieve current weather conditions, and a setup script along with a Dockerfile for streamlined deployment.

All embedded code components have been successfully implemented and tested. Data is transmitted properly every minute without any issues. This pull request is ready for integration into the main branch.

Please review and merge.

Merge pull request #139 from SE4CPS/embedded-code
…ta and weather_fetched timestamp if new fetch fails.
…ta and weather_fetched timestamp if new fetch fails.
…ata transmission, and added raw ADC values to DB/CSV output with complete weather information.
…ata transmission, and added raw ADC values to DB/CSV output with complete weather information.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants