Aquarium light. Implemented on arduino nano.
Contains several variations
They differ only in the presence of a button / button shield. Functional:
- 8 time slots;
- 4 channels of PWM klz for adjusting the brightness of the LEDs for each period of time;
- Support for real time clock (for restoring work after a power outage);
- Button for turning on the service light with a power of 70% of the nominal value;
- Conclusion of values on the display.
The functionality is similar, the number of time intervals and powers is reduced. Instead of two initial and two final intervals, the function of sunset and dawn is inserted.
Similar to the previous sketch, but it has the ability to set the time and power from the 3-inser-number-lite buttons (in a semi-finished form). For arduino nano, it is necessary to clean the code a lot in order to have enough space on the board, but it can be written to arduino mega.
aqua_light.xodball (638.8 KB)
Thank you for sharing back. It is interesting to see how much different your final code is than mine would have been. Not more or less “correct”…just different.
If you just want an aquarium controller, it looks like you are done. If you are interested in exploring XOD more and puttering with this, you can look at creating your own data type so you can pass the 4 colors between all your nodes with one wire instead of 4 wires all the time. Defining Custom Types — XOD. You could also look at the existing ‘color’ data type (but it only stores 3 colors) Data Types Reference — XOD (scroll to the bottom for Color literals). It would be interesting to see if using your own data type used more or less memory… It might allow you to use the built-in if-else node instead of building a custom one…
Good day! In general, while I finish. Your idea with the cascade helped a lot in freeing up device memory. The only thing I did not understand was that the compilation of the code of the “full” version of the program took 5 minutes, the “truncated” one, where I added sunsets and sunrises (I spied on the guys who make the lighting of the terrarium) - it was compiled immediately, without any expectations.
I introduced the function of recording parameters from the buttons more for the sake of interest - I accidentally dreamed about it in the morning =). It seems to work and may be useful to someone. Although it may be necessary to rename it then, for the convenience of the search.
While I was making the data entry function, I decided to completely abandon it for the sake of the design and minimalism of the end device. Yes, this will be due to the inconvenience of overwriting data. but when the cycle is settling, it will be possible not to do this.
This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.