Sam's Oceanic 120 - DIY solutions

ParlaPHMonitor code:
CSS:
#include <Wire.h>
#include "SPI.h"
#include "TFT_22_ILI9225.h"
#include <SimpleTimer.h>
#include <../fonts/FreeSansBold24pt7b.h>
#include <../fonts/FreeSans12pt7b.h>


#define TFT_RST 8
#define TFT_RS  9
#define TFT_CS  10  // SS
#define TFT_SDI 11  // MOSI
#define TFT_CLK 13  // SCK
#define TFT_LED 3   // LED
#define TFT_BRIGHTNESS 200 //Initial brightness of TFT backlight

TFT_22_ILI9225 tft = TFT_22_ILI9225(TFT_RST, TFT_RS, TFT_CS, TFT_LED, TFT_BRIGHTNESS);

//Variables and constants
#define buzzer  5 //buzzer to arduino pin 5
int16_t x, y, w, h;

SimpleTimer timer;
#define PH_PROBE A1
float calibration_value = 21.5;
float ph_act;
unsigned long int avgval;
int buffer_arr[60], temp;

// Setup
void setup() {
  pinMode(buzzer, OUTPUT); // Set buzzer - pin 5 as an output
  Serial.begin(9600);
  Serial.println("\n************ ParlaPHMonitor Starting ************");
  while (!Serial) {} // wait for serial port to connect.
  //setup LCD and draw home screen
  tft.begin();
  tft.clear();
  tft.setOrientation(3);
  tft.setBacklight(HIGH);
  tft.setBackgroundColor(COLOR_BLACK);
  tft.drawRectangle(5, 5, tft.maxX() - 5, tft.maxY() - 5, COLOR_WHITE); //draw rectangle around the screen
  tft.setGFXFont(&FreeSans12pt7b); // Set title font
  tft.drawGFXText(37, 155, "ParlAquatics", COLOR_BLUE); //Print title string
  timer.setInterval(250L, updateUI); //We setup the callback function to update the UI.
}

// Loop
void loop() {
  //Get the PH from the analog pin. average it over a number of readings.
  for (int i = 0; i < 60; i++) { //Take 60 samples
    buffer_arr[i] = analogRead(PH_PROBE); //A0
    delay(90);
  }
  for (int i = 0; i < 59; i++) {
    for (int j = i + 1; j < 60; j++) {
      if (buffer_arr[i] > buffer_arr[j]) { //Sort the values
        temp = buffer_arr[i];
        buffer_arr[i] = buffer_arr[j];
        buffer_arr[j] = temp;
      }
    }
  }
  avgval = 0;
  for (int i = 29; i < 49; i++) //Use only the middle 20 values
  avgval += buffer_arr[i];
  float volt = (float)avgval * 5.0 / 1024 / 20;
  ph_act = -5.70 * volt + calibration_value, 2;
  Serial.println("pH Val: " + String(ph_act,2));

  timer.run(); // Initiates SimpleTimer which updates the UI]
   //Ring buzzer if Kalkwasser PH is low:
   // if ( ph_act > 10 ) {
   //     noTone(buzzer); //Stop sound
   // } else {
   //     tone(buzzer, 1000, 100); //Send 1KHz sound signal
   // }
  delay(1000);
}

// Callback to update the UI
void updateUI() {
  //Setup screen
  tft.drawRectangle(5, 5, tft.maxX() - 5, tft.maxY() - 5, COLOR_WHITE); //draw rectangle around the screen
  tft.setGFXFont(&FreeSans12pt7b); // Set title font
  if ( ph_act > 10 ) {
        tft.drawGFXText(25, 35, "Kalkwasser pH:", COLOR_WHITE); //Print title string
    } else {
        tft.drawGFXText(25, 35, "Kalkwasser pH:", COLOR_RED); //Print title string
    }
  //Setup Readings
  x=60;
  y=70;
  String s1 = String(ph_act,2);
  Serial.println("UpdateUI with pH Val: " + s1);
  tft.setGFXFont(&FreeSansBold24pt7b); // Set current font
  tft.getGFXTextExtent(s1, x, y, &w, &h); // Get string extents
  y += h; // Set y position to string height
  tft.fillRectangle( 10, 45, tft.maxX()-10, 125, COLOR_BLACK);
  if ( ph_act > 10 && ph_act != 0) {
      tft.drawGFXText(x, y, s1, COLOR_WHITE); // Print string
  } else if ( ph_act != 0) {
      tft.drawGFXText(x, y, s1, COLOR_RED); // Print string
  } else {
        tft.setGFXFont(&FreeSans12pt7b); // Set font
        tft.drawGFXText(x, y, "calculating", COLOR_GRAY); // Print string
  }
  tft.setGFXFont(&FreeSans12pt7b); // Set title font
  tft.drawGFXText(37, 155, "ParlAquatics", COLOR_BLUE); //Print title string
}
 
ParlaPHMonitor code:
CSS:
#include <Wire.h>
#include "SPI.h"
#include "TFT_22_ILI9225.h"
#include <SimpleTimer.h>
#include <../fonts/FreeSansBold24pt7b.h>
#include <../fonts/FreeSans12pt7b.h>


#define TFT_RST 8
#define TFT_RS  9
#define TFT_CS  10  // SS
#define TFT_SDI 11  // MOSI
#define TFT_CLK 13  // SCK
#define TFT_LED 3   // LED
#define TFT_BRIGHTNESS 200 //Initial brightness of TFT backlight

TFT_22_ILI9225 tft = TFT_22_ILI9225(TFT_RST, TFT_RS, TFT_CS, TFT_LED, TFT_BRIGHTNESS);

//Variables and constants
#define buzzer  5 //buzzer to arduino pin 5
int16_t x, y, w, h;

SimpleTimer timer;
#define PH_PROBE A1
float calibration_value = 21.5;
float ph_act;
unsigned long int avgval;
int buffer_arr[60], temp;

// Setup
void setup() {
    pinMode(buzzer, OUTPUT); // Set buzzer - pin 5 as an output
    Serial.begin(9600);
  Serial.println("\n************ ParlaPHMonitor Starting ************");
  while (!Serial) {} // wait for serial port to connect.
  //setup LCD and draw home screen
  tft.begin();
    tft.clear();
  tft.setOrientation(3);
  tft.setBacklight(HIGH);
  tft.setBackgroundColor(COLOR_BLACK);
  tft.drawRectangle(5, 5, tft.maxX() - 5, tft.maxY() - 5, COLOR_WHITE); //draw rectangle around the screen
  tft.setGFXFont(&FreeSans12pt7b); // Set title font
    tft.drawGFXText(37, 155, "ParlAquatics", COLOR_BLUE); //Print title string
  timer.setInterval(250L, updateUI); //We setup the callback function to update the UI.
}

// Loop
void loop() {
  //Get the PH from the analog pin. average it over a number of readings.
  for (int i = 0; i < 60; i++) { //Take 60 samples
    buffer_arr[i] = analogRead(PH_PROBE); //A0
    delay(90);
  }
  for (int i = 0; i < 59; i++) {
    for (int j = i + 1; j < 60; j++) {
      if (buffer_arr[i] > buffer_arr[j]) { //Sort the values
        temp = buffer_arr[i];
        buffer_arr[i] = buffer_arr[j];
        buffer_arr[j] = temp;
      }
    }
  }
  avgval = 0;
  for (int i = 29; i < 49; i++) //Use only the middle 20 values
    avgval += buffer_arr[i];
  float volt = (float)avgval * 5.0 / 1024 / 20;
  ph_act = -5.70 * volt + calibration_value, 2;
  Serial.println("pH Val: " + String(ph_act,2));

  timer.run(); // Initiates SimpleTimer which updates the UI]
    //Ring buzzer if Kalkwasser PH is low:
    // if ( ph_act > 10 ) {
  //     noTone(buzzer); //Stop sound
    // } else {
  //     tone(buzzer, 1000, 100); //Send 1KHz sound signal
    // }
  delay(1000);
}

// Callback to update the UI
void updateUI() {
    //Setup screen
  tft.drawRectangle(5, 5, tft.maxX() - 5, tft.maxY() - 5, COLOR_WHITE); //draw rectangle around the screen
  tft.setGFXFont(&FreeSans12pt7b); // Set title font
  if ( ph_act > 10 ) {
        tft.drawGFXText(25, 35, "Kalkwasser pH:", COLOR_WHITE); //Print title string
    } else {
        tft.drawGFXText(25, 35, "Kalkwasser pH:", COLOR_RED); //Print title string
    }
    //Setup Readings
    x=60;
    y=70;
    String s1 = String(ph_act,2);
  Serial.println("UpdateUI with pH Val: " + s1);
  tft.setGFXFont(&FreeSansBold24pt7b); // Set current font
  tft.getGFXTextExtent(s1, x, y, &w, &h); // Get string extents
  y += h; // Set y position to string height
     tft.fillRectangle( 10, 45, tft.maxX()-10, 125, COLOR_BLACK);
    if ( ph_act > 10 && ph_act != 0) {
      tft.drawGFXText(x, y, s1, COLOR_WHITE); // Print string
    } else if ( ph_act != 0) {
      tft.drawGFXText(x, y, s1, COLOR_RED); // Print string
    } else {
        tft.setGFXFont(&FreeSans12pt7b); // Set font
        tft.drawGFXText(x, y, "calculating", COLOR_GRAY); // Print string
    }
  tft.setGFXFont(&FreeSans12pt7b); // Set title font
    tft.drawGFXText(37, 155, "ParlAquatics", COLOR_BLUE); //Print title string
}
Season 5 Nod GIF by NBC
 
ParlaPHMonitor code:
CSS:
#include <Wire.h>
#include "SPI.h"
#include "TFT_22_ILI9225.h"
#include <SimpleTimer.h>
#include <../fonts/FreeSansBold24pt7b.h>
#include <../fonts/FreeSans12pt7b.h>


#define TFT_RST 8
#define TFT_RS  9
#define TFT_CS  10  // SS
#define TFT_SDI 11  // MOSI
#define TFT_CLK 13  // SCK
#define TFT_LED 3   // LED
#define TFT_BRIGHTNESS 200 //Initial brightness of TFT backlight

TFT_22_ILI9225 tft = TFT_22_ILI9225(TFT_RST, TFT_RS, TFT_CS, TFT_LED, TFT_BRIGHTNESS);

//Variables and constants
#define buzzer  5 //buzzer to arduino pin 5
int16_t x, y, w, h;

SimpleTimer timer;
#define PH_PROBE A1
float calibration_value = 21.5;
float ph_act;
unsigned long int avgval;
int buffer_arr[60], temp;

// Setup
void setup() {
  pinMode(buzzer, OUTPUT); // Set buzzer - pin 5 as an output
  Serial.begin(9600);
  Serial.println("\n************ ParlaPHMonitor Starting ************");
  while (!Serial) {} // wait for serial port to connect.
  //setup LCD and draw home screen
  tft.begin();
  tft.clear();
  tft.setOrientation(3);
  tft.setBacklight(HIGH);
  tft.setBackgroundColor(COLOR_BLACK);
  tft.drawRectangle(5, 5, tft.maxX() - 5, tft.maxY() - 5, COLOR_WHITE); //draw rectangle around the screen
  tft.setGFXFont(&FreeSans12pt7b); // Set title font
  tft.drawGFXText(37, 155, "ParlAquatics", COLOR_BLUE); //Print title string
  timer.setInterval(250L, updateUI); //We setup the callback function to update the UI.
}

// Loop
void loop() {
  //Get the PH from the analog pin. average it over a number of readings.
  for (int i = 0; i < 60; i++) { //Take 60 samples
    buffer_arr[i] = analogRead(PH_PROBE); //A0
    delay(90);
  }
  for (int i = 0; i < 59; i++) {
    for (int j = i + 1; j < 60; j++) {
      if (buffer_arr[i] > buffer_arr[j]) { //Sort the values
        temp = buffer_arr[i];
        buffer_arr[i] = buffer_arr[j];
        buffer_arr[j] = temp;
      }
    }
  }
  avgval = 0;
  for (int i = 29; i < 49; i++) //Use only the middle 20 values
  avgval += buffer_arr[i];
  float volt = (float)avgval * 5.0 / 1024 / 20;
  ph_act = -5.70 * volt + calibration_value, 2;
  Serial.println("pH Val: " + String(ph_act,2));

  timer.run(); // Initiates SimpleTimer which updates the UI]
   //Ring buzzer if Kalkwasser PH is low:
   // if ( ph_act > 10 ) {
   //     noTone(buzzer); //Stop sound
   // } else {
   //     tone(buzzer, 1000, 100); //Send 1KHz sound signal
   // }
  delay(1000);
}

// Callback to update the UI
void updateUI() {
  //Setup screen
  tft.drawRectangle(5, 5, tft.maxX() - 5, tft.maxY() - 5, COLOR_WHITE); //draw rectangle around the screen
  tft.setGFXFont(&FreeSans12pt7b); // Set title font
  if ( ph_act > 10 ) {
        tft.drawGFXText(25, 35, "Kalkwasser pH:", COLOR_WHITE); //Print title string
    } else {
        tft.drawGFXText(25, 35, "Kalkwasser pH:", COLOR_RED); //Print title string
    }
  //Setup Readings
  x=60;
  y=70;
  String s1 = String(ph_act,2);
  Serial.println("UpdateUI with pH Val: " + s1);
  tft.setGFXFont(&FreeSansBold24pt7b); // Set current font
  tft.getGFXTextExtent(s1, x, y, &w, &h); // Get string extents
  y += h; // Set y position to string height
  tft.fillRectangle( 10, 45, tft.maxX()-10, 125, COLOR_BLACK);
  if ( ph_act > 10 && ph_act != 0) {
      tft.drawGFXText(x, y, s1, COLOR_WHITE); // Print string
  } else if ( ph_act != 0) {
      tft.drawGFXText(x, y, s1, COLOR_RED); // Print string
  } else {
        tft.setGFXFont(&FreeSans12pt7b); // Set font
        tft.drawGFXText(x, y, "calculating", COLOR_GRAY); // Print string
  }
  tft.setGFXFont(&FreeSans12pt7b); // Set title font
  tft.drawGFXText(37, 155, "ParlAquatics", COLOR_BLUE); //Print title string
}
battle bots GIF
 
Weekend of water slides! @ blue harbor in WI with the kids and another family for some day-drinking. I mean wholesome family fun.
 
ParlaPHMonitor code:
CSS:
#include <Wire.h>
#include "SPI.h"
#include "TFT_22_ILI9225.h"
#include <SimpleTimer.h>
#include <../fonts/FreeSansBold24pt7b.h>
#include <../fonts/FreeSans12pt7b.h>


#define TFT_RST 8
#define TFT_RS  9
#define TFT_CS  10  // SS
#define TFT_SDI 11  // MOSI
#define TFT_CLK 13  // SCK
#define TFT_LED 3   // LED
#define TFT_BRIGHTNESS 200 //Initial brightness of TFT backlight

TFT_22_ILI9225 tft = TFT_22_ILI9225(TFT_RST, TFT_RS, TFT_CS, TFT_LED, TFT_BRIGHTNESS);

//Variables and constants
#define buzzer  5 //buzzer to arduino pin 5
int16_t x, y, w, h;

SimpleTimer timer;
#define PH_PROBE A1
float calibration_value = 21.5;
float ph_act;
unsigned long int avgval;
int buffer_arr[60], temp;

// Setup
void setup() {
  pinMode(buzzer, OUTPUT); // Set buzzer - pin 5 as an output
  Serial.begin(9600);
  Serial.println("\n************ ParlaPHMonitor Starting ************");
  while (!Serial) {} // wait for serial port to connect.
  //setup LCD and draw home screen
  tft.begin();
  tft.clear();
  tft.setOrientation(3);
  tft.setBacklight(HIGH);
  tft.setBackgroundColor(COLOR_BLACK);
  tft.drawRectangle(5, 5, tft.maxX() - 5, tft.maxY() - 5, COLOR_WHITE); //draw rectangle around the screen
  tft.setGFXFont(&FreeSans12pt7b); // Set title font
  tft.drawGFXText(37, 155, "ParlAquatics", COLOR_BLUE); //Print title string
  timer.setInterval(250L, updateUI); //We setup the callback function to update the UI.
}

// Loop
void loop() {
  //Get the PH from the analog pin. average it over a number of readings.
  for (int i = 0; i < 60; i++) { //Take 60 samples
    buffer_arr[i] = analogRead(PH_PROBE); //A0
    delay(90);
  }
  for (int i = 0; i < 59; i++) {
    for (int j = i + 1; j < 60; j++) {
      if (buffer_arr[i] > buffer_arr[j]) { //Sort the values
        temp = buffer_arr[i];
        buffer_arr[i] = buffer_arr[j];
        buffer_arr[j] = temp;
      }
    }
  }
  avgval = 0;
  for (int i = 29; i < 49; i++) //Use only the middle 20 values
  avgval += buffer_arr[i];
  float volt = (float)avgval * 5.0 / 1024 / 20;
  ph_act = -5.70 * volt + calibration_value, 2;
  Serial.println("pH Val: " + String(ph_act,2));

  timer.run(); // Initiates SimpleTimer which updates the UI]
   //Ring buzzer if Kalkwasser PH is low:
   // if ( ph_act > 10 ) {
   //     noTone(buzzer); //Stop sound
   // } else {
   //     tone(buzzer, 1000, 100); //Send 1KHz sound signal
   // }
  delay(1000);
}

// Callback to update the UI
void updateUI() {
  //Setup screen
  tft.drawRectangle(5, 5, tft.maxX() - 5, tft.maxY() - 5, COLOR_WHITE); //draw rectangle around the screen
  tft.setGFXFont(&FreeSans12pt7b); // Set title font
  if ( ph_act > 10 ) {
        tft.drawGFXText(25, 35, "Kalkwasser pH:", COLOR_WHITE); //Print title string
    } else {
        tft.drawGFXText(25, 35, "Kalkwasser pH:", COLOR_RED); //Print title string
    }
  //Setup Readings
  x=60;
  y=70;
  String s1 = String(ph_act,2);
  Serial.println("UpdateUI with pH Val: " + s1);
  tft.setGFXFont(&FreeSansBold24pt7b); // Set current font
  tft.getGFXTextExtent(s1, x, y, &w, &h); // Get string extents
  y += h; // Set y position to string height
  tft.fillRectangle( 10, 45, tft.maxX()-10, 125, COLOR_BLACK);
  if ( ph_act > 10 && ph_act != 0) {
      tft.drawGFXText(x, y, s1, COLOR_WHITE); // Print string
  } else if ( ph_act != 0) {
      tft.drawGFXText(x, y, s1, COLOR_RED); // Print string
  } else {
        tft.setGFXFont(&FreeSans12pt7b); // Set font
        tft.drawGFXText(x, y, "calculating", COLOR_GRAY); // Print string
  }
  tft.setGFXFont(&FreeSans12pt7b); // Set title font
  tft.drawGFXText(37, 155, "ParlAquatics", COLOR_BLUE); //Print title string
}

200w (13).gif


We need to discuss your commenting however.

Screenshot_20231117_200957_Chrome.jpg
 
Lol I proofread it after I posted it. This was for-fun code…. If I wanted to comment on it and tidy it up I probably wouldn’t have posted it.
 
Lol I proofread it after I posted it. This was for-fun code…. If I wanted to comment on it and tidy it up I probably wouldn’t have posted it.

Lol, don't mind me, carry on sir! :beaming-face-with-smiling-eyes:
 
Got home! stuff came in for the dosers!
IMG_5934(1).JPEG
Packing now for Thanksgiving in Edmonds WA... we leave Tuesday Morning.
No sleep till Brooklyn!
 
Is this an available tracking program? I have been looking for something to transfer all my test data to. Excell was my option.
Apex Fusion's "Measurements" section allows you to manually enter test results and trend the data.
 

TOP 10 Trending Threads

WHAT GIVES YOU THE GREATEST SATISFACTION THAT YOUR REEF IS DOING WELL?

  • Seeing noticeable coral growth

    Votes: 6 25.0%
  • Watching corals open up and show their best color

    Votes: 6 25.0%
  • Seeing fish active, eating, and behaving naturally

    Votes: 2 8.3%
  • Spotting pods, sponges, and other tiny life

    Votes: 1 4.2%
  • Seeing fish clutches or invertebrate babies

    Votes: 1 4.2%
  • Having a long stretch without a major problem

    Votes: 2 8.3%
  • Looking at the whole tank and loving how it’s coming together

    Votes: 4 16.7%
  • Something else (post in the comments)

    Votes: 2 8.3%
Back
Top
Home
Post thread…
Market
What's new