Skip to content

surpentine/Arduino-Timer

Repository files navigation

Arduino Filter Service Life Tracker

This Arduino-based system tracks how long a filter has been in service by monitoring pump runtime. It displays elapsed service time on an OLED screen and logs all pump events to an SD card, helping you know exactly when to change out filters based on actual usage rather than guesswork. Perfect for water filtration systems, HVAC filters, pool filters, and any application where filter replacement timing is critical.

📁 Project Files

File Description
[Arduino-Timer.ino] Main Arduino sketch - filter service life tracker with OLED display and SD logging
[ARDUINO NANO STOPWATCH.xlsx] Wiring diagrams and component specifications - Contains pin connections for all components across multiple sheets
README.md This documentation file

📋 Wiring Reference Sheets (in Excel file)

The Excel file contains detailed wiring diagrams across 5 sheets:

  • Arduino Nano - Main controller pin assignments and connections
  • PC817 - Optocoupler wiring for 12V pump signal isolation (detects when filter system is active)
  • 128x64 OLED - Display module SPI connections
  • SD MODULE - SD card reader SPI connections
  • RESET BUTTON - Manual reset button wiring

✨ Features

  • Real-time filter service tracking with millisecond precision
  • OLED display showing:
    • System state (RUNNING (PUMP) / PAUSED)
    • Filter service time in HH:MM:SS format
    • Current pump/filter system ON/OFF status
  • SD card data logging:
    • Records START, STOP, and RESET events with timestamps
    • Preserves complete filter usage history across power cycles
    • Creates persistent log.txt file for maintenance records
  • Smart resume functionality - restores service time from last log entry
  • Manual reset capability for new filter installations
  • Error handling with OLED error messages for SD card issues

🔧 Hardware Required

  • Arduino Nano (or compatible microcontroller)
  • SH1106 128x64 OLED Display (SPI interface)
  • MicroSD Card Module (SPI interface)
  • PC817 Optocoupler (for safe 12V pump/filter system signal detection)
  • Tactile Push Button (for manual reset)
  • MicroSD Card (formatted FAT16/FAT32)
  • Resistors: 1kΩ (for optocoupler LED)
  • 12V Power Supply (for pump and Arduino VIN)

📌 Pin Connections

📊 Complete wiring diagrams available in [ARDUINO NANO STOPWATCH.xlsx]

Component Function Arduino Pin Notes
OLED Display CS D10 SPI Chip Select
DC D9 Data/Command
RST D8 Reset
MOSI D11 SPI Data
SCK D13 SPI Clock
VCC 5V Power
GND GND Ground
SD Card Module CS D4 SPI Chip Select
MOSI D11 SPI Data (shared)
MISO D12 SPI Data In
SCK D13 SPI Clock (shared)
VCC 5V Power
GND GND Ground
PC817 Optocoupler Emitter D5 Filter system status input
Collector GND Ground
Reset Button Switch D3 Pull-up enabled
Common GND Ground

📊 Example Log Output

The system creates a log.txt file on the SD card with filter service entries like:

START - 00:00:00
STOP  - 00:05:12
START - 00:05:12
STOP  - 00:12:47
RESET - 00:12:47  (Filter changed - reset service time)
START - 00:00:00

🚀 How It Works

  1. Initialization

    • OLED display and SD card are initialized
    • System reads the last entry from log.txt
    • If last entry was not RESET, resumes from previous elapsed time
    • If RESET or no log exists, starts from zero
  2. Filter Service Monitoring

    • Continuously monitors pump/filter system status via PC817 optocoupler
    • Detects system ON (LOW signal) and OFF (HIGH signal) transitions
    • Logs START events when filter system activates
    • Logs STOP events when filter system deactivates
    • Accumulates total filter service time across multiple pump cycles
  3. User Interface

    • Updates OLED display in real-time with current filter system status
    • Shows filter service time in hours:minutes:seconds format
    • Indicates system running/stopped state
    • Displays error messages if SD card issues occur
  4. Data Persistence

    • All filter service events logged to SD card with timestamps
    • Filter usage data preserved across power cycles
    • Complete filter service history maintained for maintenance records
  5. Filter Replacement Reset

    • Physical button allows manual reset when filter is changed
    • Logs reset event with final service time before clearing
    • Starts fresh service time tracking for new filter

🛠️ Installation & Setup

  1. Hardware Assembly

    • Follow the wiring diagrams in [ARDUINO NANO STOPWATCH.xlsx]
    • Connect all components according to pin table above
    • Insert formatted microSD card into SD module
  2. Software Upload

    • Open [Arduino-Timer.ino] in Arduino IDE
    • Install required libraries:
      • U8g2lib (for OLED display)
      • SPI (built-in)
      • SD (built-in)
    • Upload sketch to Arduino Nano
  3. Testing

    • Power on system - OLED should show "PAUSED" and "00:00:00"
    • Connect filter system pump signal to PC817 input
    • Verify filter system status changes are detected and logged
    • Test reset button when changing filters

💡 Use Cases

  • Water Filtration Systems: Track filter service life in RO systems, whole house filters, well water treatment
  • Pool/Spa Maintenance: Monitor pool filter usage to optimize cleaning and replacement schedules
  • HVAC Systems: Track filter service time in air handlers and furnaces for proper maintenance
  • Aquarium/Aquaculture: Monitor filter runtime in fish tanks and aquaculture systems
  • Industrial Filtration: Log filter service hours for compressed air, hydraulic, and process filtration
  • Laboratory Equipment: Track filter usage in analytical and processing equipment

🔍 Troubleshooting

OLED shows "SD Init Fail"

  • Check SD card module wiring
  • Verify SD card is properly formatted (FAT16/FAT32)
  • Ensure SD card is properly inserted

OLED shows "SD Write Fail"

  • SD card may be full or corrupted
  • Check write protection on SD card
  • Try a different SD card

Filter system status not detecting

  • Verify PC817 optocoupler wiring
  • Check 12V pump/filter system signal is present
  • Test with multimeter across optocoupler output

Display not working

  • Check OLED wiring connections
  • Verify 5V power supply to display
  • Check SPI pin assignments match code

📈 Future Enhancements

  • Pressure Transducer Integration - Monitor filter pressure drop to predict replacement needs
  • WiFi Connectivity - Remote monitoring and data access via wireless connection
  • Web Dashboard - Real-time filter status and historical data visualization
  • Email/SMS Alerts - Automatic notifications when filter replacement is due
  • Multiple Filter Support - Track several filters simultaneously
  • Filter Database - Store different filter types with recommended service intervals
  • Mobile App - Smartphone interface for filter management
  • Data Export - CSV/Excel export for maintenance records
  • Predictive Analytics - AI-powered filter life prediction based on usage patterns
  • Integration APIs - Connect with building management or SCADA systems

📄 License

This project is open source. Feel free to modify and distribute according to your needs.


About

This Arduino sketch tracks pump runtime, showing elapsed time on an OLED and logging events (START, STOP, RESET) to an SD card. It resumes from the last saved time at startup, updates live with pump status, and allows manual resets via a button. Useful for monitoring and recording pump usage history.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages