Skip to content

Santosh1526/-Teensy-4.1-Ocean-Sensor-Dashboard

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

3 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

🌊 Teensy 4.1 Ocean Sensor Dashboard

A comprehensive Python-based monitoring system for ocean environmental sensors using Teensy 4.1 microcontroller. Features real-time data visualization, SD card logging, remote data download, and interactive graphing capabilities.

Python Tkinter Serial License


πŸ“‹ Table of Contents


✨ Features

πŸ”¬ Sensor Monitoring

  • pH Sensor - Water acidity/alkalinity measurement
  • Dissolved Oxygen (DO) - Oxygen concentration in mg/L
  • Temperature - Water temperature in Β°C
  • Pressure - Atmospheric/water pressure in mbar

πŸ“Š Data Management

  • ⏰ 30-minute interval readings - Optimized for long-term deployment
  • πŸ’Ύ Dual storage system - SD card (Teensy) + CSV file (GUI)
  • πŸ“₯ Remote SD card download - Retrieve all data via serial connection
  • πŸ”„ Continuous monitoring - Real-time display updates even during sleep cycles
  • πŸ“ˆ ~4,320 readings over 90-day deployment

πŸ–₯️ GUI Features

  • 🎨 Modern dark-themed interface with color-coded sensor displays
  • πŸ’“ Live heartbeat monitoring - Continuous display updates
  • πŸ“Š Real-time graphing - 4-panel matplotlib visualization
  • πŸ“ˆ Historical data analysis - Load and plot SD card data
  • πŸ’Ύ Export capabilities - PNG, PDF, and CSV formats
  • πŸ”” Status notifications - Visual feedback for all operations

πŸ› οΈ Technical Features

  • πŸ”Œ Auto-detection - Automatic Teensy port detection
  • 🧡 Multi-threaded - Non-blocking serial communication
  • πŸ”’ Thread-safe - Proper GUI update synchronization
  • ⚑ High-speed serial - 115200 baud communication
  • πŸ›‘οΈ Error handling - Robust exception management

πŸ—οΈ System Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                   TEENSY 4.1 HARDWARE                       β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”   β”‚
β”‚  β”‚ pH       β”‚  β”‚ DO       β”‚  β”‚ Temp     β”‚  β”‚ Pressure β”‚   β”‚
β”‚  β”‚ Sensor   β”‚  β”‚ Sensor   β”‚  β”‚ Sensor   β”‚  β”‚ Sensor   β”‚   β”‚
β”‚  β””β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”˜   β”‚
β”‚       β”‚             β”‚              β”‚             β”‚          β”‚
β”‚       β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜          β”‚
β”‚                         β”‚                                    β”‚
β”‚                    β”Œβ”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”                              β”‚
β”‚                    β”‚ Teensy  β”‚                              β”‚
β”‚                    β”‚  4.1    β”‚                              β”‚
β”‚                    β””β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”˜                              β”‚
β”‚                         β”‚                                    β”‚
β”‚                    β”Œβ”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”                              β”‚
β”‚                    β”‚ SD Card β”‚ (30-min intervals)           β”‚
β”‚                    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜                              β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                       β”‚
                  USB Serial
                  115200 baud
                       β”‚
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚              PYTHON GUI APPLICATION                         β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”   β”‚
β”‚  β”‚  Real-time Display  β”‚  CSV Logging  β”‚  Graphs       β”‚   β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜   β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”   β”‚
β”‚  β”‚  Serial Thread (Background)                         β”‚   β”‚
β”‚  β”‚  - Continuous reading                               β”‚   β”‚
β”‚  β”‚  - Protocol parsing                                 β”‚   β”‚
β”‚  β”‚  - Thread-safe updates                              β”‚   β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜   β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                       β”‚
              β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”
              β”‚                 β”‚
         β”Œβ”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”      β”Œβ”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”
         β”‚  CSV    β”‚      β”‚ Graphs  β”‚
         β”‚  Export β”‚      β”‚ Export  β”‚
         β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜      β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

πŸ”§ Hardware Requirements

  • Teensy 4.1 microcontroller
  • SD Card (for onboard logging)
  • Sensors:
    • pH sensor (analog output)
    • Dissolved Oxygen sensor (analog output)
    • Temperature sensor (digital/analog)
    • Pressure sensor (I2C/analog)
  • USB Cable (for serial communication)
  • Power Supply (appropriate for deployment environment)

πŸ’» Software Requirements

Python Dependencies

Python >= 3.7
tkinter (usually included with Python)
pyserial >= 3.5
Pillow >= 8.0
matplotlib >= 3.3.0

Installation

  1. Clone the repository:
git clone https://github.com/yourusername/teensy-ocean-sensor-dashboard.git
cd teensy-ocean-sensor-dashboard
  1. Install required packages:
pip install pyserial pillow matplotlib
  1. Run the application:
python ocean_sensor_dashboard.py

πŸš€ Usage

Getting Started

  1. Connect Hardware:

    • Connect Teensy 4.1 to your computer via USB
    • Ensure SD card is inserted in Teensy
    • Verify all sensors are connected
  2. Launch Application:

    python ocean_sensor_dashboard.py
  3. Connect to Teensy:

    • Click "πŸ”Œ Connect to Teensy"
    • Port auto-detection will attempt to find Teensy
    • Manual port entry available if auto-detection fails
  4. Monitor Data:

    • Live sensor values update continuously
    • Scheduled readings (every 30 min) saved to SD + CSV
    • Console displays all system messages

Key Operations

πŸ“₯ Download SD Card Data

1. Click "πŸ“₯ Download SD Card"
2. Select save location
3. Wait for download completion
4. Data saved as text file with all readings

πŸ“Š View Live Graphs

1. Click "πŸ“Š Live Graph"
2. 4-panel graph window opens
3. Auto-refreshes every 10 seconds
4. Export as PNG/PDF/CSV available

πŸ“ˆ Analyze SD Card Data

1. Click "πŸ“₯ SD Graph"
2. Select downloaded SD card file
3. Visualize historical data
4. Export graphs and data

πŸ’Ύ Export CSV Data

1. Click "πŸ’Ύ Download CSV"
2. Choose save location
3. All GUI readings exported

πŸ“‘ Data Protocol

Teensy β†’ GUI Communication

Primary Format:

$Params,<pH*100>,<DO*10>,<Temp*50>,<Pressure*1000>,<FLAG>

Example:

$Params,742,85,1120,1013000,SAVED

Decoding:

  • pH = 742 / 100 = 7.42
  • DO = 85 / 10 = 8.5 mg/L
  • Temp = 1120 / 50 = 22.4Β°C
  • Pressure = 1013000 / 1000 = 1013.0 mbar
  • FLAG = SAVED (indicates 30-min scheduled reading)

SD Card Download Protocol

Request:

DOWNLOAD_SD\n

Response:

SD_DOWNLOAD_START
<data lines...>
SD_DOWNLOAD_PROGRESS: X lines sent
<more data...>
SD_DOWNLOAD_END

Error Handling:

SD_DOWNLOAD_ERROR: <error message>

πŸ“Έ Screenshots

Main Dashboard

Dashboard Screenshot Real-time sensor monitoring with color-coded displays

Live Graphs

Live Graphs Screenshot 4-panel real-time data visualization

SD Card Download

SD Download Screenshot Remote SD card data retrieval interface


πŸ“ File Structure

teensy-ocean-sensor-dashboard/
β”‚
β”œβ”€β”€ ocean_sensor_dashboard.py      # Main Python application
β”œβ”€β”€ teensy_firmware/                # Teensy 4.1 firmware (if included)
β”‚   └── sensor_logger.ino
β”‚
β”œβ”€β”€ flowchart/                      # Engineering documentation
β”‚   └── teensy_flowchart.html      # Interactive system flowchart
β”‚
β”œβ”€β”€ screenshots/                    # Application screenshots
β”‚   β”œβ”€β”€ dashboard.png
β”‚   β”œβ”€β”€ live_graphs.png
β”‚   └── sd_download.png
β”‚
β”œβ”€β”€ data/                          # Sample data (optional)
β”‚   β”œβ”€β”€ sample_readings.csv
β”‚   └── sample_sd_data.txt
β”‚
β”œβ”€β”€ requirements.txt               # Python dependencies
β”œβ”€β”€ README.md                      # This file
└── LICENSE                        # License information

πŸ”§ Configuration

Serial Settings

BAUD = 115200              # Serial baud rate
SERIAL_TIMEOUT = 1.0       # Serial timeout in seconds

Data Management

MAX_BUFFER_SIZE = 10000    # Maximum readings in memory
READING_INTERVAL = 30      # Minutes between readings (Teensy)

CSV Output

  • Continuous CSV: Auto-created on connection
  • Format: teensy_30min_readings_YYYYMMDD_HHMMSS.csv
  • Fields: timestamp, pH, DO, Temperature, Pressure

πŸ› Troubleshooting

Connection Issues

Problem: Cannot find Teensy port

Solution:
1. Check USB cable connection
2. Verify Teensy is powered on
3. Try manual port entry (COM3, /dev/ttyACM0, etc.)
4. Install Teensy USB drivers if needed

Problem: Serial connection drops

Solution:
1. Check USB cable quality
2. Verify stable power supply
3. Reduce serial timeout if needed
4. Check for electromagnetic interference

Data Issues

Problem: No data appearing

Solution:
1. Verify Teensy firmware is running
2. Check sensor connections
3. Monitor serial console for errors
4. Verify $Params protocol format

Problem: SD download fails

Solution:
1. Ensure SD card is properly inserted
2. Check SD card has data
3. Verify sufficient disk space for download
4. Try downloading to different location

Graph Issues

Problem: Graphs not displaying

Solution:
1. Verify matplotlib is installed: pip install matplotlib
2. Check that sensor_data_list has entries
3. Ensure valid timestamp format
4. Update matplotlib: pip install --upgrade matplotlib

🀝 Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

Development Guidelines

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/AmazingFeature)
  3. Commit changes (git commit -m 'Add AmazingFeature')
  4. Push to branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

Areas for Contribution

  • πŸ”Œ Additional sensor support
  • πŸ“Š New visualization options
  • 🌐 Web-based dashboard
  • πŸ“± Mobile app integration
  • πŸ”” Alert/notification system
  • πŸ—„οΈ Database integration
  • πŸ§ͺ Unit tests

πŸ“Š Project Status

  • βœ… Core functionality complete
  • βœ… Real-time monitoring
  • βœ… SD card download
  • βœ… Graph visualization
  • βœ… CSV export
  • βœ… Web dashboard (planned)
  • βœ… Database integration (planned)

πŸ“„ License

MIT License

Copyright (c) 2025 [Santosh Ambule]

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

πŸ‘₯ Authors


πŸ™ Acknowledgments

  • Teensy 4.1 by PJRC
  • Python Serial library by pySerial
  • Matplotlib for visualization
  • Ocean sensor research community

πŸ“ž Contact

Project Link: - https://github.com/Santosh1526/-Teensy-4.1-Ocean-Sensor-Dashboard/tree/main

Email: santoshambule15@gmail.com


🌟 Star History

If you find this project useful, please consider giving it a ⭐!


πŸ“ˆ Deployment Example

90-Day Ocean Monitoring Deployment

Total Readings Expected: ~4,320
Reading Interval: 30 minutes
Storage Required: ~2-5 MB (SD card)
Power Consumption: ~500mW average
Battery Life: ~90 days (with 5000mAh battery)

Typical Use Cases

  • 🌊 Aquaculture monitoring
  • πŸ”¬ Marine research
  • 🏊 Pool/water quality monitoring
  • 🌑️ Environmental studies
  • πŸ“Š Long-term data collection

**Made with ❀️ for ocean environmental monitoring

About

A comprehensive Python-based monitoring system for ocean environmental sensors using Teensy 4.1 microcontroller. Features real-time data visualization, SD card logging, remote data download, and interactive graphing capabilities.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors