Coder Social home page Coder Social logo

mathompl / aqualed Goto Github PK

View Code? Open in Web Editor NEW
31.0 12.0 8.0 34.02 MB

Arduino Dimmable PWM DIY LED Light for Marine/Reef/Freshwater Aquarium controller with Nextion LCD support and temperature/cooling fans control (3 sensors/fans)

License: GNU General Public License v3.0

C 24.06% C++ 75.94%
ds18b20 arduino nextion aquarium led pwm temperature drivers dimmable reef

aqualed's Introduction

AquaLed (en)

Arduino PWM LED lamp driver software with LCD support and temperature control for marine, reef or sweetwater aquariums.

Features:

  • 8 channel PWM control of LED modules (drivers), with I2C module up to 512 (up to 8 channels on LCD)
  • programmable light hours with sunsets and sunrises
  • night light support
  • 3 digital thermometers with asynchronous temperature read, for: water, lamp and addictional lamp or sump, controlling 3 separate relays (cooling fans)
  • customizable dimming, linear or logarithmic algorith
  • bluetooth compatibility with AQma Led Control by Maqu http://magu.pl/aqma-led-control
  • full configuration and status using Nextion 2.8" LCD with touch support, including: operational hours, sunset & sunrise hours, thermometers, dimming times, schedule, night mode etc.
  • override programs: off, night and user accessible from LCD
  • date/time support with RTC module
  • screen saver with water temperature and time
  • test mode
  • moonphases simulation for night light
  • all settings stored in EEPROM
  • works on Arduino Nano

Example Nextion project attached. I dont have copyright for graphics used, use only as an example.

Nextion LCD Screenshots

Alt text Alt text Alt text Alt text Alt text Alt text Alt text Alt text Alt text Alt text

REQUIREMENTS:

Hardware:

  • Arduino Nano or better
  • RTC module
  • Bluetooth (optional)
  • 3x DS18B20 digital thermometers
  • 3x 5v relays modules
  • PCA9685 PWM i2c module (optional)
  • Nextion 2.8" LCD

Libraries:

Software:

Configuration: Driver configuration is in file aqualed.h

####PINS SETUP: Configuration on LCD.

####Modules (uncomment to disable). As for now bluetooth and nextion support does not fit into Arduino Nano/UNO etc. flash memory. Use arduino Mega or disable one module support.

// modules, uncomment to disable, comment to enable
#define NO_BLUETOOTH
//#define NO_NEXTION
//#define NO_TEMPERATURE

####Other There are many other options for eg. timers resolution, most of them are pretty self-explanatory ;)

Wiring:

Alt text

AquaLed (pl)

Sterownik lampy LED PWM na Arduino z obsługą termometrów, chłodzenia i wyświetlacza LCD Nextion dla akwariów słodko i słonowodnych.

Możliwości:

  • obsługa 8 ściemnialnych kanałów PWM dla modułów LED (driverów), z modułem I2C do 512 kanałów (maksymalnie 8 na wyswietlaczu)
  • programowanie godzin świetenia z symulacją wschodów i zachodów słońca
  • światło nocne
  • obsługa 3 cyfrowych termometrów sterujących pracą 3 przekaźników (np. wentylatorów), np. dla lampy, lampy w sumpie, wody w akwarium
  • ściemnianie/rozjaśnianie
  • kompatybilność z AQma Led Control by Maqu http://magu.pl/aqma-led-control w zakresie programowania przez Bluetooth
  • pełna konfiguracja i status za pomocą wyświetlacza Nextion LCD (przykłady na 2,8"), sterowanie przez dotyk.
  • możliwość chwilowego nadpisania działającego programu z wyświetlacza: wyłączenie/wymuszenie światła nocnego/program zdefiniowany
  • obsługa godziny i daty
  • wygaszacz ekranu z godziną i temperaturą wody
  • tryb test
  • symulacja faz księżyca
  • wszystkie ustawienia zapamiętywane w pamięci EEPROM
  • działa z Arduino Nano lub wyższym modelem

Przykładowy program na wyświetlacz załączony.

**Wygląd ekranów na wyświetlaczu **

Alt text Alt text Alt text Alt text Alt text Alt text Alt text Alt text Alt text Alt text

Wymagania:

Sprzęt:

  • Arduino Nano lub wyższy
  • moduł czasu rzeczywistego RTC
  • Bluetooth (opcjonalnie)
  • 3x termometry cyfrowe DS18B20
  • 3x moduły przekaźników 5v
  • moduł PCA9685 PWM i2c (optionalny)
  • wyświetlacz Nextion 2.8" LCD lub większy

Biblioteki:

Oprogramowanie:

Konfiguracja: Konfiguracja w pliku aqualed.h i nextion.h

####Ustawienia pinów PWM: Konfiguracja z poziomu wyświetlacza.

####Moduły (odkomentuj żeby wyłączyć). Uwaga! Obsługa bluetooth i nextio nie mieści się jednocześnie w pamięcy flash Arduino Nano/Uno itd. wchodzi tylko do Arduino Mega lub podobnego.

// modules, uncomment to disable, comment to enable
#define NO_BLUETOOTH
//#define NO_NEXTION
//#define NO_TEMPERATURE

####Inne W pliku konfiguracyjnym można ustawić wiele opcji w tym czasy działania timerów, rozdzielczość załączania przekaźników itd. Większość ustawień wynika z samych nazw stałych :)

Podłączenie:

Alt text

PCB Prototype boards: Alt text Alt text

Support:http://nano-reef.pl/topic/88904-a-qualed-sterownik-led-termometry-lcd-nextion/

aqualed's People

Contributors

mathompl avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

aqualed's Issues

request about led

Hello,

really nice project. I have one question. Can I use WS2812B LED strip´s for as light. If yes I´m limitted to the number of leds?
Regards
Tobias

[ask] Issue on RTC library

Hi, nice work!!

i have problem on RTC lib version
look like i cannot find rtcSetup, getMoonPhase , readTime, adjustDST and others function
have try to install low version to latest version from https://github.com/adafruit/RTClib with no luck

iam using Arduino Mega Atmega2560 on Arduino IDE

Thanks before

C:\Users\yusuf\Arduino\Project\AquaLed-master\Aqualed\Aqualed.ino: In function 'void setup()':
Aqualed:43:9: error: 'rtcSetup' was not declared in this scope
         rtcSetup ();
         ^~~~~~~~
C:\Users\yusuf\Arduino\Project\AquaLed-master\Aqualed\Aqualed.ino:43:9: note: suggested alternative: 'setup'
         rtcSetup ();
         ^~~~~~~~
         setup
Aqualed:45:9: error: 'getMoonPhase' was not declared in this scope
         getMoonPhase ();
         ^~~~~~~~~~~~
C:\Users\yusuf\Arduino\Project\AquaLed-master\Aqualed\Aqualed.ino:45:9: note: suggested alternative: 'moonPhase'
         getMoonPhase ();
         ^~~~~~~~~~~~
         moonPhase
C:\Users\yusuf\Arduino\Project\AquaLed-master\Aqualed\Aqualed.ino: In function 'void loop()':
Aqualed:66:9: error: 'readTime' was not declared in this scope
         readTime ();
         ^~~~~~~~
C:\Users\yusuf\Arduino\Project\AquaLed-master\Aqualed\Aqualed.ino:66:9: note: suggested alternative: 'currTime'
         readTime ();
         ^~~~~~~~
         currTime
C:\Users\yusuf\Arduino\Project\AquaLed-master\Aqualed\Nextion.ino: In function 'boolean handleTestSlider(int, byte)':
Nextion:190:38: error: 'mapRound' was not declared in this scope
         pwmRuntime[i].valueCurrent = mapRound ((long)t, 0, 100, 0, PWM_I2C_MAX);
                                      ^~~~~~~~
C:\Users\yusuf\Arduino\Project\AquaLed-master\Aqualed\Nextion.ino:190:38: note: suggested alternative: 'round'
         pwmRuntime[i].valueCurrent = mapRound ((long)t, 0, 100, 0, PWM_I2C_MAX);
                                      ^~~~~~~~
                                      round
C:\Users\yusuf\Arduino\Project\AquaLed-master\Aqualed\Nextion.ino: In function 'void handlePWMPage(byte)':
Nextion:279:48: error: 'mapRound' was not declared in this scope
                 pwmSettings[i - 1].valueProg = mapRound (pwmSettings[i - 1].valueProg, 0, 100, 0, PWM_I2C_MAX);
                                                ^~~~~~~~
C:\Users\yusuf\Arduino\Project\AquaLed-master\Aqualed\Nextion.ino:279:48: note: suggested alternative: 'round'
                 pwmSettings[i - 1].valueProg = mapRound (pwmSettings[i - 1].valueProg, 0, 100, 0, PWM_I2C_MAX);
                                                ^~~~~~~~
                                                round
C:\Users\yusuf\Arduino\Project\AquaLed-master\Aqualed\Nextion.ino: In function 'void handleSetTimePage(byte)':
Nextion:351:17: error: 'readTime' was not declared in this scope
                 readTime ();
                 ^~~~~~~~
C:\Users\yusuf\Arduino\Project\AquaLed-master\Aqualed\Nextion.ino:351:17: note: suggested alternative: 'currTime'
                 readTime ();
                 ^~~~~~~~
                 currTime
Nextion:352:17: error: 'adjustDST' was not declared in this scope
                 adjustDST ();
                 ^~~~~~~~~
C:\Users\yusuf\Arduino\Project\AquaLed-master\Aqualed\Nextion.ino: In function 'void handleConfigPage(byte)':
Nextion:503:21: error: 'discoverOneWireDevices' was not declared in this scope
                 s = discoverOneWireDevices ();
                     ^~~~~~~~~~~~~~~~~~~~~~
Nextion:522:26: error: 'listContains' was not declared in this scope
                 idxLed = listContains (settings.sensors[LED_TEMPERATURE_FAN]);
                          ^~~~~~~~~~~~
C:\Users\yusuf\Arduino\Project\AquaLed-master\Aqualed\Nextion.ino:522:26: note: suggested alternative: 'isControl'
                 idxLed = listContains (settings.sensors[LED_TEMPERATURE_FAN]);
                          ^~~~~~~~~~~~
                          isControl
Nextion:540:50: error: 'mapRound' was not declared in this scope
                         setValue (NX_FIELD_N0+i, mapRound (pwmRuntime[i].valueCurrent, 0, PWM_I2C_MAX, 0, 100));
                                                  ^~~~~~~~
C:\Users\yusuf\Arduino\Project\AquaLed-master\Aqualed\Nextion.ino:540:50: note: suggested alternative: 'round'
                         setValue (NX_FIELD_N0+i, mapRound (pwmRuntime[i].valueCurrent, 0, PWM_I2C_MAX, 0, 100));
                                                  ^~~~~~~~
                                                  round
C:\Users\yusuf\Arduino\Project\AquaLed-master\Aqualed\Nextion.ino: In function 'void handlePWMListPage(byte)':
Nextion:615:31: error: 'mapRound' was not declared in this scope
                 tmax = (byte) mapRound (pwmSettings[cid - 1].valueDay, 0, PWM_I2C_MAX, 0, 100);
                               ^~~~~~~~
C:\Users\yusuf\Arduino\Project\AquaLed-master\Aqualed\Nextion.ino:615:31: note: suggested alternative: 'round'
                 tmax = (byte) mapRound (pwmSettings[cid - 1].valueDay, 0, PWM_I2C_MAX, 0, 100);
                               ^~~~~~~~
                               round
C:\Users\yusuf\Arduino\Project\AquaLed-master\Aqualed\Nextion.ino: In function 'double getPercent(byte)':
Nextion:867:16: error: 'mapDouble' was not declared in this scope
         return mapDouble((double)pwmRuntime[i].valueCurrent, 0.0, (double)PWM_I2C_MAX, 0.0, 100.0);
                ^~~~~~~~~
C:\Users\yusuf\Arduino\Project\AquaLed-master\Aqualed\Nextion.ino:867:16: note: suggested alternative: 'double'
         return mapDouble((double)pwmRuntime[i].valueCurrent, 0.0, (double)PWM_I2C_MAX, 0.0, 100.0);
                ^~~~~~~~~
                double
C:\Users\yusuf\Arduino\Project\AquaLed-master\Aqualed\PWM.ino: In function 'void setupPWMPins()':
PWM:24:35: error: no matching function for call to 'init(int)'
         pwmController.init(B000000); // Address pins A5-A0 set to B000000
                                   ^
In file included from C:\Users\yusuf\Arduino\Project\AquaLed-master\Aqualed\PWM.ino:9:0:
C:\Users\yusuf\Documents\Arduino\libraries\PCA9685-Arduino-1.2.15\src/PCA9685.h:204:10: note: candidate: void PCA9685::init(PCA9685_OutputDriverMode, PCA9685_OutputEnabledMode, PCA9685_OutputDisabledMode, PCA9685_ChannelUpdateMode, PCA9685_PhaseBalancer) <near match>
     void init(PCA9685_OutputDriverMode driverMode = PCA9685_OutputDriverMode_TotemPole,
          ^~~~
C:\Users\yusuf\Documents\Arduino\libraries\PCA9685-Arduino-1.2.15\src/PCA9685.h:204:10: note:   conversion of argument 1 would be ill-formed:
C:\Users\yusuf\Documents\Arduino\libraries\PCA9685-Arduino-1.2.15\src/PCA9685.h:211:10: note: candidate: void PCA9685::init(PCA9685_PhaseBalancer, PCA9685_OutputDriverMode, PCA9685_OutputEnabledMode, PCA9685_OutputDisabledMode, PCA9685_ChannelUpdateMode) <near match>
     void init(PCA9685_PhaseBalancer phaseBalancer,
          ^~~~
C:\Users\yusuf\Documents\Arduino\libraries\PCA9685-Arduino-1.2.15\src/PCA9685.h:211:10: note:   conversion of argument 1 would be ill-formed:
PWM:30:9: error: 'getCurrentTime' was not declared in this scope
         getCurrentTime ();
         ^~~~~~~~~~~~~~
C:\Users\yusuf\Arduino\Project\AquaLed-master\Aqualed\PWM.ino:30:9: note: suggested alternative: 'getPercent'
         getCurrentTime ();
         ^~~~~~~~~~~~~~
         getPercent
C:\Users\yusuf\Arduino\Project\AquaLed-master\Aqualed\PWM.ino: In function 'void pwm(byte)':
PWM:262:31: error: 'mapRound' was not declared in this scope
                         val = mapRound(val,  PWM_I2C_MAX, PWM_I2C_MIN,  0, 255);
                               ^~~~~~~~
C:\Users\yusuf\Arduino\Project\AquaLed-master\Aqualed\PWM.ino:262:31: note: suggested alternative: 'round'
                         val = mapRound(val,  PWM_I2C_MAX, PWM_I2C_MIN,  0, 255);
                               ^~~~~~~~
                               round
PWM:264:31: error: 'mapRound' was not declared in this scope
                         val = mapRound(val, PWM_I2C_MIN, PWM_I2C_MAX,  0, 255);
                               ^~~~~~~~
C:\Users\yusuf\Arduino\Project\AquaLed-master\Aqualed\PWM.ino:264:31: note: suggested alternative: 'round'
                         val = mapRound(val, PWM_I2C_MIN, PWM_I2C_MAX,  0, 255);
                               ^~~~~~~~
                               round
PWM:279:39: error: 'mapRound' was not declared in this scope
                                 val = mapRound(val, PWM_I2C_MAX, 0.0, PWM_I2C_MIN, PWM_I2C_MAX);
                                       ^~~~~~~~
C:\Users\yusuf\Arduino\Project\AquaLed-master\Aqualed\PWM.ino:279:39: note: suggested alternative: 'round'
                                 val = mapRound(val, PWM_I2C_MAX, 0.0, PWM_I2C_MIN, PWM_I2C_MAX);
                                       ^~~~~~~~
                                       round
C:\Users\yusuf\Arduino\Project\AquaLed-master\Aqualed\PWM.ino: In function 'void pwm()':
PWM:336:17: error: 'getCurrentTime' was not declared in this scope
                 getCurrentTime ();
                 ^~~~~~~~~~~~~~
C:\Users\yusuf\Arduino\Project\AquaLed-master\Aqualed\PWM.ino:336:17: note: suggested alternative: 'getPercent'
                 getCurrentTime ();
                 ^~~~~~~~~~~~~~
                 getPercent
C:\Users\yusuf\Arduino\Project\AquaLed-master\Aqualed\Temperature.ino: In function 'void fansControl()':
Temperature:56:25: error: 'fansSwitch' was not declared in this scope
                         fansSwitch (i, settings.maxTemperatures[i]);
                         ^~~~~~~~~~
C:\Users\yusuf\Arduino\Project\AquaLed-master\Aqualed\Temperature.ino:56:25: note: suggested alternative: 'relaySwitch'
                         fansSwitch (i, settings.maxTemperatures[i]);
                         ^~~~~~~~~~
                         relaySwitch
In file included from C:\Users\yusuf\Arduino\Project\AquaLed-master\Aqualed\Aqualed.ino:3:0:
C:\Users\yusuf\Arduino\Project\AquaLed-master\Aqualed\Temperature.ino: At global scope:
C:\Users\yusuf\Documents\Arduino\libraries\DS18B20-master/DS18B20.h:9:20: error: expected initializer before '-' token
 #define TEMP_ERROR -273.15f
                    ^
C:\Users\yusuf\Arduino\Project\AquaLed-master\Aqualed\Temperature.ino:72:1: note: in expansion of macro 'TEMP_ERROR'
 TEMP_ERROR = 40
 ^~~~~~~~~~
C:\Users\yusuf\Arduino\Project\AquaLed-master\Aqualed\Time.ino: In function 'void readTime()':
Time:30:9: error: 'adjustDST' was not declared in this scope
         adjustDST ();
         ^~~~~~~~~
C:\Users\yusuf\Arduino\Project\AquaLed-master\Aqualed\Time.ino: In function 'void adjustDST()':
Time:47:17: error: 'getMoonPhase' was not declared in this scope
                 getMoonPhase ();
                 ^~~~~~~~~~~~
C:\Users\yusuf\Arduino\Project\AquaLed-master\Aqualed\Time.ino:47:17: note: suggested alternative: 'moonPhase'
                 getMoonPhase ();
                 ^~~~~~~~~~~~
                 moonPhase
exit status 1
'rtcSetup' was not declared in this scope

Random arduino crashes

I'm experiencing random arduino crashes/lockups after ca. 4 years of lamp operation.

Most of the wirings, arduino, pwm controller and rtc modules were replaced. PCB looks mostly good with some oxidation.

Causes - I think related to possible electrical noise caused by hardware age, tough working environment (salt water, moisture) and maybe to aging led drivers:

  1. In function nxTouch() there wasn't check on array lenght when writing. In some situations (noise on serial line) this might result in writing out of array boundaries - fixed, lockups still occur.
  2. There might be a problem with Wire library and potential endless loop in function endTransation (). This issue is well documented, the updated library has a new method setWireTimeout() for avoiding this. Again - this may be the case with noise on i2c lines. Timeout added - in testing.
  3. There might be a problem with OneWire - again electrical - testing on the way.
  4. There is a slight possibility of damaged transistors controlling the relays, and current backflow to gpio - i have to get into that.

Arduino's watchdog doesn't reset the board.

I will publish patches after testing for a few days.

Compile problem

Hello, tanks for sharing your project!
I´m testing it right now, and I´m loving it...
I have a problem when I uncomment the line #define NO_BLUETOOTH for activating the bluetooth module
The arduino IDE return me a few errors ( I´m not a programming expert :P )

My current setup is:

  • lights with 3 channels controlled by pwm
  • 3 temperature sensors DS18B20 (Water, Leds, pwm drivers)
  • 8 relay board for 230V switch, 4 currently in use (Heater, Filter, CO2, Skimmer)

I´m electronic technician , and my programming skills are limited for now, a help is much appreciated !

Thanks in advance!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.