This project has not progressed for quite some time, so i decided to work a little bit on it. Planned features are still planned, but as i said in a previous post, i'm making the arduino base module independent. That way, if there is a Raspberry Pi connected, advanced functionalities are available, but if not, it will still work and do it's job.
So i've made a simple module that is able to read temperature from two DS18B20 probes, one for air temperature, another for water temperature, and controls the lights of the aquarium. Using a TIP120, it powers 12V led strips, controlling it with PWM. There is an RTC module to keep track of time, and an I2C LCD to print informations. So as of now this it what it does:
- Read and print air temperature on LCD;
- read and print water temperature;
- print time and date;
- turn lights on automatically:
- on time can be set;
- lights fade in duration can be set;
- turn lights off automatically
- off time can be set;
- lights fade out duration can be se
- up to 8 temperature probes are physically supported on the current design;
- two independent outputs are planned, each with PWM.
This is the core of the functionalities for automating the system. However, manual control is still possible, with a button that can override the automatic settings for a configurable duration. As of now, if i press the button while the lights are off, it fades in for 5 minutes, at a faster rate than normal (but still not a brutal off-on transition). After that duration it returns to the normal state (off).
If it was the time for the lights to be on, it fades off quickly for the same duration. In the future, i plan to have a different duration for off override. Indeed, if it's on and i want it off, it's probably because i want to go to sleep without an aquarium light in my room. Hence a longer override, until the next natural "morning" (ie the next time when lights should turn on).
In case of power loss, it runs the normal course of the program, turning on or off depending on the time (it doesn't remember the override commands issued, that are stored in ram, and thus lost on power loss or reset).
In all cases, messages are print on the LCD, and you know if the lights are completely off, fading out, fading in, or completely on. The LCD backlight also turns of with the lights. In the next revision, i'll add a few buttons that will be used as an interface to set things such as fade duration, on and off time, override duration, etc... I'll keep the quick override button, but also add a small menu controllable with a few other buttons.
Everything in the code is made in non-blocking, so that i didn't have to use interrupts.
Here are the next steps :
- add more buttons;
- add the control menu;
- make the LCD backlight turn off AFTER the lights shutdown (LCD backlight is on or off, as it's an I2C one);
- have a different value for the off override, or be able to override until next phase;
- have the system print more than two temperature probes, and be able to assign a label to each with the interface rather than in the code;
- reintegrate the previously coded temperature controls (turn a fan or a device on and off depending on temperature);
- reintegrate the serial communications code;
- make a case for 3D printing or laser cutting for it.
I'll post the schematics and the code soon (of this version, so it doesn't mean in months :) )