About
## The problem it solves
## The problem it solves
The Odinson Vibration Monitor addresses the need for affordable, accessible vibration and seismic activity monitoring in various applications:
- **Structural Health Monitoring**: Provides low-cost solution for monitoring vibrations in buildings, bridges, and other infrastructure to detect potential structural issues before they become critical
- **Earthquake Early Warning**: Functions as a digital seismometer prototype capable of detecting abnormal motion patterns that could indicate seismic activity
- **Industrial Vibration Analysis**: Enables monitoring of machinery and equipment to detect imbalances, misalignments, or bearing failures that could lead to costly downtime
- **Research and Education**: Serves as an accessible platform for students and researchers to study vibration patterns, signal processing, and sensor integration
The system makes vibration monitoring accessible by: - Using inexpensive, off-the-shelf components (MPU6050 sensor, Arduino) - Providing real-time visualization through both web interface and matplotlib display - Offering multiple alert mechanisms (Telegram, sound, visual) - Storing data persistently for later analysis - Including both live monitoring and historical data viewing capabilities
## Challenges we ran into
## Challenges we ran into
During development, we encountered several technical hurdles that required creative solutions:
### Datetime Format Error
**Problem**: `ValueError: Invalid format string` when generating CSV filenames due to using `%s` (seconds since epoch) instead of `%S` (seconds) in `strftime` format string.
**Solution**: Corrected the format string from `%Y-%m-%d_%H-%M-%s` to `%Y-%m-%d_%H-%M-%S` to properly represent hours, minutes, and seconds.
### Port Already in Use
**Problem**: `OSError: [WinError 10048] Only one usage of each socket address...` when trying to start the Flask server, indicating port 5000 was already occupied.
**Solution**: Implemented process cleanup by identifying and terminating existing processes using the port with `netstat` and `taskkill` commands before starting the application.
### Serial Port Permission/Access Issues **Problem**: `PermissionError(13, 'Access is denied.')` when attempting to open COM3 serial port, typically caused by another process holding the port or insufficient permissions.
**Solution**: Added robust serial connection handling with: - Automatic retry mechanism with exponential backoff - Graceful reconnection logic when serial communication is interrupted - Clear error messaging to guide users on resolving port conflicts - Mock data mode for development/testing when hardware isn't available
### Matplotlib Unresponsiveness
**Problem**: The matplotlib figure window became unresponsive and stopped updating due to the main thread being blocked in a tight loop without processing GUI events.
**Solution**: Replaced `time.sleep(0.016) + flush_events()` with `plt.pause(0.001)` which properly processes TkAgg GUI events while maintaining adequate update frequency for smooth visualization.
### Data Loss on Program Termination
**Problem**: When stopping the program with Ctrl+C, CSV files were incomplete or empty because daemon threads were terminated abruptly before flushing buffers.
**Solution**: Implemented graceful shutdown sequence: - Added global `running` flag to control all worker threads - Changed threads from daemon to non-daemon so they can be properly joined - Created Flask shutdown endpoint (`/shutdown`) for clean server termination - Added Ctrl+C handler that sets `running=False`, joins threads, and closes resources - Made CSV file line-buffered (`buffering=1`) for immediate data flushing
Screenshots
Team
From the public Devfolio project page. Votes, swipes and the judge score are hackfeed's own.











