How igobyjack/neptune_interface works
Project Type and Purpose
• The project is an IoT solution designed for precision lawn care. It uses a moisture sensor connected to a microcontroller (Arduino) to detect soil moisture alongside data from an external weather API. These combined inputs guide whether or not to water the lawn.
• The system comprises three core parts: an Arduino script running on a microcontroller, a Raspberry Pi acting as the backbone (running an async WebSocket server), and a webpage that presents data to end users in real time.
Key Components Identified from the File Tree and README
a. Sensor/Microcontroller Component:
• File: sensor_reading/sensor_reading.ino
• Role: Written in C++ for Arduino, this script reads the moisture sensor data.
b. Raspberry Pi Backend Component:
• File: backend/server_reader.py
• Role: An asynchronous WebSocket server that:
• Reads incoming sensor data (likely from a serial port).
• Broadcasts the data to connected webpage clients.
c. Web Interface Component:
• File: webpage/index.html
• Role: A client-facing webpage served by the Raspberry Pi’s WiFi network.
• Uses JavaScript to establish a WebSocket connection and update in real time.
d. Testing/Experimental Components:
• Files in the testing/ directory (app.py, logger.py, moisturelog.csv)
• Role: Proof-of-concept and debugging scripts to experiment with serial port data reading and interface behavior.
Relationships and Data Flow
• Data originates at the moisture sensor, processed by the Arduino microcontroller.
• The processed sensor data is sent over (presumably via a serial connection) to the Raspberry Pi.
• The Python-based asynchronous WebSocket server on the Raspberry Pi (server_reader.py) receives this data.
• The server then pushes the sensor data to connected clients through the WebSocket.
• On the client side, the webpage (index.html) uses JavaScript to listen for these incoming updates and reflects them on the UI.
• Additionally, there is an external dependency on the Open Weather API, which can be visualized as a separate external service that influences the logic for watering decisions.
Architectural Patterns and Technologies
• Microcontroller (Arduino) reading hardware sensor data.
• Asynchronous WebSocket for real-time communication on the backend.
• Client-server architecture with the Raspberry Pi serving both as a data receiver and a WiFi access point.
• Separation of concerns: distinct modules for sensor reading, server-side communication, and client-side display.