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.
To align with real-world tidal cycles, fetch tide data using an API.
The code below fetches tide times and controls pumps accordingly.
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
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
- Microcontroller:
- Wemos D1 Mini ESP32
- Compact, Wi-Fi-enabled, and low-cost.
- Wemos D1 Mini ESP32
- Submersible Water Pumps:
- Two small DC pumps (e.g., 5V or 12V mini submersible pumps).
- Relay Module:
- A 2-channel relay module to control the pumps.
- Power Supply:
- Match the pump voltage (e.g., 5V or 12V DC).
- USB power for the ESP32.
- Reservoir Tank:
- To store water during low tide.
- Tubing:
- Flexible tubing to transfer water between the tank and reservoir.
- Miscellaneous:
- Jumper wires, breadboard, connectors.
Software Setup
1. Install ESP32 Support in Arduino IDE
- Open Arduino IDE.
- Go to File > Preferences.
- Add the following URL to "Additional Board Manager URLs":https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json
- Go to Tools > Board > Boards Manager.
- Search for "WEMOS D1 MINI ESP32" and install the latest version of the package.
2. Select Wemos D1 Mini ESP32 in Arduino IDE
- Go to Tools > Board and select:"WEMOS D1 MINI ESP32".
- Set the appropriate COM port under Tools > Port.
Circuit Design
- 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).
- 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.
- 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
- The Wemos D1 Mini ESP32 connects to Wi-Fi and fetches real-time tide data from the API.
- Tide times are extracted from the API response.
- The pump control logic schedules the "fill pump" for high tide and the "drain pump" for low tide.
- 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