DIY AI-coded ESP32 based aquarium controller

Ronnyking

Community Member
View Badges
Joined
Feb 9, 2017
Messages
32
Reaction score
23
Rating - 0%
0   0   0
Hello all,

I am in the process of setting up a new tank (120 x 50 x 40 cm) (approximately 48 " by 20" by 16"). As part of the preparation, I want to make my own aquarium controller using an ESP32. My coding skills are limited, so I went ahead and talked with our dear friend ChatGPT until I got a working sketch. I'm fairly happy with the result so far, but I'm sure the code can be optimized a lot. For instance, I am looking into splitting the code in different files.

At the moment the controller does the following:
Features:

  • Auto-top off based on three float switches (low switch, high switch and reservoir switch) and timer functions
Monitoring:

  • 3 Dallas ds18b20 probes for temperature monitoring (Sump, Display tank and room temperature)
  • 1 analog pH sensor module (ph-4502c), with calibration option
Control:

  • 12 relay control
Webserver:

  • Simple webpage displaying sensor readings, relay control buttons and pH calibration option
Schermafbeelding 2024-10-18 204259.jpg


E-mail allert:

  • Automatic e-mail alert when ATO reservoir is low

Any input and/or help is greatly appreciated!

Github page: https://github.com/Odaller/ESP32Reefcontroller
 
OP
OP
R

Ronnyking

Community Member
View Badges
Joined
Feb 9, 2017
Messages
32
Reaction score
23
Rating - 0%
0   0   0
hey @Mark Whitaker, thank you. Any general advice is appreciated, like how to make the code more performative - I have the feeling that it's quite bulky now. But if it works...

Or suggestions to add stuff?
 
OP
OP
R

Ronnyking

Community Member
View Badges
Joined
Feb 9, 2017
Messages
32
Reaction score
23
Rating - 0%
0   0   0
[UPDATE]:
Added a DHT sensor to monitor room temperature and humidity.

Added extra safety feature for ATO pump: shuts off after 1 minute runtime and has to be manually reset using a button on the webpage.

Added extra warning e-mails for each error: ATO reservoir low, Pump runtime exceeded. Possible to add more if needed (e.g. temperature or pH range warnings).
 

sloppy

New Member
View Badges
Joined
Nov 14, 2024
Messages
2
Reaction score
0
Location
USA
Rating - 0%
0   0   0
What ESP32 board are you using, I have been wanting to build something like this for a while. Want to integrate it in to home assistant.

Can you list all your hardware and where you got it form?
Do you know if there is a sensor for salinity?
 
OP
OP
R

Ronnyking

Community Member
View Badges
Joined
Feb 9, 2017
Messages
32
Reaction score
23
Rating - 0%
0   0   0
What ESP32 board are you using, I have been wanting to build something like this for a while. Want to integrate it in to home assistant.

Can you list all your hardware and where you got it form?
Do you know if there is a sensor for salinity?
At first I used something like this: https://devices.esphome.io/devices/AC-DC-ESP32-Relay-x4
But I'm going to switch to a MH-ET live mini kit because of the smaller footprint. I'm not going to use 12 relays, so it's OK.
Maybe I'm going to use a ESP32-S3 version, but then the code will need to be adapted I think.

I still need to solder everything together, but most parts are sourced via Aliexpress or Banggood or other similar sites.

When everything is soldered together, I'm going to write up a BOM and post it here. I'm thinking about home assistant too - then the code will need to change I guess. For now, it's a standalone controller.

I looked for a salinity sensor as well. This one seems to be OK: https://www.dfrobot.com/product-1797.html
But those sensors are quite sensitive for electrical currents, and I don't think it will be useful to keep in the tank full time. Salinity is not very volatile anyway, so I would not use it.
 

sloppy

New Member
View Badges
Joined
Nov 14, 2024
Messages
2
Reaction score
0
Location
USA
Rating - 0%
0   0   0
Do you think the relay board will handle the current of heaters? It says ten amps but I wonder how long they will last.
Im sure someone has tested them.
 
OP
OP
R

Ronnyking

Community Member
View Badges
Joined
Feb 9, 2017
Messages
32
Reaction score
23
Rating - 0%
0   0   0
I have not tested them myself. I connect my appliances through the "normal closed" loop. This way the relay only needs to be triggered if you want to switch something off. Heaters are normally continously on, and use their internal thermostat to regulate them. I would only use the relay to cut them off if the temperature keeps rising uncontrollably - which would seem as a heater failure.
 

TOP 10 Trending Threads

Back
Top