Introduction: Smart Aquarium
This is a simple arduino-based fish feeder + light + air pump controller project. You may do the same and even add more features like temperature sensor, web UI, LCD, heater relay. There are many examples on how to do it with arduino / esp8266 for example. However these features are not needed in my case, it simply does the same job day by day for ~8 months already without any human interaction. It looks quite ugly in reality as you may see at the photos, sorry for that. On the other hand you may see all the internal components.
Step 1: Basic Idea (arduino)
I've added a real time clock (aka RTC, ds1307 chip, i2c protocol) board, which is quite cheap, to be sure that it'll all keep working after any power down case. The outlets for the lamp and the pump are linked to 220V power supply via 10A relays, managed by arduino.
There are many RTC examples for Arduino wiring in internet, different complexity level (i saw one which is supposed to take PC system time while flashing and set a flag in EEPROM when RTC is configured). However you may use the simplest one - you'll have to flash it only once for its whole lifetime. I used bascom AVR + AVRdudeR for programming here, the whole code was based on Bascom example (ds1307_3231.bas). I had to flash 2 separate codes - one for RTC configuration, second one with no RTC configuration to avoid RTC re-set on arduino restart, but you may create a single program as i mentioned earlier.
Here are several important things from my code:
'presets for Arduino uno r3:
$regfile = "m328pdef.dat"
$crystal = 16000000
Config Servos = 1 , Servo1 = Portb.4 , Reload = 30 , Timer = Timer1
Enable Interrupts: Enable Urxc
'feeding sub program (it does it by several steps to be more effective + there's a 30 sec delay to avoid re-execution several times per minute)
For F = 35 To 85 Step 10 Servo(1) = F : Wait 1 Next F Servo(1) = 20 : Wait 2 : Servo(1) = 40 : Wait 1 : Servo(1) = 20 : Wait 2 : Servo(1) = 40 : Wait 30
Step 2: Feeder
The feeder schema is here, its made of a plastic jar of a forage and a tube fixed by plastic glue. It just drops a portion of fish food on each 180 degree (or a bit less) rotation. The servo drive is responsible for this rotation, it does it every day at 9 a.m., 365 days per year. The light gets turned on at this moment, air pump is turned off. Within few minutes it starts the pump and keeps both lamp and pump turned on till 9 p.m. The screw at the back side of the storage allows me to fill in the main storage when needed.