This project is a data collection and visualization system for an Electric Vehicle (EV) using a Raspberry Pi with an RFM9x LoRa radio. The system collects data, stores it in CSV files, and visualizes it through a web interface.
The system collects real-time data from various sensors on the EV using a Raspberry Pi connected to an RFM9x LoRa radio. The data is processed and saved into CSV files, which are then served by a Node.js server and visualized in a web-based user interface.
- Purpose: Collects data from the LoRa radio and stores it in a CSV file.
- Functionality:
- Configures the LoRa radio using the
adafruit_rfm9x
library. - Checks for the next available file name and prepares to write data.
- Enters an infinite loop where it:
- Receives data packets from the LoRa radio.
- Parses and processes incoming data.
- Logs data to a CSV file with a timestamp and counter.
- Provides error handling for data processing.
- Configures the LoRa radio using the
- Purpose: Serves the CSV data and frontend files over HTTP.
- Functionality:
- Uses the Express framework to serve static files from the
front_end
directory. - Provides an endpoint (
/list-files
) to list all CSV files available in thefront_end
directory. - Fetches and returns the most recent CSV data upon request.
- Uses the Express framework to serve static files from the
index.html
: Main HTML page for the web interface.dropdown.js
: Handles user interaction for selecting different data views.main.js
: Fetches the latest CSV data and updates the UI dynamically.objects.js
: Defines classes for various data visualization components (e.g., odometers, graphs).style.css
: CSS styles for layout and design.- Sample Data (
001.data.csv
): Example CSV file containing collected data.
- Data Collection: The Raspberry Pi collects data from the EV via the LoRa radio.
- Data Storage: The data is processed by
main.py
and stored in CSV files. - Data Serving: The Node.js server (
server.js
) serves the CSV files and static frontend. - Data Visualization: The web interface fetches and displays the latest data dynamically for real-time monitoring.
- Install necessary Python libraries:
pip install adafruit-circuitpython-rfm9x
Set Up Node.js Server:
- Install node.js:
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.0/install.sh | bash
nvm install 20
- Install dependencies:
npm install express
- Make sure that server.js is running:
node server.js
- Run the Python Script:
python3 main.py
- Run the Node.js server: Access the Web Interface:
Open a web browser and navigate to http://electric.local (or the IP address of the Raspberry Pi).
This project is licensed under the MIT License.
Also, this whole README.md file was writen by ChatGPT. 😀