Idea for rockpool reef......WITH TIDES?!?!?!

keepingfishwithnoidea

Well-Known Member
View Badges
Joined
Oct 4, 2024
Messages
532
Reaction score
324
Location
Maldives
Rating - 0%
0   0   0
this is i work in progress, still not tested but i think it works and here is how you can make it, basically what is does is simulate tides in whatever location you pic
Using the Wemos D1 Mini ESP32 for Tidal Control in a Rockpool Simulation

Simulating tides in a rockpool environment involves replicating the periodic rise and fall of water levels. This me will guide you on using the Wemos D1 Mini ESP32 to control water pumps, synchronize with real-world tidal cycles, and create a realistic aquatic ecosystem. The ESP32 version of the Wemos D1 Mini offers advanced processing power, built-in Wi-Fi, and compact size at an affordable cost.




Hardware Requirements


  1. Microcontroller:
    • Wemos D1 Mini ESP32
      • Compact, Wi-Fi-enabled, and low-cost.
  2. Submersible Water Pumps:
    • Two small DC pumps (e.g., 5V or 12V mini submersible pumps).
  3. Relay Module:
    • A 2-channel relay module to control the pumps.
  4. Power Supply:
    • Match the pump voltage (e.g., 5V or 12V DC).
    • USB power for the ESP32.
  5. Reservoir Tank:
    • To store water during low tide.
  6. Tubing:
    • Flexible tubing to transfer water between the tank and reservoir.
  7. Miscellaneous:
    • Jumper wires, breadboard, connectors.



Software Setup


1. Install ESP32 Support in Arduino IDE


  1. Open Arduino IDE.
  2. Go to File > Preferences.
  3. Add the following URL to "Additional Board Manager URLs":https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json

  4. Go to Tools > Board > Boards Manager.
  5. Search for "WEMOS D1 MINI ESP32" and install the latest version of the package.

2. Select Wemos D1 Mini ESP32 in Arduino IDE


  1. Go to Tools > Board and select:"WEMOS D1 MINI ESP32".
  2. Set the appropriate COM port under Tools > Port.



Circuit Design


  1. Relay Module Wiring:
    • Connect the relay module VCC and GND to the 5V and GND pins on the Wemos D1 Mini ESP32.
    • Connect IN1 (Relay 1) to GPIO 26 (D26).
    • Connect IN2 (Relay 2) to GPIO 27 (D27).
  2. Pump Connections:
    • Relay 1 controls the "drain pump" (low tide).
    • Relay 2 controls the "fill pump" (high tide).
    • Ensure the pumps are powered through their respective external power supplies.
  3. Wemos D1 Mini ESP32 Power:
    • Use a USB cable to supply power.



Real-Time Tidal Data Integration


To align with real-world tidal cycles, fetch tide data using an API.


Recommended API:​


  • WorldTides API: Provides free and paid plans with global coverage.
  • NOAA Tides and Currents API: Free API for the US region.



Example Code


The code below fetches tide times and controls pumps accordingly.

C++:
#include <WiFi.h>

#include <HTTPClient.h>

#include <ArduinoJson.h>



// Wi-Fi credentials

const char* ssid = "Your_SSID";

const char* password = "Your_PASSWORD";



// Tide API details

const char* apiEndpoint = "https://www.worldtides.info/api";

const char* apiKey = "<YOUR_API_KEY>";

const char* location = "San Francisco";



// Pump GPIO pins

#define DRAIN_PUMP 26

#define FILL_PUMP 27



void setup() {

  Serial.begin(115200);

  pinMode(DRAIN_PUMP, OUTPUT);

  pinMode(FILL_PUMP, OUTPUT);



  // Turn off both pumps initially

  digitalWrite(DRAIN_PUMP, LOW);

  digitalWrite(FILL_PUMP, LOW);



  connectToWiFi();

  fetchAndControlTides();

}



void loop() {

  // Regularly fetch new tide data (every 24 hours)

  static unsigned long lastUpdate = 0;

  const unsigned long updateInterval = 24 * 60 * 60 * 1000; // 24 hours



  if (millis() - lastUpdate >= updateInterval) {

    fetchAndControlTides();

    lastUpdate = millis();

  }

}



void connectToWiFi() {

  Serial.print("Connecting to Wi-Fi...");

  WiFi.begin(ssid, password);



  while (WiFi.status() != WL_CONNECTED) {

    delay(1000);

    Serial.print(".");

  }

  Serial.println(" Connected!");

}



void fetchAndControlTides() {

  if (WiFi.status() == WL_CONNECTED) {

    HTTPClient http;

    String url = String(apiEndpoint) + "?key=" + apiKey + "&location=" + location;

    http.begin(url);



    int httpResponseCode = http.GET();

    if (httpResponseCode == 200) {

      String payload = http.getString();

      Serial.println("Tide Data: " + payload);



      // Parse JSON for tide times

      StaticJsonDocument<1024> doc;

      deserializeJson(doc, payload);



      const char* nextHigh = doc["extremes"][0]["date"];

      const char* nextLow = doc["extremes"][1]["date"];



      schedulePumps(nextHigh, nextLow);

    } else {

      Serial.println("Error fetching tide data");

    }

    http.end();

  } else {

    Serial.println("Wi-Fi not connected!");

  }

}



void schedulePumps(const char* highTide, const char* lowTide) {

  // Convert tide times to UNIX timestamp and schedule pump actions

  // Example: Activate fill pump at high tide and drain pump at low tide

  Serial.println(String("Next High Tide: ") + highTide);

  Serial.println(String("Next Low Tide: ") + lowTide);



  // Add logic to convert times and control pumps

}




How It Works


  1. The Wemos D1 Mini ESP32 connects to Wi-Fi and fetches real-time tide data from the API.
  2. Tide times are extracted from the API response.
  3. The pump control logic schedules the "fill pump" for high tide and the "drain pump" for low tide.
  4. The system updates the tide schedule daily.



Conclusion


Using the Wemos D1 Mini ESP32 for tidal control provides a cost-effective and reliable solution. By integrating real-world tidal data, you can create an authentic rockpool environment. The compact size and robust features of the Wemos D1 Mini ESP32 make it an excellent choice for this project. If you like further assistance with Anything just write in the thread or dm me
 

Peace River

Thrive Master
View Badges
Joined
Apr 29, 2014
Messages
22,411
Reaction score
169,063
Location
USA
Rating - 100%
1   0   0
I'm interested to see how this works both technically and functionally. Many years ago I took a very different approach to a tidal tank and, while it was functionally, the salt creep and similar factors made it less than viable in the long term without a fair amount of upkeep. The technology that you have proposed seems like it would apply to other areas including mimicking lighting patterns around the world for a biotope tank (whether or not it is time-shifted). Good luck - I'm cheering for you!
 
OP
OP
keepingfishwithnoidea

keepingfishwithnoidea

Well-Known Member
View Badges
Joined
Oct 4, 2024
Messages
532
Reaction score
324
Location
Maldives
Rating - 0%
0   0   0
I'm interested to see how this works both technically and functionally. Many years ago I took a very different approach to a tidal tank and, while it was functionally, the salt creep and similar factors made it less than viable in the long term without a fair amount of upkeep. The technology that you have proposed seems like it would apply to other areas including mimicking lighting patterns around the world for a biotope tank (whether of not it is time-shifted). Good luck - I'm cheering for you!
Thank you The tank will hopefuly get setup in abt a moth, the dimentions (i think) will be 100cm by 45cm by 45cm totaling to abt 200l or 55g so thanks and wish me luck, wait you already did that :grinning-face-with-sweat:
 
OP
OP
keepingfishwithnoidea

keepingfishwithnoidea

Well-Known Member
View Badges
Joined
Oct 4, 2024
Messages
532
Reaction score
324
Location
Maldives
Rating - 0%
0   0   0
I'm interested to see how this works both technically and functionally. Many years ago I took a very different approach to a tidal tank and, while it was functionally, the salt creep and similar factors made it less than viable in the long term without a fair amount of upkeep. The technology that you have proposed seems like it would apply to other areas including mimicking lighting patterns around the world for a biotope tank (whether or not it is time-shifted). Good luck - I'm cheering for you!
first problem was tht the pump i bought today sounded louder than an motorcycle and wait it might be fast enough will update on pump later
 

Peace River

Thrive Master
View Badges
Joined
Apr 29, 2014
Messages
22,411
Reaction score
169,063
Location
USA
Rating - 100%
1   0   0

TangerineSpeedo

Reefing since 1989
View Badges
Joined
Jun 8, 2022
Messages
3,273
Reaction score
6,195
Location
SoCal
Rating - 100%
1   0   0
Problem 2.0 salinity as atoms won't work any ideas @
Lol... I was going to mention that keeping salinity stable might be difficult. But in truth as a keeper of a tide pool tank, in reality, actual tide/rock pools change greatly with salinity and temperatures.
I thought of the solution the other day when I was talking about this very thing. But I think you can do it with a tank, a sump and a reservoir to hold the extra water. A series of electronic valves might be involved. the sump would be your constant.
 
OP
OP
keepingfishwithnoidea

keepingfishwithnoidea

Well-Known Member
View Badges
Joined
Oct 4, 2024
Messages
532
Reaction score
324
Location
Maldives
Rating - 0%
0   0   0
ok what about stepper motors
Using the Wemos D1 Mini ESP32 for Tidal Control in a Rockpool Simulation


Introduction


Simulating tides in a rockpool environment involves replicating the periodic rise and fall of water levels. This article will guide you on using the Wemos D1 Mini ESP32 to control a 3D-printed peristaltic pump, synchronize with real-world tidal cycles, and create a realistic aquatic ecosystem. The ESP32 version of the Wemos D1 Mini offers advanced processing power, built-in Wi-Fi, and compact size at an affordable cost.




Hardware Requirements


  1. Microcontroller:
    • Wemos D1 Mini ESP32
      • Compact, Wi-Fi-enabled, and low-cost.
  2. 3D-Printed Peristaltic Pump:
    • A single custom 3D-printed pump.
    • Driven by a stepper motor or DC motor.
  3. ULN2003 Motor Driver:
    • To control the pump motor.
  4. Power Supply:
    • Match the motor voltage (e.g., 5V or 12V DC).
    • USB power for the ESP32.
  5. Reservoir Tank:
    • To store water during low tide.
  6. Tubing:
    • Flexible tubing to transfer water between the tank and reservoir.
  7. Miscellaneous:
    • Jumper wires, breadboard, connectors.



Software Setup


1. Install ESP32 Support in Arduino IDE


  1. Open Arduino IDE.
  2. Go to File > Preferences.
  3. Add the following URL to "Additional Board Manager URLs":https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json

  4. Go to Tools > Board > Boards Manager.
  5. Search for "ESP32" and install the latest version of the package.

2. Select Wemos D1 Mini ESP32 in Arduino IDE


  1. Go to Tools > Board and select:"WEMOS D1 MINI ESP32".
  2. Set the appropriate COM port under Tools > Port.



Circuit Design


  1. ULN2003 Motor Driver Wiring:
    • Connect the ULN2003 VCC and GND to the 5V and GND pins on the Wemos D1 Mini ESP32.
    • Connect the IN pins of the ULN2003 to GPIO pins on the Wemos D1 Mini ESP32 (e.g., GPIO 26, GPIO 27, GPIO 25, and GPIO 33 for a 4-phase stepper motor).
  2. Pump Connections:
    • Attach the motor wires to the ULN2003 driver outputs.
    • Ensure the pump is powered through its external power supply.
  3. Wemos D1 Mini ESP32 Power:
    • Use a USB cable to supply power.



Real-Time Tidal Data Integration


To align with real-world tidal cycles, fetch tide data using an API.


Recommended API:​


  • WorldTides API: Provides free and paid plans with global coverage.
  • NOAA Tides and Currents API: Free API for the US region.



Example Code


The code below fetches tide times and controls the pump accordingly.

Code:
#include <WiFi.h>

#include <HTTPClient.h>

#include <ArduinoJson.h>



// Wi-Fi credentials

const char* ssid = "Your_SSID";

const char* password = "Your_PASSWORD";



// Tide API details

const char* apiEndpoint = "https://www.worldtides.info/api";

const char* apiKey = "<YOUR_API_KEY>";

const char* location = "San Francisco";



// Pump GPIO pins

#define MOTOR_IN1 26

#define MOTOR_IN2 27

#define MOTOR_IN3 25

#define MOTOR_IN4 33



void setup() {

  Serial.begin(115200);

  pinMode(MOTOR_IN1, OUTPUT);

  pinMode(MOTOR_IN2, OUTPUT);

  pinMode(MOTOR_IN3, OUTPUT);

  pinMode(MOTOR_IN4, OUTPUT);



  // Turn off the pump initially

  digitalWrite(MOTOR_IN1, LOW);

  digitalWrite(MOTOR_IN2, LOW);

  digitalWrite(MOTOR_IN3, LOW);

  digitalWrite(MOTOR_IN4, LOW);



  connectToWiFi();

  fetchAndControlTides();

}



void loop() {

  // Regularly fetch new tide data (every 24 hours)

  static unsigned long lastUpdate = 0;

  const unsigned long updateInterval = 24 * 60 * 60 * 1000; // 24 hours



  if (millis() - lastUpdate >= updateInterval) {

    fetchAndControlTides();

    lastUpdate = millis();

  }

}



void connectToWiFi() {

  Serial.print("Connecting to Wi-Fi...");

  WiFi.begin(ssid, password);



  while (WiFi.status() != WL_CONNECTED) {

    delay(1000);

    Serial.print(".");

  }

  Serial.println(" Connected!");

}



void fetchAndControlTides() {

  if (WiFi.status() == WL_CONNECTED) {

    HTTPClient http;

    String url = String(apiEndpoint) + "?key=" + apiKey + "&location=" + location;

    http.begin(url);



    int httpResponseCode = http.GET();

    if (httpResponseCode == 200) {

      String payload = http.getString();

      Serial.println("Tide Data: " + payload);



      // Parse JSON for tide times

      StaticJsonDocument<1024> doc;

      deserializeJson(doc, payload);



      const char* nextHigh = doc["extremes"][0]["date"];

      const char* nextLow = doc["extremes"][1]["date"];



      schedulePump(nextHigh, nextLow);

    } else {

      Serial.println("Error fetching tide data");

    }

    http.end();

  } else {

    Serial.println("Wi-Fi not connected!");

  }

}



void schedulePump(const char* highTide, const char* lowTide) {

  // Convert tide times to UNIX timestamp and schedule pump actions

  // Example: Activate pump in the desired direction based on tide

  Serial.println(String("Next High Tide: ") + highTide);

  Serial.println(String("Next Low Tide: ") + lowTide);



  // Add logic to convert times and control pump direction

}




How It Works


  1. The Wemos D1 Mini ESP32 connects to Wi-Fi and fetches real-time tide data from the API.
  2. Tide times are extracted from the API response.
  3. The pump control logic schedules the pump to either move water to the reservoir or back into the tank based on tide times.
  4. The system updates the tide schedule daily.
 

Mschmidt

Average Maybe
View Badges
Joined
Feb 9, 2022
Messages
16,913
Reaction score
40,145
Location
Bellingham
Rating - 0%
0   0   0
Or set a float at the lowest the water will ever be. When it evaporates it will drop lower than that, refilling to the low line.
 

Peace River

Thrive Master
View Badges
Joined
Apr 29, 2014
Messages
22,411
Reaction score
169,063
Location
USA
Rating - 100%
1   0   0
Any ideas for how control salinity??
There are multiple ways to control salinity. Many involve one or more external reservoirs. This may include an overflow with water that can be reused, an ATO with RO water, or an ATO with hyper-salinity water. One of the challenges is that the salinity meters in the reefing space are questionable with their precision and some of the better ones do not have inner connectivity modules. Once you move into the industrial salinity meter space then the cost of meters and controllers rises notably.Can you explain your current challenge as best as you understand it?
 
OP
OP
keepingfishwithnoidea

keepingfishwithnoidea

Well-Known Member
View Badges
Joined
Oct 4, 2024
Messages
532
Reaction score
324
Location
Maldives
Rating - 0%
0   0   0
There are multiple ways to control salinity. Many involve one or more external reservoirs. This may include an overflow with water that can be reused, an ATO with RO water, or an ATO with hyper-salinity water. One of the challenges is that the salinity meters in the reefing space are questionable with their precision and some of the better ones do not have inner connectivity modules. Once you move into the industrial salinity meter space then the cost of meters and controllers rises notably.Can you explain your current challenge as best as you understand it?
the water level changes so atos wont work
 

Peace River

Thrive Master
View Badges
Joined
Apr 29, 2014
Messages
22,411
Reaction score
169,063
Location
USA
Rating - 100%
1   0   0
the water level changes so atos wont work
The first priority would seem to be recirculating any overflow back into the system, then adjusting the salinity. Maybe the term ATO is not the best. I am not thinking about an ATO in the traditional sense rather a way to add RO or hyper saline water to maintain a relatively stable salinity.
 

aSaltyKlown

Well-Known Member
View Badges
Joined
Oct 29, 2020
Messages
547
Reaction score
726
Location
N. VA
Rating - 0%
0   0   0
the water level changes so atos wont work
Two ato's one at the reservoir and one in the display/tide pool. Have the ato's on a timer to only turn on when that area is filled. Or you could just go with one in the reservoir area. I wouldn't think when the level is low on the tidepool, there is any concern.
 
OP
OP
keepingfishwithnoidea

keepingfishwithnoidea

Well-Known Member
View Badges
Joined
Oct 4, 2024
Messages
532
Reaction score
324
Location
Maldives
Rating - 0%
0   0   0
Two ato's one at the reservoir and one in the display/tide pool. Have the ato's on a timer to only turn on when that area is filled. Or you could just go with one in the reservoir area. I wouldn't think when the level is low on the tidepool, there is any concern.
a diagram would help as i dont understand
 

TOP 10 Trending Threads

ON A SCALE FROM 1-10, HOW MUCH DO YOU LOVE REEFING?

  • 10 - It's one of the things I love most in life!

    Votes: 88 32.5%
  • 9

    Votes: 35 12.9%
  • 8

    Votes: 54 19.9%
  • 7

    Votes: 43 15.9%
  • 6

    Votes: 10 3.7%
  • 5 - I enjoy it, but I could live without it if I had to.

    Votes: 32 11.8%
  • 4

    Votes: 1 0.4%
  • 3

    Votes: 0 0.0%
  • 2

    Votes: 2 0.7%
  • 1 - I'm not sure why I am still in this hobby...

    Votes: 6 2.2%
Back
Top