/aquacontrol32

Software for a 5 channel LED controller based on a MH-ET LIVE Minikit.

Primary LanguageCMIT LicenseMIT

Aquacontrol32

Aquacontrol32 is software used to program and control 5 led strips to create more natural sunrises and sunsets in your aquarium.

Aquacontrol32 runs on hardware based on a MH-ET LIVE MiniKit ESP32.

With some modifications and provided there are enough pins broken out, Aquacontrol32 should run on basically any ESP32 based board.

The minimum hardware would be a ESP32 board with at least 5 free output pins connected via 330R gate resistors to 5 NPN mosfets. I use IRLZ44N mosfets as these are very cheap.

You can connect a cheap 128x64 I2C OLED and/or a ILI9341 SPI tft display to have some feedback on the display(s).
The ILI9341 displays optionally come with a XPT2046 touch controller which is supported.

Features:

  • 5 channels led dimming (common anode) at 1.22kHz with 16 bit (65535 steps) resolution.

  • 50 timers per channel.

  • Password protected web interface to control the device.
    See it in action at my fish and my salamanders tank.

  • Automatic NTP timekeeping.

  • Timezone support.

  • OneWire Maxim ( Dallas ) DS18B20 sensor support.

  • I2C 128x64 SSD1306 OLED support.

  • SPI 320x240 ILI9341 TFT support.

  • XPT2046 touchscreen support.

  • SPIFFS storage support.

  • Temperature logging on SPIFFS.

  • All settings are saved in NVS.

  • Easily connect your controller to WiFi with the ESP8266 SmartConfig Android app.

You will need:

Aquacontrol32 can run happily with or without OLED or TFT display.

Compile notes:

  • Compiling from the Arduino IDE does not work if you just cloned the repo.
    You have to use the script compile.sh to verify your sketch and flash.sh to verify/upload the sketch to the controller.
    Read this blog post to see why I choose this method.
    You can however still compile from the Arduino IDE if you manually add a file named gitTagVersion.h to your sketch folder with the following content:
    const char * sketchVersion = "change this to a version string";
    This file will be overwritten and deleted if you use the flash.sh or compile.sh script.

  • Source are compiled for ESP32 Dev Module which has support for ESP_LOGX macros.
    custom_DebugLevel should be set to esp32_none in the flash.sh script for production use.
    When you are still testing your hardware and setup, debug level can be set to anything depending on your needs.
    (esp32_info is probably what you need, esp32_verbose gives the most info)

  • Check your compile settings and used libraries.

  • If your controller has a problem after flashing (no Wifi or stuck/not properly booting) the most probable cause is corrupted NVS.
    Erasing the complete flash memory will solve most of these problems.
    Use this command to erase flash (SPIFFS INCLUDED!) in Linux:
    ~/Arduino/hardware/espressif/esp32/tools/esptool.py --port /dev/ttyUSB1 erase_flash
    Backup your default.aqu in the file manager before erasing and upload it after you flash your controller.

Connecting the hardware:

  • Check the Aquacontrol hardware GitHub repo.

  • Read the file on connecting a ILI9341 display. Pull-ups are not optional!

  • The ILI9341 boards from AliExpress, DealExtreme or any other supplier are not all equal.
    Among the tested boards I encountered some that have no MISO pin connected, so they can't respond to read commands.
    For these boards you can enable TFT_HAS_NO_MISO (set it to 1) in aquacontrol32.ino.

  • Some ILI9341 boards have their touch coordinates inverted.
    For these boards you can enable TOUCH_IS_INVERTED (set it to 1) in aquacontrol32.ino.

  • Don't forget to connect the tft LED to 3.3V. (default: GPIO PIN 2)
    To be on the safe side, I use a BC547 transistor (and a 330R resistor) between the ESP32 pin and the LED connector on the tft board.
    If you connect the LED directly to a ESP32 pin, connect it through a 330R resistor in series to prevent burning up your ESP32.

SmartConfig:

  • If your ESP32 has connected to your WiFi router before you flash Aquacontrol to your device, it will probably connect automagically .

  • If you try to connect to an unknown WiFi network or changed your WiFi router settings, Aquacontrol will fail to connect and start SmartConfig.
    If you have no oled or tft connected, the onboard led will blink at 1Hz to show you the device is in SmartConfig mode.
    You can then use the Espressif SmartConfig app or the ESP8266 SmartConfig Android app to setup your Aquacontrol WiFi connction.

Log files:

By default log files are not generated.
Log files are saved on SPIFFS and could reduce the lifetime of the flash memory.
To log the temperature sensor values on SPIFFS enable LOG_FILES (set it to 1) in aquacontrol32.ino.

Known issues:

No issues at the moment.

The test hardware: