User avatar
By RichardS
#43121 User

My goal in this project was making life easier to all those aquarium/vivarium owners by automating the system and gaining a better control on it. This should allow them to monitor more easily their hobby, where the main parameters that has to be handled by the system are the light and the temperature.
Compared to other products, I've think of a control system based entirely on a web interface. This is why the ESP8266 is the perfect choice for the project.

- Web Interface controlling the system
- PWM outputs to control up to 16 lights
- Temperature readings
- Send revelant data trough the web using services like IFTTT
- inexpensive

The system is based entirely on an ESP8266 without other MCU involved, it uses an external RTC DS1338 to keep the time and storing important data on the NVRAM. It uses also a PCA9685 to generate the PWM signal for controlling the lights and a DS18B20 to measure the temperature.
The system is accessible through a web page that shows all the relevant data (like actual temperature or light value) and lets you configure all the parameters.

The biggest problem that I've faced so far is the reboot of the ESP and the consequent data loss.
To bypass this problem I've chosen not to store all the important variables on the ESP8266 RAM but in the 56 bytes of NVRAM on the RTC and in the EEPROM using the filesystem.
In the EEPROM are stored the arrays of PWM values, one file for each channel of the PCA9685(max 16) with one value of one byte for each minute of the day ( 24*60 = 1440 byte/day for channel).

How does it works?
The ESP8266 reads the RTC timevalue one time per second, if the actual minute of the day is different from the last used, it opens the files of the PWM in the EEPROM with the actual minute as index and puts the value in the corresponding PCA9685 register.
Every second also reads the temperature and updates the value on the main webpage. If the temperature is lower or higher than a threshold the ESP8266 sends an alarm tweet/mail trough the IFTTT webservice.

Future improvements:
- Create various extension boards for the I2C bus.
- Use a SHT75 to measure the humidity for vivarium owners.
- Redesign the PCB without rely on third party ESP module, but place the ESP8266 chip & the flash on the same pcb as the other components.

Qty Value Device Package Parts Description
5 100nF C-EUC0603 C0603 C3, C4, C5, C6, C7 CAPACITOR, European symbol
2 10uF CPOL-EU150CLZ-0810 150CLZ-0810 C1, C2 POLARIZED CAPACITOR, European symbol
1 32.768KHz CRYSTAL32-SMD CRYSTAL-32KHZ-SMD Q1 Standard crystals.
1 DPDT DPDT SW Deviatore a 2 Posizioni e 2 Vie
1 LED-PURPLE1206 LED-1206 D2 green LED
1 M022.54MM_SCREWTERM 1X02_2.54_SCREWTERM JP2 Standard 2-pin 0.1" header. Use with
2 M03PTH 1X03 JP7, JP9 Header 3
1 M04POLAR MOLEX-1X4 JP1 Header 4
6 4K7 R-EU_R0603 R0603 R1, R2, R3, R4, R5, R6 RESISTOR, European symbol
1 SWITCH-MOMENTARY-2-SMD-1101NE TACTILE-SWITCH-1101NE S1 Various NO switches- pushbuttons
1 BATT 3.3V M02PTH 1X02 JP6
1 DS1338 DS1307SO8-TIGHT SO08-TIGHT IC2 I2C real-time clock with battery backup.
1 ESP-12 ESP-12 ESP-12 ESP8266
1 M04PTH 1X04 JP5 Header 4
1 LM1117 V_REG_LM1117SOT223 SOT223 IC1 Voltage Regulator LM1117
2 M08X2 M08X2 2X8 U$2, U$3 .1" headers, two rows of 8 each
1 PCA9685 PCA9685 TSSOP28 IC3 PCA9685 - 16 Channel 12-Bit I2C PWM Controller
1 R-783.3 R-78C3.3-1.0 SIP3 DC1 INNOLINE DC/DC-Converter 1.0 AMP SIP3 Single Output
1 SSR M02PTH 1X02 JP3 Standard 2-pin 0.1" header. Use with
1 TEMP M03PTH 1X03 JP4 Header 3

Link to source HW&SW


User avatar
By Touliloup
#47796 Hi :D

I was thinking about replacing my old Arduino based aquarium controller Aquapipi with a new ESP version.

Your project seems to really be a great one, I wanted to check the source for more info (notably about rtc memory usage and http server) but sadly the project doesn't exist anymore on your github. Did you transfer the project to another repository?