# iAqua Lite: A DIY Full Spectrum Cross-fading Ecoxotic E-Series Light Controller



## 75ona76

Looks like another well done project there! Thanks for sharing.

Now to get through Christmas so I can order some parts. Lol


----------



## shift

Awesomeness. Keep up the fine work!


----------



## jeffkrol

A NOTE OF CAUTION:

You may not get the "exact" parts you buy from some of the Chinese vendors..

I ordered a Serial/USB board for a Typhon and wanted the EXACT one pictured.. Got a completely different albeit "upgrade" board.

Problem was it didn't have the "plug" attached..
Had to buy some to make it work. The "exact' board had the plug pre soldered.

ONLY time this happened but be somewhat aware. I'd send a note w/ purchase "exact board only" if it is critical..

Was it just me or anyone else have a similar experience?


----------



## AnotherHobby

jeffkrol said:


> A NOTE OF CAUTION:
> 
> You may not get the "exact" parts you buy from some of the Chinese vendors..
> 
> I ordered a Serial/USB board for a Typhon and wanted the EXACT one pictured.. Got a completely different albeit "upgrade" board.
> 
> Problem was it didn't have the "plug" attached..
> Had to buy some to make it work. The "exact' board had the plug pre soldered.
> 
> ONLY time this happened but be somewhat aware. I'd send a note w/ purchase "exact board only" if it is critical..
> 
> Was it just me or anyone else have a similar experience?


I think it depends on what you are ordering. I mess around a lot with electronics, and I order a lot of this stuff from China (way more than I care to admit). I've never had these little electronic bits and pieces be different than what I was expecting. But you are absolutely in the right to raise caution. I don't think it's the norm, but it does happen for sure. I think that looking at seller feedback scores can be indicative. Luckily the few China parts for this are dirt chip, but unfortunately if you get the wrong one you'd be waiting for 3 weeks to get the right one. I posted the ones I ordered, so those should be solid.


----------



## Dmarksvr

This actually looks doable  ...Now I really need an ecoxotic e series.

Could this be modified so that instead of a mid day fade it activates a storm event or other dynamic weather setting at a specific time and duration?


----------



## AnotherHobby

Dmarksvr said:


> Could this be modified so that instead of a mid day fade it activates a storm event or other dynamic weather setting at a specific time and duration?


Anything you can do with the remote control can be programmed and automated. The controller just automates the process of hitting buttons on the remote, and sends that out the IR LED. I do have all of the IR codes in the sketch, even though the program doesn't use all of them. So, there is a lot for people to build on.

It is a challenge trying to figure out how to make stuff configurable, automatable, and usable. For instance, you couldn't ever start a storm in the middle of a transition. There is a lot of stuff like that you have to take into account, but it's certainly doable.

As far as building on the existing code, one nice thing about using the Mega is that we have 256 K of flash memory, of which the current program is only using about 1/8 or so. There is plenty of room to add features.


----------



## Fodder

Awesome. I just ordered all the parts. Thanks AnotherHobby!


----------



## jeffkrol

AnotherHobby said:


> I think it depends on what you are ordering. I mess around a lot with electronics, and I order a lot of this stuff from China (way more than I care to admit). I've never had these little electronic bits and pieces be different than what I was expecting. But you are absolutely in the right to raise caution. I don't think it's the norm, but it does happen for sure. I think that looking at seller feedback scores can be indicative. Luckily the few China parts for this are dirt chip, but unfortunately if you get the wrong one you'd be waiting for 3 weeks to get the right one. I posted the ones I ordered, so those should be solid.


bought:









Sent:









JUST different enough to be annoying..


----------



## AlanLe

Can it support 2 e series?


Sent from my iPhone using Tapatalk


----------



## AnotherHobby

AlanLe said:


> Can it support 2 e series?


Yes, as long as they are set up the same. It cannot control them independently... only together.


----------



## robsworld78

Nice job, how many parts did you have to go through to find out what fits?


----------



## kman

Awesome, I'm glad you were able to get this all pulled together!

Now I want an e-series even more. *chuckle* Not worth the hassle to build one for my Sat+, since I already have a controller set up, even though it doesn't have the slick menu and cross-fading capabilities this does. I just need to get my iAqua finished and it won't be needed anyway.

But it's all so slick I almost want one anyway, LOL!


----------



## shift

Now I just need to find where I packed my arduino boards!


----------



## AlanLe

is there a remote control for the unit?


----------



## Dmarksvr

AlanLe said:


> is there a remote control for the unit?


If I understand it correctly, the unit is basically a remote control. Once it is programmed it works as a set, point at light's IR receiver and forget it automated remote control, that runs a 6 phase automated lighting schedual.


----------



## lamiskool

"The hardware would 100% work on the CSP. The code works with minimal modification (I'm using it on one), but far more complicated initial setup. If you don't want the menu system and cross fading, you can use the existing CSP code from the other thread, and just a few tiny changes for the pin numbers and the 1302 RTC. The E-series makes setup 100x easier because of the simple LCD readout of the RGBW values from 0-100. With the CSP it's a guessing game."

U posted this in the other thread.....all of that is mumbo jumbo to me sry lol I have a lot of tanks running off of current led's so this would actually be perfect and cheaper then buying a ton of separate dimmers. Any chance that you could help me get this to work with the current led+ or point me in the right directions on where to find that info...thanks


----------



## AlanLe

Dmarksvr said:


> If I understand it correctly, the unit is basically a remote control. Once it is programmed it works as a set and forget automated remote control that runs a 6 phase automated lighting schedual.


for example there are times that you only want daylight or certain mode. how do you get around?


----------



## lamiskool

AlanLe said:


> for example there are times that you only want daylight or certain mode. how do you get around?


as long as you still have the remote for the led that came with it you can still do it by hand I believe. The way I assume this controller works is at certain times it sends out a signal similar to what the remote sends to change the modes of the light. If you still have the original remote you can change the light to whatever setting you would like


----------



## AlanLe

lamiskool said:


> as long as you still have the remote for the led that came with it you can still do it by hand I believe. The way I assume this controller works is at certain times it sends out a signal similar to what the remote sends to change the modes of the light. If you still have the original remote you can change the light to whatever setting you would like


that will work. I'm assuming that you can have the system completely off after moon light. I just don't want moonlight to remain active the whole time when the system is supposedly "off". looks like this is going to be my Xmas project .


----------



## vlatx

Hi,
Can someone tell me which pins to connect with LED Driver?

Thank you.


----------



## AnotherHobby

AlanLe said:


> that will work. I'm assuming that you can have the system completely off after moon light. I just don't want moonlight to remain active the whole time when the system is supposedly "off". looks like this is going to be my Xmas project .


lamiskool is correct in that this unit is essentially a programmable remote control, and you can still use your existing remote with the light on it's own. All of the configuration on the unit is done using the physical buttons on the LCD, so it doesn't need a remote.

For power, the system is configurable to let moonlight run all night, or to power the light on and off on a schedule. You can also use and external timer to power the light on and off. This is all explained in the user guide. 



vlatx said:


> Can someone tell me which pins to connect with LED Driver?


Are you talking about PWM control of an LED light? It doesn't support anything other than the E-Series as it's currently written. While it would be very easy to modify to use for PWM control of an LED driver, it's not done that way at this time. It would definitely require some physical changes, and I you probably couldn't use the clear enclosure I suggested since you'd need a shield between the LCD and the Mega to get at the PWM pins. Still, it would be quite easy, so if people wanted me to make a universal PWM version of this, I could do it. It'd work very well as a stand alone PWM light controller. The only catch is that as it's programmed it wouldn't work with more than 4 channels. Having more than 4 channels would be more reprogramming than I'm willing to do.



lamiskool said:


> "The hardware would 100% work on the CSP. The code works with minimal modification (I'm using it on one), but far more complicated initial setup. If you don't want the menu system and cross fading, you can use the existing CSP code from the other thread, and just a few tiny changes for the pin numbers and the 1302 RTC. The E-series makes setup 100x easier because of the simple LCD readout of the RGBW values from 0-100. With the CSP it's a guessing game."
> 
> U posted this in the other thread.....all of that is mumbo jumbo to me sry lol I have a lot of tanks running off of current led's so this would actually be perfect and cheaper then buying a ton of separate dimmers. Any chance that you could help me get this to work with the current led+ or point me in the right directions on where to find that info...thanks


I can certainly help with that. I'll explain the mumbo jumbo for you. 

For the crossfading to work correctly, the controller needs to know how many steps *up* from 0 each lighting channel is for all 4 of the memory buttons (so you need to know 16 numbers). The E-Series has 100 possible steps, and it displays what step it is on, so setting it up is easy and exact. The CSP has either 42 or 21 steps, it doesn't tell you want step it is on, and it occasionally misses a step. When using the provided remote, you'll get 21 steps from off to full power, but for some reason these DIY controllers give you 42 steps (I think the remote sends double).

The easiest way to set it up is to first set all 4 of your memory spots to where you'd like them using the remote. Then go through each one of those memory spots and one slow click at a time, count how many clicks it takes to get each channel down to zero. You'll want to do this at least 2 times for each channel for each memory button to confirm that the count is correct and that the light didn't mss a code. If you used the remote to count clicks, you'll need to double your values. So if it took you 10 clicks to get to off, then as far as the controller is concerned that channel is 20 steps up from 0. If you program an Arduino to send the IR and count using that, you'll have 42 steps to consider. Here are the memory settings on my CSP:

Daylight: R=42, G=0, B=0, W=42
M2: R=42, G=8, B=00, W=3
M1: R=28, G=12, B=02, W=0
Moon: R=2, G=1, B=01, W=0

Once you actually have all 16 values figured out, then editing the code is easy. Simply replace the IR codes in this sketch with the codes from the CSP, and it should work the same (except "Daylight" and "Moon" will be M3 and M4 for the CSP).

Does that make sense?


----------



## lamiskool

Thanks a lot for the explanation! Ill order the parts and once I have it up and running ill let you know if I run into any problems (i probably will lol)


----------



## vlatx

Thank you for answer and explanation AnotherHobby.
Yes , I thought the PWM control LED driver . I hope there will be more interested in the version with PWM control.
I still follow this interesting topic .


----------



## Dmarksvr

I don't know if the codes on the sunsetter generic ramp timer are the same as they are for the currentusa ramp timers, or how the setup would differ from the E-series, but if we get the IR codes for the sunsetter and currentusa ramptimers (and also the codes for fluval ramp timers and aquasky coming out) This could be made to work with some of the Beamsworks, new fluval, sat+ pro and all the diy flexible strips or other lights with the right DC connections. *...Couldn't it?*

Could be immensely useful to a crap ton of people, and much more doable for most then the other arduino builds have been. Seriously someone needs to get all the codes for that stuff and make a commercial product. Like a universal TV controller, but for aquarium and vivarium lights... Preferably the guy who created it 

Oh one other question just to make sure I understand what this does...
It does let the dawn/dusk dimming occur right? I mean it doesn't just come on full blast, harshly switch to another color setting, then harshly switch to moon then off right? ....They are smooth transitions?


----------



## AnotherHobby

Dmarksvr said:


> I don't know if the codes on the sunsetter generic ramp timer are the same as they are for the currentusa ramp timers, or how the setup would differ from the E-series, but if we get the IR codes for the sunsetter and currentusa ramptimers (and also the codes for fluval ramp timers and aquasky coming out) This could be made to work with some of the Beamsworks, new fluval, sat+ pro and all the diy flexible strips or other lights with the right DC connections. *...Couldn't it?*


The hardware will work with any IR controllable device. You could run your home theater with it if you wrote the code. The code should work with any IR controlled 4 channel light that has 4 memory positions/keys by just using different IR codes. If it's not 4 channel or doesn't have 4 memory spots you'd have to do some rewriting. 



> Could be immensely useful to a crap ton of people, and much more doable for most then the other arduino builds have been. Seriously someone needs to get all the codes for that stuff and make a commercial product. Like a universal TV controller, but for aquarium and vivarium lights... Preferably the guy who created it


Getting the codes is insanely easy. You only need 1 more part (the IR receiver), with no soldering, and a tiny block of code I have. I'll post instructions on it when I get back from vacation. 



> Oh one other question just to make sure I understand what this does...
> It does let the dawn/dusk dimming occur right? I mean it doesn't just come on full blast, harshly switch to another color setting, then harshly switch to moon then off right? ....They are smooth transitions?



Yes, it's doing very smooth cross fades all of the time, and not any sharp switches. Most of the increments are not even perceivable. A few are noticeable though (like when white goes from 1 to 0 or from 0 to 1).


----------



## kzeller

So correct me if I'm wrong. This week only work on an RGBW led not standard led fixtures correct?


----------



## mlongpre dxYh

vlatx said:


> Thank you for answer and explanation AnotherHobby.
> Yes , I thought the PWM control LED driver . I hope there will be more interested in the version with PWM control.
> I still follow this interesting topic .



Interested in this as well!


----------



## kzeller

But will it work on all full spectrums or just the Ecoxotic?


----------



## AnotherHobby

kzeller said:


> So correct me if I'm wrong. This week only work on an RGBW led not standard led fixtures correct?





kzeller said:


> But will it work on all full spectrums or just the Ecoxotic?


See my post from immediately above yours:



AnotherHobby said:


> The hardware will work with any IR controllable device. You could run your home theater with it if you wrote the code. The code should work with any IR controlled 4 channel light that has 4 memory positions/keys by just using different IR codes. If it's not 4 channel or doesn't have 4 memory spots you'd have to do some rewriting.


So what specific light are you trying to control?


----------



## kzeller

Most of mine are BML. I have a few that are lower end led aswell.


----------



## Fodder

I've assembled mine but have run into a problem with the last line of instructions. When I attempt to upload the iAqua software I get a COM1 error...










When I go to the Tools menu the Serial Port option is ghosted out.












I'm not a 'software guy' and this is my first attempt at a micro-controller, so in layman's terms, what do I do next?


----------



## mistergreen

It means your didn't plug your arduino into the usb or it can't recognize the arduino. Try another port.

I have a feeling you didn't install the drivers.
Follow these steps

http://arduino.cc/en/guide/windows


----------



## Fodder

mistergreen said:


> I have a feeling you didn't install the drivers.
> Follow these steps
> 
> http://arduino.cc/en/guide/windows


That was what I needed. Thank you!


----------



## Fodder

I've been playing with this a little. I haven't programmed it fully, but I've noticed a couple things:

1) If I remove power from the device and plug it back in, it forgets ALL settings and returns back to a reset state. I can probably get around this by powering it with a USB battery pack... http://www.amazon.com/RAVPower-15000mAh-External-Compatibility-Lightning/dp/B00MQSMEEE/ref=sr_1_5?ie=UTF8&qid=1421545185&sr=8-5&keywords=usb+battery+charger

But it occurred to me that perhaps I'm missing something, since it would make the SmartStartup useless. It also makes me question why there would be a need for a battery in the RTC. So, my question is, is it supposed to loose all settings when there is a power interruption?

2) I've been able to program any setting I've attempted to. Its very intuitive and easy. But there is one parameter that I simply can't set... the date. I can make the adjustments but as soon as the select button is pressed the date immediately reverts back to 1/1/1970 (if I set the time before I set the date it always reverts back to 1/1/2066). I've tried multiple times and haven't been able to overcome this. Although it's not a showstopper since an incorrect date has no real impact. I just thought I'd mention it.


----------



## Notorious93

I wanted to build one of these soon. I had one question though. Is there a way to make this thing self adjust sunrise/sunset times according to real sunrise/sunset times? Or close to it. I'm pretty sure its possible as I just bought a cheap digital timer for my co2 and once you set sunrise/sunset it self adjust throughout the year according to your region. I'm betting its not 100% accurate but would at least be within a couple of minutes so it sounds like a simple few lines of code


----------



## kman

For this controller, you set the TIME you want it to change modes. You would need to regularly revise that setting, manually, if you want to keep track with the real sunrise/sunset.


----------



## Notorious93

kman said:


> For this controller, you set the TIME you want it to change modes. You would need to regularly revise that setting, manually, if you want to keep track with the real sunrise/sunset.


I was asking if there was a way to automate that though. If my dumb little digital timer can do that I don't see how it'd be that hard. I haven't even looked at the scripting but depending on the language that's seriously only a handful of lines to automate that. If no one wants to take that on I may just write it in myself whenever I put one together


----------



## kman

Notorious93 said:


> I was asking if there was a way to automate that though. If my dumb little digital timer can do that I don't see how it'd be that hard. I haven't even looked at the scripting but depending on the language that's seriously only a handful of lines to automate that. If no one wants to take that on I may just write it in myself whenever I put one together


There are occasional discussions (including links to match outdoor weather), but I don't recall seeing anyone who actually implemented such a thing.

If there is a mathemathic way to track the sunrise/sunset throughout the year, perhaps that could be done (although bear in mind the limited memory of Arduinos, which can complicate something that would be easy on a real computer), but it's definitely not currently part of this project. Most discussions of live tracking involve internet-connected Arduinos so live data can be accessed for daily adjustments, but these projects are fully offline.


----------



## robsworld78

The "timelord" library will do this and more, here's a link to an example. There's a link on this page to download the library.

http://paulorenato.com/joomla/index.php?option=com_content&view=article&id=125:arduino-astronomical-clock-for-automatic-light-control&catid=4rojects&Itemid=4


----------



## Notorious93

robsworld78 said:


> The "timelord" library will do this and more, here's a link to an example. There's a link on this page to download the library.
> 
> http://paulorenato.com/joomla/index...ight-control&catid=4[emoji14]rojects&Itemid=4


That's even better because its already done....you guys should implement that asap.


----------



## robsworld78

Chop, chop get to it! :hihi:


----------



## mistergreen

I have a formula for predicting moon phases based on the date too.


----------



## robsworld78

I bet I have the same formula as you.  It's quite the formula, I updated the one floating around the net to have 30 phases and 30 images.


----------



## mistergreen

robsworld78 said:


> I bet I have the same formula as you.  It's quite the formula, I updated the one floating around the net to have 30 phases and 30 images.


Have you implemented it into your moonlighting?

I'll have to figure out how to integrate these natural phenomena into my setup.


----------



## robsworld78

Yeah, I have that working, when its in moonlight mode it will set brightness to correct level, however there's no setting for location, I wasn't sure how to add that without the timelord library. That library wasn't compatible with the RTC library in iAqua and at the time I felt it would be to much work to change the library over as I didn't have a clue what I was doing. Now that I'm getting some of this I might just do that. If you want I can post what I have in your thread.


----------



## mistergreen

Yeah, let's see the code. I think I have a way for this to work with my setup.


----------



## scaLLas

Does anyone have an iAqua lite setup using PWM?
I am trying to program it to also use the timelord libraries to get the sunrise/sunset every day. 
This is done but still need to test it. 
Also not sure if its the most eloquent way [emoji4][emoji4]



Sent from my iPhone using Tapatalk


----------



## AnotherHobby

Sorry I have been absent from the thread everybody! 



Fodder said:


> I've been playing with this a little. I haven't programmed it fully, but I've noticed a couple things:
> 
> 1) If I remove power from the device and plug it back in, it forgets ALL settings and returns back to a reset state. I can probably get around this by powering it with a USB battery pack... http://www.amazon.com/RAVPower-15000mAh-External-Compatibility-Lightning/dp/B00MQSMEEE/ref=sr_1_5?ie=UTF8&qid=1421545185&sr=8-5&keywords=usb+battery+charger
> 
> But it occurred to me that perhaps I'm missing something, since it would make the SmartStartup useless. It also makes me question why there would be a need for a battery in the RTC. So, my question is, is it supposed to loose all settings when there is a power interruption?


This makes no sense to me. All of the settings are written directly to EEPROM on the Mega as you change them. No battery is required to save the settings, only to keep clock time and date when you reboot or lose power. I absolutely know for certain that the code as posted does this, and does it correctly, so I'm not even sure where to start?



Fodder said:


> 2) I've been able to program any setting I've attempted to. Its very intuitive and easy. But there is one parameter that I simply can't set... the date. I can make the adjustments but as soon as the select button is pressed the date immediately reverts back to 1/1/1970 (if I set the time before I set the date it always reverts back to 1/1/2066). I've tried multiple times and haven't been able to overcome this. Although it's not a showstopper since an incorrect date has no real impact. I just thought I'd mention it.


I'll play around with setting the date on mine and see if I can reproduce it. I'll pull the battery to zero it out. I'll let you know what I find.



scaLLas said:


> Does anyone have an iAqua lite setup using PWM?


To use PWM would actually be pretty easy. I have all of the code for that in my main iAqua program. If you go to that thread and download the code, search through it for the "lightCSP" variable. The PWM code will all be along with that variable, and it should be pretty easy to copy it over into this. You'll also need to change the up/down button actions for editing the lighting values to go all the way up to 255. Right now they go to 100 and then immediately wrap around to 0.


----------



## scaLLas

AnotherHobby said:


> Sorry I have been absent from the thread everybody!
> 
> 
> 
> 
> 
> 
> 
> This makes no sense to me. All of the settings are written directly to EEPROM on the Mega as you change them. No battery is required to save the settings, only to keep clock time and date when you reboot or lose power. I absolutely know for certain that the code as posted does this, and does it correctly, so I'm not even sure where to start?
> 
> 
> 
> 
> 
> 
> 
> I'll play around with setting the date on mine and see if I can reproduce it. I'll pull the battery to zero it out. I'll let you know what I find.
> 
> 
> 
> 
> 
> 
> 
> To use PWM would actually be pretty easy. I have all of the code for that in my main iAqua program. If you go to that thread and download the code, search through it for the "lightCSP" variable. The PWM code will all be along with that variable, and it should be pretty easy to copy it over into this. You'll also need to change the up/down button actions for editing the lighting values to go all the way up to 255. Right now they go to 100 and then immediately wrap around to 0.



I have managed to program the PWM using timers3 and 4
Works pretty smooth but not sure how much resources it uses. When it starts a fade it becomes difficult to still navigate the menu. 

I have also integrated the Timelord library to automatically adjust a sunrise and sunset value at the end of fade6 (low sun to moon) and it then adjusts the next day's schedule to reflect this new value (of sunrise and sunset). Although this is not necessary it is keeping me busy!!



Sent from my iPhone using Tapatalk


----------



## kman

AnotherHobby said:


> *Parts and Cost!*
> 
> <snip>
> 
> *A very specific DS1302 RTC board (to keep time)*
> - This *exact* RTC board was selected because it will fit in the case and it can run on ANY pins you choose. You can use other RTC chips, but you will either have to solder, or it won’t fit in the case. There are several varieties of DS1302 boards, some with slightly different pin layouts, and some with bigger batteries. It has to be the same exact one pictured in this post.
> - Good news is that it’s cheap.
> - Bad news is that it’s only available from China, check out evilBay item 371208561894 for $3.67
> - This site claims faster shipping for only $1.88, but I’ve never ordered from there.
> - It must look EXACTLY like the pictures below:


FWIW, if anyone is assembling parts for one of these, it would appear the original EvilBay listing that AH suggested has been pulled by the seller (I think they're out).

I believe I have found an alternate source (although no promises), at item # 371236736088.

I hope this is helpful for someone..  (and that it's the right part! ... although it looks correct)


----------



## saiko

quick question as I have the experts on one page here.

Is there a stark visual(perception) difference in using a 4bit PWM against 8/16bit PWM dimming- suppose I want to do a 0-100 over a 15min interval?


----------



## robsworld78

I'm no expert but this is how I see it. You will likely see jumps when the dimming gets to the lower values using 8bit but depends on how bright your LED is. 8bit has 255 steps, 12bit has 4095 steps. I'm not sure how many 4bit or 16bits have. Think of it this way.

If your LED was putting out a 1000 lumens and you have 8 bit that would be 3.92 lumens per step. If you have 12 bit that would be .24 lumens per step. When the lights are bright our eyes won't see the difference with a few lumens but when you get dim you'll notice the missing 4 lumens. With 12bit it can go much dimmer before you start to notice it but when you get low enough you will still notice it. I'm running 12-bit and the last minute I really see the fading, still smooth because the increments are small but appears it sped up because its dim and I can notice it. I have 9w LED's and 8-bit was very jumpy at the low end.

The LED's make a big difference. If you have 1w LED's it won't be that bad but if you have 10w LED's it will be like turning the light on or off, you'll notice it. The time isn't as big of a factor when you get over 10 minutes, its the amount of steps you have and how bright the LED is.


----------



## kman

^^ I don't have any skin in this game, but just pondering: Could the dimming functions be put on a curve, to somewhat compensate for that effect, and slow down as values get close to 0?


----------



## mistergreen

kman said:


> ^^ I don't have any skin in this game, but just pondering: Could the dimming functions be put on a curve, to somewhat compensate for that effect, and slow down as values get close to 0?


The curve would still depend on bit rate for smooth transitions. You can't get around it. The bigger the bit-rate the smoother. Think of it like video game resolution. Remember the 8-bit graphic? whether a diagonal line or a curve, it's still chunky.


----------



## kman

mistergreen said:


> The curve would still depend on bit rate for smooth transitions. You can't get around it. The bigger the bit-rate the smoother. Think of it like video game resolution. Remember the 8-bit graphic? whether a diagonal line or a curve, it's still chunky.


Yes, there's no getting around those final few abrupt transitions, I'm just thinking they would at least be spaced out farther if there was a slight curve applied at the end.


----------



## pseudomonas

I love these instructions- they look very easy to follow for someone without much electronics experience.

I am wondering if anyone has tried using this with a sat+ light? I feel like it should be as simple as just different codes being sent to the light but perhaps not.


----------



## kman

I'm going to try it just for kicks. I'm just waiting on the last couple of parts to get here from China and then I'll be building one. I have an E-Series as well as some Sat+ lights so I should be able to test it all out.


----------



## pseudomonas

Awesome. The sat+ lights are so interesting to me- that current baked in all these sweet features (I mean, I would never have though of having a thunderstorm but now that I know it can be done... I must have it!) but without a way to automate them it feels incomplete. And the ramp timers obviously are not a real solution.

Please let me know what you come up with and post your sketch if you are able to modify it to work with the sat+.


----------



## lamiskool

curious...would anyone who is planning on making this want to buy twice the amount of each stuff and build two, id then buy the completed controller from you for price of parts+labor. will also pay more if you can program it for current led sat+!


----------



## saiko

robsworld78 said:


> I'm no expert but this is how I see it. You will likely see jumps when the dimming gets to the lower values using 8bit but depends on how bright your LED is. 8bit has 255 steps, 12bit has 4095 steps. I'm not sure how many 4bit or 16bits have. Think of it this way.
> 
> If your LED was putting out a 1000 lumens and you have 8 bit that would be 3.92 lumens per step. If you have 12 bit that would be .24 lumens per step. When the lights are bright our eyes won't see the difference with a few lumens but when you get dim you'll notice the missing 4 lumens. With 12bit it can go much dimmer before you start to notice it but when you get low enough you will still notice it. I'm running 12-bit and the last minute I really see the fading, still smooth because the increments are small but appears it sped up because its dim and I can notice it. I have 9w LED's and 8-bit was very jumpy at the low end.
> 
> The LED's make a big difference. If you have 1w LED's it won't be that bad but if you have 10w LED's it will be like turning the light on or off, you'll notice it. The time isn't as big of a factor when you get over 10 minutes, its the amount of steps you have and how bright the LED is.


Thanks a bunch Rob! So it does make a difference. Will try the 12bit way then.


----------



## kman

AnotherHobby said:


> Fodder said:
> 
> 
> 
> I've been playing with this a little. I haven't programmed it fully, but I've noticed a couple things:
> 
> 1) If I remove power from the device and plug it back in, it forgets ALL settings and returns back to a reset state. I can probably get around this by powering it with a USB battery pack... http://www.amazon.com/RAVPower-1500...421545185&sr=8-5&keywords=usb+battery+charger
> 
> But it occurred to me that perhaps I'm missing something, since it would make the SmartStartup useless. It also makes me question why there would be a need for a battery in the RTC. So, my question is, is it supposed to loose all settings when there is a power interruption?
> 
> 
> 
> This makes no sense to me. All of the settings are written directly to EEPROM on the Mega as you change them. No battery is required to save the settings, only to keep clock time and date when you reboot or lose power. I absolutely know for certain that the code as posted does this, and does it correctly, so I'm not even sure where to start?
Click to expand...




AnotherHobby said:


> Fodder said:
> 
> 
> 
> 2) I've been able to program any setting I've attempted to. Its very intuitive and easy. But there is one parameter that I simply can't set... the date. I can make the adjustments but as soon as the select button is pressed the date immediately reverts back to 1/1/1970 (if I set the time before I set the date it always reverts back to 1/1/2066). I've tried multiple times and haven't been able to overcome this. Although it's not a showstopper since an incorrect date has no real impact. I just thought I'd mention it.
> 
> 
> 
> I'll play around with setting the date on mine and see if I can reproduce it. I'll pull the battery to zero it out. I'll let you know what I find.
Click to expand...

Hey Fodder, did you ever work this issue out with AH?

I FINALLY got the last piece in today (the RTC) and assembled my iAqua Lite. (Well, except the box hasn't arrived yet, but I can use it nekkid for a while during testing) And I'm having the many of the same issues you listed, plus some others.

1) Time settings are lost any time power is lost (read: unplug power cable or USB). They seem to be retained if I just hit the reset button.

2) Setting the date is a no-go. On mine, it boots up at 1/1/2066, and as soon as I change it to anything and press select, it goes right back to 1/1/2066. (interestingly, I have not ever seen it go to 1/1/70) Hitting reset, on the other hand, brings me to 1/1/2007. (wtf?)

3) One small issue I've noted is the arrows to the right usually appear scrambled when the Arduino first powers up. They stay scrambled (gibberish letters/random dots) unless I re-power the board via the reset button, then they come up normally as arrows. Similar distorted characters showed in Fade schedules, too, which also are fixed by restarting via the reset button.

4) I can't seem to set the power settings to what I want:
Light on: 4:45pm Light off: 1:00am

The problem is I can't get the Off setting to AM. It remains stuck on PM, whether I'm cycling the hours up or down, or the minutes up or down. Even more oddly, if I set the Off time to 11:59pm (the latest I can set it, which would work if it had to), go back to the main screen, and back in, it's the same. BUT if I hit the reset button to reboot the Arduino, and go back into that on/off settings, it resets the Off time 12:00pm.

EDIT: Ok, well, I've found one problem. The battery my RTC shipped with is apparently completely dead, so that explains some of the issues. It should be 3v and I'm getting nothing out of it, according to my multimeter. I tested a CR2016 I had laying around and got 3v no problem, so I know my meter is working. I guess I'll need to order some of these little CR1220s because that should be here a LOT faster than ordering another RTC. :/

EDIT2: Since this popped up in iAqua, is there any possible issue with the TimeAlarms library, and the max number of alarms? Mine is set to 30 (dtNBR_ALARMS 30) for use with iAqua. I note in the library AH included with iAqua Lite, the max alarms is set to 8. Do 30 alarms use too much memory, possibly, in this application? (and what on earth do people do about switching back and forth with projects that use the same libraries in different ways?)


----------



## Fodder

kman said:


> Hey Fodder, did you ever work this issue out with AH?


I have not pursued it any further. I've been drowned in work and other projects so it has been at the bottom of the list for a while now. Interesting what you found with the battery. Guess I need to test mine. Thanks for the tip.


----------



## scaLLas

There is a problem in the code with saving the power schedule. Mine was saving the wrong values. Look in updatepowershedule(). Not at conputer now. Will look later and give you more precise answer


Sent from my iPhone using Tapatalk


----------



## kman

scaLLas said:


> There is a problem in the code with saving the power schedule. Mine was saving the wrong values. Look in updatepowershedule(). Not at conputer now. Will look later and give you more precise answer


That would be great! I'm sure others would also benefit if you've squished a bug in the code. 

Currently that section of the stock code looks ok to me, but I barely know what I'm looking at and wouldn't know a syntax error unless it was a glaring typo.



Code:


void updatePowerSchedule() // called when the users saves the power schedule
{
  EEPROM.write(101, lightPowerT.onHour);
  EEPROM.write(102, lightPowerT.onMinute);
  EEPROM.write(103, lightPowerT.offHour);
  EEPROM.write(104, lightPowerT.offMinute);
  loadPowerSchedule(); // activates the new schedule
}


void loadPowerSchedule()
{

  lightPower.onHour = EEPROM.read(101); //load the schedule from EEPROM
  // if value is out of scope (first startup or not set), set it to 0
  if (lightPower.onHour > 23) {
    lightPower.onHour = 0;
    EEPROM.write(101, lightPower.onHour);
  }

  lightPower.onMinute = EEPROM.read(102); //load the schedule from EEPROM
  // if value is out of scope (first startup or not set), set it to 0
  if (lightPower.onMinute > 59) {
    lightPower.onMinute = 0;
    EEPROM.write(102, lightPower.onMinute);
  }

  lightPower.offHour = EEPROM.read(103); //load the schedule from EEPROM
  // if value is out of scope (first startup or not set), set it to 0
  if (lightPower.offHour > 23) {
    lightPower.offHour = 0;
    EEPROM.write(103, lightPower.offHour);
  }

  lightPower.offHour = EEPROM.read(104); //load the schedule from EEPROM
  // if value is out of scope (first startup or not set), set it to 0
  if (lightPower.offMinute > 59) {
    lightPower.offMinute = 0;
    EEPROM.write(104, lightPower.offMinute);
  }

  // remove alarms first if they already exist, this would be if a user modifies the schedule
  if (lightPowerOnAlarmID != NULL) Alarm.free(lightPowerOnAlarmID);
  if (lightPowerOffAlarmID != NULL) Alarm.free(lightPowerOffAlarmID);

  if ((lightPower.onHour==lightPower.offHour)&&(lightPower.onMinute==lightPower.offMinute)) {
    // nothing happens here because...
    // we do NOT load the power schedules if the on/off times are set the same
    // this effectively allows the user to not power the lights on/off
  }
  else {

    // alarm to turn the lights on
    lightPowerOnAlarmID = Alarm.alarmRepeat(lightPower.onHour,lightPower.onMinute,0, AlarmLightPower);

    // alarm to turn the lights off
    lightPowerOffAlarmID = Alarm.alarmRepeat(lightPower.offHour,lightPower.offMinute,0, AlarmLightPower);

  }
}

Except now that I look at it...

In the beginning, it seems to be writing to:
lightPowerT.onHour (note the "T" before the period)

But then then the void loads it, it's looking at:
lightPower.onHour (notice the lack of a "T")

Is that correct, or is it something else?

Edit: Nope, lightPowerT is a genuine variable, it's used for temporarily storing values while editing, I guess. Still, not sure if it's what is supposed to be used there or the other one.


----------



## scaLLas

@kman. Thats the correct code. Mine had lightPowerT.duration or something instead of lightPowerT.offHour. So it never saves the correct value in the EEPROM. 


Sent from my iPhone using Tapatalk


----------



## scaLLas

So for everyone struggling with the powerschedule:
The following code is in the drawscreen() fuction (about line 1617 in original code)



Code:


  else if (menu.getCurrent().getName() == "LIGHT ON / OFF") {

    editingAvailable=true;

    // for editing fades, we use fadeT to temporarily hold the edited values, this way we don't lose the original values
    // here we set them to the appropriate fade values to be sent to the screen
    if (editingActive==false) { 
      lightPowerT.onHour=lightPower.onHour;
      lightPowerT.onMinute=lightPower.onMinute;
      lightPowerT.durationHours=lightPower.offHour;
      lightPowerT.durationMinutes=lightPower.offMinute;
    }

    // if we are editing, we draw the cursor so the user knows we are editing
    drawLightSchedule(lightPowerT.onHour, lightPowerT.onMinute, lightPowerT.offHour, lightPowerT.offMinute);

    // if we are editing, we need to place the cursor in the correct spot
    // at the same time we set the edit field
    if (editingActive == true) {
      if (EDIT_FIELD==EDIT_L_ONHOUR) lcd.setCursor(1,1);
      else if (EDIT_FIELD==EDIT_L_ONMINUTE) lcd.setCursor(4,1);
      else if (EDIT_FIELD==EDIT_L_OFFHOUR) lcd.setCursor(10,1);
      else if (EDIT_FIELD==EDIT_L_OFFMINUTE) lcd.setCursor(13,1);
      lcd.cursor(); 
    }
    else lcd.noCursor(); 
  }

the highlighted "durationHours" and "durationMinutes" should be changed to offHour and offMinute respectively.
This would then display the power schedule correctly.

The rest of the code was correct in that it does save the correct values to EEPROM. It was just displaying the incorrect values.

Hope it helps!
scaLLas


----------



## kman

^^ That didn't work for me.



Code:


    if (editingActive==false) { 
      lightPowerT.onHour=lightPower.onHour;
      lightPowerT.onMinute=lightPower.onMinute;
      lightPowerT.durationHours=lightPower.offHour;   //bad code?
      lightPowerT.durationMinutes=lightPower.offMinute;  //bad code?
      //lightPowerT.offHour=lightPower.offHour;   //corrected code?
      //lightPowerT.offMinute=lightPower.offMinute;    //corrected code?

Swapping in your corrected code makes things go very strange. I get invalid numbers in the hour field (for off), and some crazy characters initially until I hit the reset button. Restoring the original (for me) lines fixed things. Well, fixed them back to where they were.

My Power Schedule's Off time doesn't wrap AM and PM like the On time does. It's always stuck at PM. That's my only issue with the actual power schedule. (then I think it resets every value I try to add back to 12:00pm)


----------



## scaLLas

What happens after you reset? Can you changes the values for the off time?


Sent from my iPhone using Tapatalk


----------



## scaLLas

The correct code is definitely the .offHour and .offMinute part as durationHours and durationMinutes have nothing to do with power schedules
Also look a little further down to


Code:


    // if we are editing, we draw the cursor so the user knows we are editing
    drawLightSchedule(lightPowerT.onHour, lightPowerT.onMinute, lightPowerT.offHour, lightPowerT.offMinute);

This is where the schedule is displayed and it uses the correct values.


----------



## kman

scaLLas said:


> What happens after you reset? Can you changes the values for the off time?


I could always change the values, just not to anything AM because it's stuck on PM.

I reset multiple times with your change in place, and no bueno. :confused1:

I just swapped the comment tags and tried it again, same result. Gibberish on the screen until I did a long power off (full disconnect) restart. Then going into the power menu show me 4:45pm for on (correct) and 38:00 for Off (obviously incorrect). Set it to 11:50pm (which worked previously, even though it's not what I wanted), hit enter, and BAM, right back to 38:00.

A second long unplug and I'm back to gibberish. Reset button and I finally have the main menu again. (note: the "smart start" always seems to work fine, just gibberish when the main menu loads) But power menu still shows 38:00pm for off.

Flipping the commented lines to restore the original code, and I still get gibberish for a couple of tries, then things are back to normal. Still no AM available on the Off time, but at least the times are normal. Setting off to 11:55pm sticks until I restart, then it's magically back to 12pm. I think something is getting written wrong to eeprom so the code automatically resets it to default value. I'm at a loss as to the am/pm issue. Or how to fix the other issue.


----------



## scaLLas

Hey kMan
found another problem look around line 596 in void loadPowerSchedule()


Code:


  lightPower.offHour = EEPROM.read(103); //load the schedule from EEPROM
  // if value is out of scope (first startup or not set), set it to 0
  if (lightPower.offHour > 23) {
    lightPower.offHour = 0;
    EEPROM.write(103, lightPower.offHour);
  }

  lightPower.offHour = EEPROM.read(104); //load the schedule from EEPROM
  // if value is out of scope (first startup or not set), set it to 0
  if (lightPower.offMinute > 59) {
    lightPower.offMinute = 0;
    EEPROM.write(104, lightPower.offMinute);
  }

the one in green is correct. The one in red needs to be offMinute. The minutes are stored in EEPROM location 104. not the off hours.


----------



## kman

I think you're right with that change. I'm not sure what it fixes, though. No change in functionality for me, though. :/


----------



## scaLLas

It was loading the offMinutes into the hour variable which would then display the minutes in the hour value. Hence the wrong or even gibberish value in the off schedule. After I changed all of the above it worked fine. 


Sent from my iPhone using Tapatalk

Bump: 


Code:


lightPowerT.durationHours=lightPower.offHour;
      lightPowerT.durationMinutes=lightPower.offMinute;

these values are never initialized so it can be anything! Will have to be changed in order to display the correct values


----------



## kman

I made your change (just the last one), but still no bueno. Do BOTH changes need to be made (this and your original) to fix everything?

I did a quick video to show what I'm experiencing. The only change to AH's stock code, at the moment, is this last one (offHour to offMinute).






Starts up fine, although you can see the clock is always 1/1/2066 at 12:00am, because there is no battery in my RTC. Also up/down arrows are often scrambled, although menus work regardless.

After going to Power Schedule, and the Light Off time, I demonstrate the AM/PM rollover does not happen. Then set to 11:50pm Off time, and I go back to main menu and restart with reset switch. Multiple times. You'll see the gibberish screens I mentioned. Then it works! Except look at Off menu, still defaulted back to 12:00pm! ARGH!

Could it be bad hardware? I don't know which part, though. I have another Mega, perhaps I'll try that to see if there is a difference. I have a spare RTC on the way, (and fresh batteries!) but it will be a while before the RTC gets here, and I have no spare LCD.


----------



## scaLLas

Now THAT is weird!! 

Would you mind posting the file you are using?
I'll see if I can spot something...

It does seem to be saving the correct value whilst the program is running. Why it would startup different when you reset is .. well wrong !!
:hihi: :hihi:


----------



## kman

scaLLas said:


> Now THAT is weird!!
> 
> Would you mind posting the file you are using?
> I'll see if I can spot something...
> 
> It does seem to be saving the correct value whilst the program is running. Why it would startup different when you reset is .. well wrong !!
> :hihi: :hihi:


Unfortunately the code is too long to paste into a text field here on TPT.

I'm going to wipe the slate, first, and copy the original unaltered file from AH's zip file (in post #1). I'll make the one change of offHour to offMinute since seems certainly to be a genuine error in the original. And then I'll test it one more time.

EDIT: NOPE. No difference. Using AH's stock code, directly from the Zip file I downloaded on page 1. I made the one change indicated above, and uploaded. Exact same behavior as what's in the video, even the gibberish screens. No am/pm rollover, and Light Off settings won't stick.

Other than bad hardware, the ONLY thing I can think of is differences in the various library files? I've been messing with various Arduino projects (mostly the Sat+ controller and AH's full iAqua product), so maybe one of those libraries has something different in that is causing an issue? I'm not sure how to address that, however, without nuking all the files I need for the other projects.


----------



## scaLLas

if you haven't changed the libraries (as in editing the *.cpp file) that should not make a difference,
maybe check for some loose wires? Try taking the RTC module out?
Not sure what would be the cause of the gibberish!
You will have to make BOTH the changes above though to get the power schedule to display correctly.

Bump: try switch to a 24hr clock


----------



## kman

Other than the TimeAlarm change, no, I haven't altered any of the libraries.

I made both of the changes now. The gibberish issue is still present, but it does go away after restarting a few times. I'll check for loose wires and swap some hardware around.

Switching to 24 hour clock did solve the AM/PM issue. I verified that it keeps the correct (1am) off time even after restarting. I have to think there is bug in that code somewhere, although I'm not sure why it's not affecting more people. OTOH, I wonder how many people are actually using these? Interestingly, though, if I change it back to 12 hour time, it once again changes the Off time to 1:00 pm. But that may be a display bug? Because restarting, and switching the clock back to 24 hour display, and the Off time is again correct at 1:00 (am, on a 24 hour clock, so no am displayed).

Still can't set the date, though, not that that is especially critical since there are no date-triggered events. Can you set the date on yours?


----------



## scaLLas

No haven't tried it. As you said its not that critical


Sent from my iPhone using Tapatalk


----------



## kman

So, it's starting to look like I had a bad Arduino, oddly enough.

I finally got new batteries in, as well as a brand new RTC. (the new RTC had a battery that was fine, so I guess I was just unlucky with that first one)

I swapped in the new RTC and the old Arduino still had issues. I moved the LCD and IR LED over to the a spare Mega I have, with the new RTC, and everything seems to be working fine. Oddly, restarting still sometimes shows scrambled characters, but another restart seemed to clear it up. I may buy another LCD to just see. And who knows, maybe I'll throw together a second controller with all the spare parts and sell it to someone, if it all works. 

But now that I have what appears to be a functional iAqua Lite, except for the date, which will NOT set, I'll pull out a light and see what how it all works.


----------



## kman

So, out of curiosity:

Please chime in if you're using the iAqua Lite. *Is ANYONE out there other than scaLLas and I building this?*

I'm curious if anyone has managed to successfully use the stock code, or what changes have been made. If you're substantially modifying it to be more ambitious and control via PWM, etc., I guess it doesn't apply, but I'm really curious to know if _anyone_ has managed to make the stock code as perfectly as it seems to be in the OP. Just trying to see if there are genuinely a few minor errors, or if there's something really wrong with my setup.


----------



## pseudomonas

I want to build it but I'm waiting for your sat+ code!


----------



## kman

Still testing...


----------



## Dmarksvr

:help: Could someone who has done one of these cross faders for Ecoxotic post a vid of it working? ...Perhaps timelapse? ...So we can get a feel for how cool it is before we jump in? :help:

:iamwithst


----------



## Fodder

kman said:


> Please chime in if you're using the iAqua Lite. *Is ANYONE out there other than scaLLas and I building this?*


As you know, I've built one and have been unsuccessful as I described earlier. I haven't had any desire to spend the time to program it just to have it dump everything when I unplug it. 

Honestly, I'd rather it worked differently. I'm not the kind of person that would monkey with it once it was set up the first time. So, I'd rather the variables (times, color values, etc) be at the top of the code so they were embedded in the code itself. The only thing I would care about setting on the controller is the actual time. 

I guess my point/question is, couldn't the code be shortened up and simplified doing it this way?


----------



## kman

Fodder said:


> As you know, I've built one and have been unsuccessful as I described earlier. I haven't had any desire to spend the time to program it just to have it dump everything when I unplug it.
> 
> Honestly, I'd rather it worked differently. I'm not the kind of person that would monkey with it once it was set up the first time. So, I'd rather the variables (times, color values, etc) be at the top of the code so they were embedded in the code itself. The only thing I would care about setting on the controller is the actual time.
> 
> I guess my point/question is, couldn't the code be shortened up and simplified doing it this way?


Not without a massive rewrite. The whole point to this version was NO programming, and the ability to enter everything via pushbutton. It's pretty handy even if you are capable of entering it into the code. Once everything is 100% dialed in I doubt I'll touch those buttons for a long time (still have to correct the time for daylight savings twice a year), but when I do, it's way more convenient to push some buttons than pull the whole thing out, reconnect it to a computer, tweak the settings, and re-upload everything again.

I built mine, and it seems to be working except for two issues:

1) the random character scrambling (see the video I posted several posts back). I'm convinced this is hardware-related though. I have a new LCD coming, so I should be able to see soon whether it fixes the problem. It appears to be a cosmetic display issue, because now it glitches on it's own for a time, but later it clears up on it's own and goes back to normal. (part of why I'm suspecting the LCD at this point)

2) The date. This IS, however, 100% cosmetic, since the date doesn't control anything, it's just a handy display.

My only testing holdup is lack of a spare E-Series to test with. I may go ahead and convert the code for the Sat+ because I do have a spare Sat+ on hand. Also the freaking case is still on route via slow boat from Hungary or somewhere in Eastern Europe. Apparently the "expedited" shipping just means it leaves their factory sooner, not that it comes by a faster shipping method. But I can test without a case, so that only affects final deployment.


----------



## ipkiss

So I just bought me some parts... wish me luck! But wouldn't you know it, the zigo guy is having problems accepting paypal payments! Can't get a case. I wonder if this case on fleabay would work .. Item 181144415078



kman said:


> FWIW, if anyone is assembling parts for one of these, it would appear the original EvilBay listing that AH suggested has been pulled by the seller (I think they're out).
> 
> I believe I have found an alternate source (although no promises), at item # 371236736088.
> 
> I hope this is helpful for someone..  (and that it's the right part! ... although it looks correct)



And this did help.. thanks, kman!


----------



## kman

ipkiss said:


> So I just bought me some parts... wish me luck! But wouldn't you know it, the zigo guy is having problems accepting paypal payments! Can't get a case. I wonder if this case on fleabay would work .. Item 181144415078
> 
> And this did help.. thanks, kman!


Glad to help.  I ended up buying parts for a second one, too, so it was handy for myself, as well, LOL.

The Zigo case is handy but not essential. Two other options: 1) No case to start (long term you'll want something, but there's little point during the testing phase), and just wait until the Zigo issues are resolved, or 2) Just find something else. The one you found on eBay looks pretty decent, it's just not as fully enclosed as the Zigo case. Pretty much any clear case will work, though, as long as you're willing to simply drill a couple of screw holes to mount the Mega, and drill a hole on the back to get the power and/or USB cords through. I've successfully mounted Megas and Unos in these cases on Amazon: 
Amazon.com: US Acrylic® Clear Acrylic All-Purpose Box: Beauty and 
Hammond 1591STCL Translucent Polycarbonate Project Box -- Inches (4.3" x 1.6" x 3.3") mm (110mm x 40mm x 85mm): Audio Video Accessories And Parts: Amazon.com: Industrial & Scientific (this one is too small for a Mega but you get the idea)


----------



## ipkiss

Drilling the holes to mount is not so bad. What bugs me is dremeling a square/rectangle for the usb connectors. I'm surprised not more people simply make something similar to this http://www.seeedstudio.com/depot/Project-Skeleton-TFT-Acrylic-p-1073.html . Reviews for that particular one had fit issues, but you get the idea. While I was searching for arduino mega cases, a lot of people seem to have the main case even with cutout openings for the interfaces to attach a shield but no one has a main case with an additional enclosure! It would seem amazingly simple to just design a cover that stacks on for some of them -- especially the ones that have screws on the corners!

Like most of these: https://www.google.com/search?q=arduino+mega+case&safe=active&tbm=isch 

I guess most shields are not meant to be permanent?


----------



## kman

I agree, the state of project boxes is pretty bad, which is really surprising for something so simple.

The Sora-Shop cases look like they would work nicely, but €21.00 for a small project box (plus international shipping, I assume) is highway robbery! (even with the dollar so much better against the Euro than a few years ago)

If you drill a big enough hole for the USB, no additional finishing is required, but for me it wasn't _too_ tough (considering I'm not mass producing these, just 1-2) to drill the smaller starter hole and then spend an evening in front of the TV with a small file in my hand, squaring off the corners. Worked great!

Edit: Interesting option for future projects. Won't work for this one (without modifications) since you can't access the physical buttons, but still:
http://linksprite.com/wiki/index.php5?title=LinkSprite_Clear_Enclosure_for_pcDuino (available here plus this height extension add-on here)


----------



## ipkiss

Yea, I did that when I was crafting an enclosure for the led drivers for my makersled fixture. Thought I'd press the easy button this time around -- especially since anotherhobby went out of his way to research the easy button options .. and yes, I definitely agree about those sora shop boxes.


----------



## kman

He still did well to find those Zigo boxes. I sure couldn't find anything better than the Amazon one when I looked. Although I'll be more satisfied with the Zigo boxes if they ever actually show up! ARGH


----------



## ipkiss

Maybe this one in clear... 
https://solarbotics.com/product/60105/ 
It looks like it has enough height and they claim it'll hold a full shield.

edit: 

okay, the vendor replied and said the dimensions are 35x75x120mm, that being said, the zigo is 45x75x119mm according to their site. A question for Anotherhobby or whoever that has the zigo case, how much clearance do you have between the electronics assembly and the top cover? 

kman: I saw that linksprite one. I don't think not being able to access the buttons is that much of an issue since the zigo one doesn't allow it either. The bigger issue is that it's merely translucent and it'll make seeing the display a little hard. However, I didn't notice that it was large enough for a mega, until you brought it up and I took another look. Either way, good find!


----------



## kman

ipkiss said:


> Maybe this one in clear...
> https://solarbotics.com/product/60105/
> It looks like it has enough height and they claim it'll hold a full shield.
> 
> edit:
> 
> okay, the vendor replied and said the dimensions are 35x75x120mm, that being said, the zigo is 45x75x119mm according to their site. A question for Anotherhobby or whoever that has the zigo case, how much clearance do you have between the electronics assembly and the top cover?
> 
> kman: I saw that linksprite one. I don't think not being able to access the buttons is that much of an issue since the zigo one doesn't allow it either. The bigger issue is that it's merely translucent and it'll make seeing the display a little hard. However, I didn't notice that it was large enough for a mega, until you brought it up and I took another look. Either way, good find!


The linksprite case actually has a hole precut for a 16x2 display. It just won't work for this project (as I think I mentioned) because it's in the wrong place for a display _shield_ like we're using. I _think_ the IR would fire ok through the translucent plastic ok, as long as it's positioned near enough to the receiver. If not, easy enough to either simply drill a hole for the light to shine through, aimed at the receiver, OR drill a hole to stick the receiver into the case. 

Edit: Just looked at the Solar Robotics case. That looks really good! Unfortunately I'm still waiting for delivery of my first Zigo order (almost 5 weeks now!) so I don't know how the measurements map out. I can tell you the stack (to the top of the display, at least... I haven't bent the IR or RTC yet) measures ~30mm so it _might_ work! And should be WAY faster coming to the US from Canada than Armenia. If I didn't already have two Zigo boxes on order I'd probably grab one to try.


----------



## kman

Heh. Speak of the devil...

Zigo box FINALLY just arrived in today's mail. Ordered Jan 14, arrived today, Feb 27. 6 weeks. (and yes, I paid the "upgraded shipping" fee)

I'll edit this post with some photos and measurements shortly...

Ok, I guess whether the Solar Robotics box will fit depends on how it goes together. The Zigo box has a tool-less "floating" design that adds height, so the whole thing pretty much fits perfectly with less than 5mm to spare (maybe 2-2.5mm to spare?) Essentially, the whole assembly doesn't go all the way to the bottom, so it sits higher in the case.










The whole thing goes together quite nicely, though.


----------



## ipkiss

Thanks for those pics, kman. That's cutting it pretty close. I was thinking maybe I'll shimmy the top cover higher with some washers/bolts if I have to. Hopefully the lack of a floating sheet will help!

Man, I just went through the order process for that solarbotics one. Handling fee + shipping is bringing it close to $30. Haven't pulled the trigger yet. The slickdealer in me is screaming the famous refrain " Shipping kills the deal! "


----------



## Onyx165

Trying to get this program loaded to my arduino, and I keep getting this error message. Anyone know what I'm doing wrong? 

*Arduino: 1.6.1 (Windows 7), Board: "Arduino Mega or Mega 2560, ATmega2560 (Mega 2560)"

In file included from C:\Users\Jason\Documents\Arduino\libraries\Time\DateStrings.cpp:11:0:

C:\Users\Jason\Documents\Arduino\libraries\Time\DateStrings.cpp:41:22: error: variable 'monthNames_P' must be const in order to be put into read-only section by means of '__attribute__((progmem))'

PGM_P monthNames_P[] PROGMEM = 

^

C:\Users\Jason\Documents\Arduino\libraries\Time\DateStrings.cpp:58:20: error: variable 'dayNames_P' must be const in order to be put into read-only section by means of '__attribute__((progmem))'

PGM_P dayNames_P[] PROGMEM = { dayStr0,dayStr1,dayStr2,dayStr3,dayStr4,dayStr5,dayStr6,dayStr7};

^

C:\Users\Jason\Documents\Arduino\libraries\Time\DateStrings.cpp:59:24: error: variable 'dayShortNames_P' must be const in order to be put into read-only section by means of '__attribute__((progmem))'

char dayShortNames_P[] PROGMEM = "ErrSunMonTueWedThrFriSat";

^

Error compiling.

This report would have more information with
"Show verbose output during compilation"
enabled in File > Preferences.
*


----------



## xtremebassist

You will need to declare them as constants for it to compile. I just opened the DateStrings.cpp in TextPad and made the following mods:

PGM_P const monthNames_P[] PROGMEM =

const char monthShortNames_P[] PROGMEM =

PGM_P const dayNames_P[] PROGMEM = 

const char dayShortNames_P[] PROGMEM = 


To get the month, day and year to save & update, you need to add this line:



Code:


if(RTC.set(t) == 0) setTime(t); // set RTC if successful

to the if function:



Code:


if (menu.getCurrent().getName() == "SET DATE")

Right before:



Code:


setSyncProvider(syncProvider);

The full code for that section:



Code:


if (menu.getCurrent().getName() == "SET DATE") {
        if ( editingActive == true ) {
          
          time_t t;
          tmElements_t tm;
          tm.Year = CalendarYrToTm(saveRTC.tYear);
          tm.Month = saveRTC.tMonth;
          tm.Day = saveRTC.tDay;
          tm.Hour = hour();
          tm.Minute = minute();
          tm.Second = second();
          t = makeTime(tm);
          
          if(RTC.set(t) == 0) setTime(t); // set RTC if successful
          
          setSyncProvider(syncProvider);
        }
      }

Also use the previous posted code fixes

Bump: Also Zigo finally fixed his PayPal account and I was able to order the case without engraving yesterday.


----------



## Onyx165

Much appreciated xtreme!

So, iAqua itself is working fine now, but it doesn't seem to be sending out any signals to the ecoxotic....Fade times have been double checked, and all WRGB values correspond with the light; but there's no actual fading going on...Does the ecoxotic have to be set to a certain mode before the iAqua can send a signal to it?


----------



## kman

Wow, did xtreme just fix the day/date issue? That would be really nice! I'll have to poke at this when I get home tonight.

I haven't been able to verify functionality with my iAqua yet. Everything (other than the date, but maybe that's fixed now?) seems to work ok on screen, but like Onyx, I haven't been able to verify any output from the IR yet. I'm not sure if it's because I also modified the code to try to get it running the Sat+ lights instead of the E-Series, or if there is a hardware problem. I just haven't had time to troubleshoot yet.

But if the Day/Date code is fixed, it's work experimenting tonight. It's complicated because I only have one E-Series, and it's actually on my tank, but it's definitely time for some actual experimentation. (I have a spare Sat+ at the moment, so that's a lot easier to test, but again, I haven't had any luck so far.)

Btw: I think the compiling problems are related to the new IDE from Arduino. People running the new 1.6.1 software have been having problems, while the older IDE, 1.0.6, seems to compile things fine. The older version is still available, I believe.


----------



## xtremebassist

The date saves correctly but I can't get the IR LED to work. I did notice in his libraries, he didn't update IRemoteInt.h to use pin 46 like in his initial post. I updated the libraries but still haven't gotten it to work. Not sure if it is a broken IR emitter or something in the code. I don't see (using a cell phone camera) the IR emitter working. I tried reinstalling Arduino IDE just in case it was using a cached version of IRemoteInt.o and therefore not updating to the correct pin. No love. I removed the LCD, plugged in the IR LED to pin 11 (default pin in the library) and rebooted, no love. Looking at getting another IR LED emitter. Here is the section of code in the IRemoteInt.h that I reconfigured for the right pin:

// define which timer to use
//
// Uncomment the timer you wish to use on your board. If you
// are using another library which uses timer2, you have options
// to switch IRremote to use a different timer.

// Arduino Mega
#if defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__)
//#define IR_USE_TIMER1 // tx = pin 11
//define IR_USE_TIMER2 // tx = pin 9
//#define IR_USE_TIMER3 // tx = pin 5
//#define IR_USE_TIMER4 // tx = pin 6
#define IR_USE_TIMER5 // tx = pin 46


----------



## kman

^^ I'll give that a try when I have time. Sorry, been slammed lately. Hopefully this evening? I have two iAqua Lite units that I've built, so hopefully one of them might work. So far no luck, but again, I was editing code to switch to Current Sat+ instead of E-Series at the same time.

I'll go back to the stock code, re-apply the various changes to date, and see if I can make it work on my E-Series, even if I have to pull it off the tank to test it.


----------



## xtremebassist

What a PITA!!! It looks like I finally figured it out. He forgot to update the IRremoteInt.h to use pin 46 and didn't call out the 5v & GND pins for the IR transmitter. Just did a recompile, switch my light to MOON, power on iAquaLite and it finally switched it to daylight. Will let it run & test more and then post the code mods. :bounce:


----------



## kman

xtremebassist said:


> What a PITA!!! It looks like I finally figured it out. He forgot to update the IRremoteInt.h to use pin 46 and didn't call out the 5v & GND pins for the IR transmitter. Just did a recompile, switch my light to MOON, power on iAquaLite and it finally switched it to daylight. Will let it run & test more and then post the code mods. :bounce:


BRAVO!!! Well done! I'm sure many here thank you for the assist. roud:

I know I do! :biggrin:

Is there a chance you can list ALL the mods needed? Just so we have them in one place. Else at some point I'll have to write up all the code and stick it somewhere so people can just copy and paste the whole thing, as originally intended by AH (too much text to post the entire sketch, unfortunately, the board won't allow it).


----------



## xtremebassist

I will most definitely post all the mods in one place once we flushed out all the issues. Now to see if the fades and power off work tonight. The first mod to get the IR transmitter working was to the IRremoteInt.h that I already posted. The next was to define the power and GND pins:

/*--------------------------------------------------------------------------------------
Defines
--------------------------------------------------------------------------------------*/
// Pins in use
#define BUTTON_ADC_PIN A0 // A0 is the button ADC input
#define LCD_BACKLIGHT_PIN 10 // D10 controls LCD backlight
#define IR_TRANS_5V_PIN 44 // Power to IR transmitter
#define IR_TRANS_GND_PIN 42 // GND for IR transmitter 

...........

void setup()
{

//lcd backlight control
pinMode( LCD_BACKLIGHT_PIN, OUTPUT );

// Activate RTC module
digitalWrite(DS1302_GND_PIN, LOW);
pinMode(DS1302_GND_PIN, OUTPUT);

digitalWrite(DS1302_VCC_PIN, HIGH);
pinMode(DS1302_VCC_PIN, OUTPUT);

// Activate IR emmitter
digitalWrite(IR_TRANS_GND_PIN, LOW);
pinMode(IR_TRANS_GND_PIN, OUTPUT);

digitalWrite(IR_TRANS_5V_PIN, HIGH);
pinMode(IR_TRANS_5V_PIN, OUTPUT); 


My additions are in red. No warranty on this but it seems to be working without frying the board. At least I can see the IR working enough to switch the light during its "Smart Startup" mode. Hopefully everything else just works 

The best thing it is like AH said, you can use this with any with IR remote once you know the codes. Nice!


----------



## Onyx165

Xtreme, you are the man.

What are the specific coding changes you made to the IRremoteInt.h? When I look at the section of code you're referring to in your post, it looks exactly the same in the actual file.

Zero knowledge of how code works, so I apologize if its rather obvious... :help:


----------



## xtremebassist

This section at the top to define pin 46:

// Arduino Mega
#if defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__)
//#define IR_USE_TIMER1 // tx = pin 11
//define IR_USE_TIMER2 // tx = pin 9
//#define IR_USE_TIMER3 // tx = pin 5
//#define IR_USE_TIMER4 // tx = pin 6
 #define IR_USE_TIMER5 // tx = pin 46

I used the IRRemote library from AH's download and at the beginning of his post he said you wouldn't need to change it. But when I looked, it didn't have the right TIMER defined. Yours might so you might be good to go.

You have to close out of Arduino IDE for it to recompile any changes to that file.

Hehehehe. I stayed up to 1:00 AM dorking with this the other night. Today it finally dawned on me that this is a digital board and you have to define the pins for the IR transmitter to get power much less this chunk of code to tell it to send down the right pin. Dooh! Obviously this code and box never worked. The date and saving schedules display were cosmetic. The IR transmitter never could work. Onyx you save me because after you couldn't get it the IR transmitter to work, it made me look harder. I was going to buy another transmitter. So thanks! You saved me time and a little money.

So far, so good. Waiting on the fade from Daylight at the moment. I figure I would just let it run with the stock fades & off times to see if it all works now.


----------



## xtremebassist

Fades working perfectly. You can see the Ecoxotic display being updated when the box sends its IR signal. Sweet! :bounce:


----------



## Onyx165

xtremebassist said:


> Onyx you save me because after you couldn't get it the IR transmitter to work, it made me look harder. I was going to buy another transmitter. So thanks! You saved me time and a little money.


Glad I could be of some help!

Alas, even with the new changes to the code, I still can't get the darn thing to transmit. I've tried fiddling around with it some, but really I'm just a blind man fumbling in the dark with this stuff :tongue:


----------



## xtremebassist

The first part in the IRemoteInt.h is selecting the right transmit pin. The // means it is commented out and not being used. So you should have this:

// Arduino Mega
#if defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__)
//#define IR_USE_TIMER1 // tx = pin 11
//#define IR_USE_TIMER2 // tx = pin 9
//#define IR_USE_TIMER3 // tx = pin 5
//#define IR_USE_TIMER4 // tx = pin 6
#define IR_USE_TIMER5 // tx = pin 46

You will have to at least close out the Arduino IDE completely and open it back up in order to get it to recompile this file. I heard on earlier version of Arduino program, you would have to find the IRremoteInt.o file and delete it. This key to get the box to send the signals to right pins and your IR Transmitter.

Next is in the iAquaLite sketch, you need to define the GND and 5v pin of the IR transmitter in order to get it to work:

/*--------------------------------------------------------------------------------------
Defines
--------------------------------------------------------------------------------------*/
// Pins in use
#define BUTTON_ADC_PIN A0 // A0 is the button ADC input
#define LCD_BACKLIGHT_PIN 10 // D10 controls LCD backlight
#define IR_TRANS_5V_PIN 44 // Power to IR transmitter
#define IR_TRANS_GND_PIN 42 // GND for IR transmitter 

So you need to make sure the "S" pin is plugged into pin 46, the 5V pin which is the middle pin is in 44 and the GND pin is in 42. Next we need to enable and power them:

void setup()
{

//lcd backlight control
pinMode( LCD_BACKLIGHT_PIN, OUTPUT );

// Activate RTC module
digitalWrite(DS1302_GND_PIN, LOW);
pinMode(DS1302_GND_PIN, OUTPUT);

digitalWrite(DS1302_VCC_PIN, HIGH);
pinMode(DS1302_VCC_PIN, OUTPUT);

// Activate IR emmitter
 digitalWrite(IR_TRANS_GND_PIN, LOW);
pinMode(IR_TRANS_GND_PIN, OUTPUT);

digitalWrite(IR_TRANS_5V_PIN, HIGH);
pinMode(IR_TRANS_5V_PIN, OUTPUT); 

So we are setting GND by saying "LOW" and saying it is an "OUTPUT" pin. Then with the 5V pin we are saying "HIGH" & "OUTPUT" to get the board to send 5V to the pin. Once you upload the sketch, the device should start transmitting and working correctly.

Hehehehehe, yeah this stuff is like Chinese Algebra to me too :tongue: Just been determine not to waste my money on the parts I bought :tongue: I have the IR transmitter right next to the IR receiver on the Exocotic receiver. You can see the circle receiver part on the face on the Exocotic receiver. I mean they are practically touching but I don't think that is necessary.

To test I would power off the iAqua Lite, switch Exocotic with the regular remote to some other phase like Moon during the daylight period, point the IR transmitter of the iAqua Lite right at the circle receiver part on the Exocotic receiver and then power on the iAqua Lite. You should see the Exocotic light not only switch but the receiver display will change like you are pushing the remote.

I will post all the code patches to make this work correctly in one place. Maybe I should just upload it all. I see the logic flaw with trying to save midnight or noon in the time:

if (_24hr==false) {
if (saveRTC.tAM==false) saveRTC.tHour=saveRTC.tHour+12;
}


So if you save at 12:00 PM, it would add 12 hours and make it 12:00 AM. It is late so I will fix this tomorrow with another "if" statement. I'll try to wrap my brain around the Power On and Off saving too:

else if (EDIT_FIELD==EDIT_L_ONHOUR) {
if (lightPowerT.onHour==0) lightPowerT.onHour=23;
else lightPowerT.onHour--;
}
else if (EDIT_FIELD==EDIT_L_ONMINUTE) {
if (lightPowerT.onMinute==0) lightPowerT.onMinute=59;
else lightPowerT.onMinute--;
}
else if (EDIT_FIELD==EDIT_L_OFFHOUR) {
if (lightPowerT.offHour==0) lightPowerT.offHour=23;
else lightPowerT.offHour--;
}
else if (EDIT_FIELD==EDIT_L_OFFMINUTE) {
if (lightPowerT.offMinute==0) lightPowerT.offMinute=59;
else lightPowerT.offMinute--;
}

Hopefully this helps and I definitely have mine working correctly. What PITA to figure out IR transmitter wasn't configured to even have power to it much less not to send out the right pin.


----------



## kman

Fingers crossed! Thanks so much for your troubleshooting!

I already had the correct modification made in the IRemoteInt.h file to select Timer5 and pin 46, per AH's original post (I've been playing with these IR controllers for a while so I already had the libraries and wasn't using the ones he explicitly provided, so I guess I got lucky on that one).

I've just made your modifications into my code, the code I already tweaked to substitute in the Sat+ codes.

Wish me luck, cuz I'm about to upload and try it out...


----------



## kman

I think it's working. 

SCHWEEEET. (><)

Date saves and displays correctly. FINALLY.

Power turned on, per schedule (well, the modified one I entered really quick). First time anything has ever responded in any way. This is with the code I've modified for the Current USA Sat+, not the E-Series, so I'll have to watch it closely to see if things are progressing, since there is no numeric display on the Sat+.

I'll know within an hour if the fades are all working as intended. I have 5 minute fades for each mode spaced about 10 minutes apart.


----------



## kman

Ok, I spoke too soon. Something is definitely wrong.

On the upside, it is finally communicating with the light, at least from a power on/off standpoint.

On the downside, the clock is fluctuating, and it appears to be caught in a loop, counting down from power on (Moon) to the next alarm. It display the minutes to the next phase, but as soon as it hits zero, the clock gets set back 5 minutes and the countdown to the next level resumes counting at the higher number.

But I'm not sure if my Sat+ related changes are the culprit, or the overall changes from xtreme. I think I'm going to reset everything to stock code and try the changes again, with the E-Series code intact, and see where it goes.


----------



## kman

I've been meaning to do this for a while. This is probably only handy for a few people, like me, who are constantly switching back and forth between Current USA Sat+ and the Ecoxotic E-Series, but since I finally did the legwork, I figured I should post the comparison in case anyone else finds themselves in a similar boat.

Essentially, the Sat+ and E-Series use the exact same remote control codes.

But naturally, it's not that simple.

If you hold both remotes in your hand, you'll notice _most_ of the buttons seem the same, as in, they have a corresponding button on the other remote. BUT, the E-Series has one row fewer than the Sat+ does. (The Sat+ has more semi-useless dynamic modes.) But they also have a bunch of clock setting buttons on the top, and fewer "canned" color light modes on top. As a result, the _printing_ on the buttons of the Ecoxotic remote are essentially moved down one row. (or looked at the other way, the Sat+ buttons beyond the first row are all moved up one row)

The power button for each is identical, and works identically.

In other words, every button press you push on each remote does something _different_ to the other light, if both IR receivers are positioned to the IR can hit them! AAAAARGH!!! (Other than power, at least, and thank goodness for that!)

This photo should help:










Notice the color up/down buttons are offset by one row? So you guessed it, Red Down on the left remote (Sat+) corresponds to Red Up on the right remote (E-Series). Similarly, Red Down on the _right_ remote (E-Series) corresponds to the position of M1 on the _left_ remote (Sat+).

And sure enough, looking at the hex numbers in the sketch for the remote codes confirms they are the same. The two sister companies used the same OEM remote core for the two products, but then designed the button layout just a bit differently and the resulting imprint is different, even if all the underlying buttons are the same. Of course, this is only an issue if, like me, you have both of these lights in the same room (or on the same tank), but if you do, wow, those receivers had best be isolated from each other!

Anyway, I've taken the remote codes for each light type, and cross-annotated each for the other with comments. This is handy for me, if I point a controller set up for E-Series at a Sat+, I can see what will happen when the controller sends the E-Series code for "M1" to the Sat+.

*Remote Code Comparison for Current USA Sat+ vs. Ecoxotic E-Series:*



Code:


// REMOTE CONTROL CODES FOR CURRENT SATELLITE PLUS
const unsigned long POWER = 0x20DF02FD;  // SAME AS E-Series
const unsigned long FULLORANGE = 0x20DF3AC5; // E-Series = SETCLOCK
const unsigned long FULLLIGHTBLUE = 0x20DFBA45; // E-Series = ONTIME
const unsigned long FULLPURPLE = 0x20DF827D; // E-Series = OFFTIME
const unsigned long FULLWHITE = 0x20DF1AE5; // E-Series = HOURUP
const unsigned long FULLYELLOW = 0x20DF9A65; // E-Series = MINUTEDOWN
const unsigned long FULLBLUE = 0x20DFA25D; // E-Series = ENTER
const unsigned long REDUP = 0x20DF2AD5;   // E-Series = SUNLIGHT
const unsigned long REDDOWN = 0x20DF0AF5; // E-Series = REDUP
const unsigned long GREENUP = 0x20DFAA55; // E-Series = FULLSPECTRUM
const unsigned long GREENDOWN = 0x20DF8A75; // E-Series = GREENUP
const unsigned long BLUEUP = 0x20DF926D; // E-Series = CRISPBLUE
const unsigned long BLUEDOWN = 0x20DFB24D; // E-Series = BLUEUP
const unsigned long WHITEUP = 0x20DF12ED; // E-Series = DEEPWATER
const unsigned long WHITEDOWN = 0x20DF32CD; // E-Series = WHITEUP
const unsigned long M1 = 0x20DF38C7; // E-Series = REDDOWN
const unsigned long M2 = 0x20DFB847; // E-Series = GREENDOWN
const unsigned long M3 = 0x20DF7887; // E-Series = BLUEDOWN
const unsigned long M4 = 0x20DFF807; // E-Series = WHITEDOWN
const unsigned long MOONLIGHT = 0x20DF18E7; // E-Series = M1 
const unsigned long MOONDARK = 0x20DF9867; // E-Series = M2
const unsigned long MOONCLOUDS = 0x20DF58A7; // E-Series = DAYLIGHT
const unsigned long SUNRISE = 0x20DFD827; // E-Series = MOON
const unsigned long CLOUDS1 = 0x20DF28D7; // E-Series = DYNAMICMOON
const unsigned long CLOUDS2 = 0x20DFA857; // E-Series = DYNAMICLIGHTNING
const unsigned long CLOUDS3 = 0x20DF6897; // E-Series = DYNAMICCLOUD
const unsigned long CLOUDS4 = 0x20DFE817; // E-Series = DYNAMICFADE
const unsigned long CLOUDS5 = 0x20DFC837; // (no corresponding code)
const unsigned long STORM1 = 0x20DF08F7; // (no corresponding code)
const unsigned long STORM2 = 0x20DF8877; // (no corresponding code)
const unsigned long STORM3 = 0x20DF48B7; // (no corresponding code)




Code:


// REMOTE CONTROL CODES FOR ECOXOTIC E-SERIES USED IN THIS SKETCH
const unsigned long POWER = 0x20DF02FD; // SAME AS SAT+
const unsigned long REDUP = 0x20DF0AF5; // REDDOWN on SAT+
const unsigned long REDDOWN = 0x20DF38C7; // M1 on SAT+
const unsigned long GREENUP = 0x20DF8A75; // GREENDOWN on SAT+
const unsigned long GREENDOWN = 0x20DFB847; // M2 on SAT+
const unsigned long BLUEUP = 0x20DFB24D; // BLUEDOWN on SAT+
const unsigned long BLUEDOWN = 0x20DF7887; M3 on Sat+
const unsigned long WHITEUP = 0x20DF32CD; // WHITEDOWN on SAT+
const unsigned long WHITEDOWN = 0x20DFF807; // M4 on SAT+
const unsigned long DAYLIGHT = 0x20DF58A7; // MOONCLOUDS on SAT+
const unsigned long M2 = 0x20DF9867; // MOONDARK on Sat+
const unsigned long M1 = 0x20DF18E7; // MOONLIGHT on Sat+
const unsigned long MOON = 0x20DFD827; // SUNRISE on Sat+

// REMOTE CONTROL CODES FOR ECOXOTIC E-SERIES NOT USED IN THIS SKETCH (KEPT FOR FUTURE USE)
const unsigned long SETCLOCK = 0x20DF3AC5; // FULLORANGE on Sat+
const unsigned long ONTIME = 0x20DFBA45; // FULLLIGHTBLUE on Sat+
const unsigned long OFFTIME = 0x20DF827D; // FULLPURPLE on Sat+
const unsigned long HOURUP = 0x20DF1AE5; // FULLWHITE on Sat+
const unsigned long MINUTEDOWN = 0x20DF9A65; //FULLYELLOW on Sat+
const unsigned long ENTER = 0x20DFA25D; // FULLBLUE on Sat+
const unsigned long RESUME = 0x20DF22DD;
const unsigned long SUNLIGHT = 0x20DF2AD5;  // REDUP on SAT+
const unsigned long CRISPBLUE = 0x20DF926D; // BLUEUP on Sat+
const unsigned long FULLSPECTRUM = 0x20DFAA55; // GREENUP on Sat+
const unsigned long DEEPWATER = 0x20DF12ED; // WHITEUP on Sat+
const unsigned long DYNAMICMOON = 0x20DF28D7; // CLOUDS1 on Sat+
const unsigned long DYNAMICLIGHTNING = 0x20DFA857; // CLOUDS2 on Sat+
const unsigned long DYNAMICCLOUD = 0x20DF6897; // CLOUDS3 on Sat+
const unsigned long DYNAMICFADE = 0x20DFE817; // CLOUDS4 on Sat+


----------



## kman

By George I think I've done it!

I'm not sure what went wrong the first time, but starting over with stock code, and recreating the various changes proposed by scaLLas and xtremebassist, I appear to have a fully functional E-Series iAqua Lite, although I have not given it a thorough test connected to the light itself. But I then split the code off, made the conversion changes for the Sat+ codes, and uploaded it to my second controller. This one I ran a test on a spare Sat+ (I wish I had a spare E-Series!), and the whole dawn to moon sequence went through without a hitch! After the dawn to daylight sequence triggered successfully, on a whim I recorded the end of day series as a time lapse video, and that worked well, too. (Excuse the shaky video, I was just resting my hand on top of my tripod, hand holding the phone for about 20 minutes while it ran, as I didn't have time to set things up properly without reprogramming half the fade schedule on the fly)






I'm going to take this to work tomorrow and test it for real on my office tank's Sat+!

Massive thanks to Scallas and xtremebassist ... we'd all be spinning our wheels with this thing, still, if they hadn't taken the time to debug the bugs in the code!


----------



## xtremebassist

Great that you got it working! :bounce: Everything is working perfectly for me. The fades are super smooth, it powered off and then back on this morning. Thanks to AH for his great design, code and all the leg work for the remote codes! Thanks to kman, Scallas and Onyx for keeping the thread alive and code fixes! 

Thanks Kman for the Sat+ remote codes. Now Sat+ owners can use such a cool gadget.


----------



## Onyx165

we have liftoff!

For anyone reading along or reading this later, be _sure_ to pay attention to this line of code in the IRemoteInt.h file

// Arduino Mega
#if defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__)
//#define IR_USE_TIMER1 // tx = pin 11
//#define IR_USE_TIMER2 // tx = pin 9
//#define IR_USE_TIMER3 // tx = pin 5
//#define IR_USE_TIMER4 // tx = pin 6
#define IR_USE_TIMER5 // tx = pin 46

The above is the correct code to make the iAqua IR work. Before I edited it, mine just had the "//" in front of #define IR_USE_TIMER5 // tx = pin 46, instead of in front of #define IR_USE_TIMER1 // tx = pin 11. Just make that change and you should be good to go. Thanks for that tip extreme, and thanks to everyone for getting this off the ground!


----------



## xtremebassist

Glad everybody is up and running now. Hehehehehehe, pretty useless if you can't get the IR transmitter working. I spent hours unplugging it, running to the tank and trying with no luck. Finally dawned on me that this is a digital board and you have to enable power for the IR transmitter to dream about working. Dooh! I'll try to look at the time saving stuff to get around the midnight saving thing and post all the working code.

I bought this case from evilbay in lieu of Zigo PayPal issue as I wait for it to arrive:

#381093754869

It allowed me to get the pieces together and start flushing out the code without damaging the board.

Now I got my feet wet with this Arduino, I might try adding a flow meter to it. I was thinking about using a flow meter to further chop up the CO2 from my UpAqua atomizer and might as well use it besides the propeller. Plus you can get a sense when to clean the media in your filter.


----------



## kman

xtremebassist said:


> Glad everybody is up and running now. Hehehehehehe, pretty useless if you can't get the IR transmitter working. I spent hours unplugging it, running to the tank and trying with no luck. Finally dawned on me that this is a digital board and you have to enable power for the IR transmitter to dream about working. Dooh! I'll try to look at the time saving stuff to get around the midnight saving thing and post all the working code.
> 
> I bought this case from evilbay in lieu of Zigo PayPal issue as I wait for it to arrive:
> 
> #381093754869
> 
> It allowed me to get the pieces together and start flushing out the code without damaging the board.
> 
> Now I got my feet wet with this Arduino, I might try adding a flow meter to it. I was thinking about using a flow meter to further chop up the CO2 from my UpAqua atomizer and might as well use it besides the propeller. Plus you can get a sense when to clean the media in your filter.


That would be an amazing feat; I hope you're able to pull off that flow meter! I think it's going to be tough to integrate it into the code for this particular hardware build, simply because the display is so small and already uses every bit for basic lighting display info. A bigger 4x20 display would help a lot, but then it wouldn't be the nice compact solder-free build that AH was shooting for with this particular setup. Although perhaps the same display could be used if a submenu displays flow values, that could be checked manually? Or maybe an alternate display mode that swaps between the normal display and shows the flow rate for a few seconds, like every 30 seconds or so. Just some ponderings.  FWIW, I could swear I remember AH saying something about the iAqua Lite code using up a pretty big chunk of the Mega's memory, so there may not be a whole lot of space left to play in.


----------



## kman

xtremebassist said:


> Great that you got it working! :bounce: Everything is working perfectly for me. The fades are super smooth, it powered off and then back on this morning. Thanks to AH for his great design, code and all the leg work for the remote codes! Thanks to kman, Scallas and Onyx for keeping the thread alive and code fixes!
> 
> Thanks Kman for the Sat+ remote codes. Now Sat+ owners can use such a cool gadget.


There's a lot more to getting the Sat+ going than just the codes, btw. I'm probably going to save the code online somewhere for people to download. There are 4-5 different places in the code where changes have to be made, and some of the changes involve substituting values in upwards of 16 lines in those places. It's complicated and fiddly. I'll post how to do it, so people can tackle it themselves, but I suspect most people will simply want to download the pre-altered code (which would include all of the code corrections to fix the entries in AH's stock code), so all they have to do is upload it and be done.


----------



## xtremebassist

Great points! I was kind of looking at replacing the text for the fades with icons to get space. Looks like I can still get to an interrupt pin (21) which I think I will need. Not really an hardware engineer but I think I can do it and the code should be pretty small. The sketch says it isn't too fat:



Code:


Sketch uses 36,482 bytes (14%) of program storage space. Maximum is 253,952 bytes.
Global variables use 1,647 bytes (20%) of dynamic memory, leaving 6,545 bytes for local variables. Maximum is 8,192 bytes.

But I should finish out this plant tank build before the wife kills for my man mess around house :hihi: 

I did a fix around saving the time at noon when you have 12 hour clock set which should work:



Code:


if (menu.getCurrent().getName() == "SET TIME") {
        if ( editingActive == true ) {
          if (_24hr==false) {
            if (saveRTC.tAM==false) {
              if (saveRTC.tHour!=12)
                saveRTC.tHour=saveRTC.tHour+12;
            } 
          }

I've attached a zip file with the IRremoteInt.h and iAquaLite.ino. Users should be able to install the original and just replace these two files to have a working setup. Enjoy!

Post if you find any other issues with the code.

Bump:


kman said:


> There's a lot more to getting the Sat+ going than just the codes, btw. I'm probably going to save the code online somewhere for people to download. There are 4-5 different places in the code where changes have to be made, and some of the changes involve substituting values in upwards of 16 lines in those places. It's complicated and fiddly. I'll post how to do it, so people can tackle it themselves, but I suspect most people will simply want to download the pre-altered code (which would include all of the code corrections to fix the entries in AH's stock code), so all they have to do is upload it and be done.


Definitely appreciate the work on this. If I had a Sat+ lying around, I would give you a hand. I'm curious since they are NEC remotes, did you have to play with the retransmitt time / amount or buffer values? I did see some places in the IRremote library were you can tweak such if needed. AH definitely has the remote times real tight but they work great on the Exocotic.


----------



## ipkiss

Thanks for debugging guys! Can't wait to start futzing with this. Zigo is accepting paypal again so I went for that case. Hard to argue with cheap and good. I'm willing to give up fast.


----------



## kman

xtremebassist said:


> I did a fix around saving the time at noon when you have 12 hour clock set which should work:
> 
> 
> 
> Code:
> 
> 
> if (menu.getCurrent().getName() == "SET TIME") {
> if ( editingActive == true ) {
> if (_24hr==false) {
> if (saveRTC.tAM==false) {
> if (saveRTC.tHour!=12)
> saveRTC.tHour=saveRTC.tHour+12;
> }
> }
> 
> I've attached a zip file with the IRremoteInt.h and iAquaLite.ino. Users should be able to install the original and just replace these two files to have a working setup. Enjoy!
> 
> Post if you find any other issues with the code.


In comparing my code to yours, I found a few small differences.

One correction from this thread which is not included in your code:



Code:


    // for editing fades, we use fadeT to temporarily hold the edited values, this way we don't lose the original values
    // here we set them to the appropriate fade values to be sent to the screen
    if (editingActive==false) {
      fadeT.onHour=fade1.onHour;
      fadeT.onMinute=fade1.onMinute;
      //lightPowerT.durationHours=lightPower.offHour;   //AH bad code
      //lightPowerT.durationMinutes=lightPower.offMinute;  //AH bad code
      lightPowerT.offHour=lightPower.offHour;   //scaLLas corrected code
      lightPowerT.offMinute=lightPower.offMinute;    //scaLLas corrected code
    }

...and related change:


Code:


    // for editing fades, we use fadeT to temporarily hold the edited values, this way we don't lose the original values
    // here we set them to the appropriate fade values to be sent to the screen
    if (editingActive==false) { 
      lightPowerT.onHour=lightPower.onHour;
      lightPowerT.onMinute=lightPower.onMinute;
//      lightPowerT.offHour=lightPower.offHour;      //AH Bad Code
//      lightPowerT.offMinute=lightPower.offMinute;  //AH Bad Code
      lightPowerT.durationHours=lightPower.offHour;     //scaLLas corrected code
      lightPowerT.durationMinutes=lightPower.offMinute; //scaLLas corrected code
    }

scaLLas found an error in AH's code where the wrong variable was being used. See post #67 and 72 on page 5.

Also, I notice your code has a line in the Smart Start that was uncommented out, while AH's original code had it commented out. Is the line actually needed, and AH accidentally left it commented out? (red text was originally commented out by AH):


Code:


  // first we need to check if we are before fade 1
[COLOR=Red]  if (fadeStart>currentTime) // if we are before fade 1
[/COLOR]  {
    Serial.println("before fade 1");
    irsend.sendNEC(MOON,32); // flip to moon
    currentLightMode=3;
    lastFade=6;
  }


----------



## xtremebassist

I found that .durationHours & .durationMinutes were never initialized and didn't seem to be used. I haven't try to change the stock fade setting and On/Off times so it might not be right. Doing this mod got it to display everything correctly



Code:


else if (menu.getCurrent().getName() == "LIGHT ON / OFF") {

    editingAvailable=true;

    // for editing fades, we use fadeT to temporarily hold the edited values, this way we don't lose the original values
    // here we set them to the appropriate fade values to be sent to the screen
    if (editingActive==false) { 
      lightPowerT.onHour=lightPower.onHour;
      lightPowerT.onMinute=lightPower.onMinute;
      lightPowerT.offHour=lightPower.offHour;
      lightPowerT.offMinute=lightPower.offMinute;
    }

The SmartStart part I uncommented the print serial line statement to see if the program was getting that far when I hadn't gotten the IR Transmitter working. You can commented it back:



Code:


// first we need to check if we are before fade 1
  if (fadeStart>currentTime) // if we are before fade 1
  {
    //Serial.println("before fade 1");
    irsend.sendNEC(MOON,32); // flip to moon
    currentLightMode=3;
    lastFade=6;
  }

It was nice of AH to leave all those Serial.println statements commented out so you can just go to Tools->Serial Monitor and watch where the code is hitting. These messages are only display on the serial port. 

If I get a chance I will try to save different values and see if those .durationHours & .durationMinutes are needed. I think not since they aren't defined and I couldn't find them used anywhere else. Seems like AH was consistent using .offHour & .offMinute everywhere else. Thinking he might of done a find & replace and missed that duration pair.

Definitely post the working Sat+ code. Thinking about getting a Sat+ for the wife's Fluval 5. Once I get the flow meter I'll start working on the code for it. I think I will follow your advice and have it flip from displaying the light and flow statuses.


----------



## xtremebassist

BTW - My iAquaLite has worked flawless with the stock fade and On/Off values since I activated the IR pin in the code.


----------



## kman

One thing I've had a miserable time with, in switching from the E-Series to the Sat+, is the different memory setting names used... some of which overlap (but are different!). M1 on the Sat+ does NOT equate to M1 on the E-Series. M2 on the Sat+ _might_ equate to M2 on the E-Series.

I _might_ have finally gotten it dialed in, by setting the RGBW values to each of the 4 color settings, so it was very clear which one it was switching to, and when. Ultimately I MAY want to change the info displayed on screen, too, so it better matches the Sat+ terminology.

There has been some funkiness that I can't quite explain, but it seems to be working now. I just want a few days of real world, accurate use before I put it out there. I ran through some accelerated time schedules last night that finally seemed to work, and I'm running a full daylight schedule test today. Tomorrow I'll bring it to the office and let it run my office tank for 2 days, and if all is well by Wednesday, I'll post the code. Although I may or may not have the time to replace the onscreen display to match the Sat+ by then.

AH's terminology is confusing to me. What's the difference between Sunrise and Dawn? Which one comes first? And Sunset and Dusk? On the E-Series it's less of a problem (although still slightly unclear IMO), because there's only M1-M2, Daylight and Moon, but on the Sat+ you use M1,M2,M3,M4 and it makes more sense to map M1=Day through M4=Moon, in descending light sequence, but that really messes with how those memory positions map out in the E-Series code, since the button positions of Daylight and Moon are M3 and M4 (but not really, since it's also shifted by a row... see my earlier post about the two codes). And then to top it all off, those same sequences are called in reverse at the end of the light cycle, and the display shows different terms for the same light. ARGH.

Difficult, but obviously not impossible. I just need to have a block of undistracted time to mess with it and dial it in (in terms of the display code).


----------



## Loumeer

I hope we can get this baby to work with the new planted+ 24/7. Awaiting for my light eagerly and I want to use this puppy for a 24/7 fader.


----------



## kman

Loumeer said:


> I hope we can get this baby to work with the new planted+ 24/7. Awaiting for my light eagerly and I want to use this puppy for a 24/7 fader.


Does it use IR control? The iAqua Lite could likely be adapted to work with PWM, if you really know what you're doing, but it would definitely require some work, as well as some hardware changes, if it uses PWM and not IR to control it. I haven't paid too much attention, but I was under the general impression than the 24/7 has an integrated controller for timed fades?


----------



## xtremebassist

*iAquaLite with Flow!*

I got my flowmeter on Friday from the slow boat from China. Tweaked the code and got it working! I added saveable settings of rotating the display (30 seconds iAquaLite, 30 seconds Flow) or Flow view only and view output in Liters or Gallons. The Flow screen shows either liters or gallons per minute and liters and gallons total. The total is not written to the EEPROM so it will reset when you boot it and there is an alarm to reset it daily at midnight. I nabbed the code from:

http://diyhacking.com/measure-water-flow-rate-and-quantity-arduino/

And

https://www.youtube.com/watch?v=HMtp8cs0Mxs

My initial test with this flow meter with a couple of liters seemed like 4.5 pulses per seconds gave me the correct total. Anywho I'm doing a couple day burn in on my QT with low flow and later I'll post the code, parts and assembly. This sketch is only useful if you have a flow meter attached otherwise it will waste time trying to calculate the flow and update the LCD. If you don't have the flow meter, use the regular iAquaLite sketch.


----------



## xtremebassist

Burn in worked but had a hell of time with daily reset alarm. First you need to update TimeAlarms.h for the any additional alarms you want to add:

#define dtNBR_ALARMS 9 // max is 255

Each alarm takes 12 bytes of RAM and you have to close out of the Arduino IDE at the minimum or reboot to get it to recompile the code. 

There is definitely some funkiness going on with 12 & 24 hour clock and alarms. I couldn't get an alarm to trigger during the midnight hour. I also noticed there is still some bugs when saving midnight values when in 12 hour mode. My work around was to use 11:59:59 PM and that works. The program interface doesn't allow you to set seconds for alarms / fades so you either got to hard code 59 seconds to the alarm or go with 11:59 PM. Maybe 12:00 AM will work for some alarms / fades but didn't work for me. Back to more testing!


----------



## kman

xtremebassist said:


> Burn in worked but had a hell of time with daily reset alarm. First you need to update TimeAlarms.h for the any additional alarms you want to add:
> 
> #define dtNBR_ALARMS 9 // max is 255
> 
> Each alarm takes 12 bytes of RAM and you have to close out of the Arduino IDE at the minimum or reboot to get it to recompile the code.
> 
> There is definitely some funkiness going on with 12 & 24 hour clock and alarms. I couldn't get an alarm to trigger during the midnight hour. I also noticed there is still some bugs when saving midnight values when in 12 hour mode. My work around was to use 11:59:59 PM and that works. The program interface doesn't allow you to set seconds for alarms / fades so you either got to hard code 59 seconds to the alarm or go with 11:59 PM. Maybe 12:00 AM will work for some alarms / fades but didn't work for me. Back to more testing!


One of my controllers has been working fine at the office for the past week, I believe, handling my Sat+. It runs from 9am-6pm, though, so it's not affected by whatever bugs there may be in the code with regard to midnight.

I'm going to tweak the settings a little this week just to be sure (since I'm actually working, I often miss the actual transitions and some are more subtle than others), but I think I have the code good to go with the Sat+ lights now.

Again, this particular timer do anything anywhere near midnight, though, so if the underlying code has some bugs, that wouldn't show up for me here at the office. A midnight bug could affect my home setup, however, so that would need to be resolved before I can put one into service at home. (If it's as simple as avoiding midnight for a timer, no biggie, but if there are issues with timers before and after midnight that could be a problem for me.)


----------



## natebuchholz

This is a wonderful thread! I just ordered the parts necessary to build one of these units. I was just curious what you use for your light cycles? do you have an example?


----------



## xtremebassist

kman said:


> One of my controllers has been working fine at the office for the past week, I believe, handling my Sat+. It runs from 9am-6pm, though, so it's not affected by whatever bugs there may be in the code with regard to midnight.
> 
> I'm going to tweak the settings a little this week just to be sure (since I'm actually working, I often miss the actual transitions and some are more subtle than others), but I think I have the code good to go with the Sat+ lights now.
> 
> Again, this particular timer do anything anywhere near midnight, though, so if the underlying code has some bugs, that wouldn't show up for me here at the office. A midnight bug could affect my home setup, however, so that would need to be resolved before I can put one into service at home. (If it's as simple as avoiding midnight for a timer, no biggie, but if there are issues with timers before and after midnight that could be a problem for me.)


Looks like the code uses a different method with saving the time fades compared to just saving the time. Not sure why I couldn't get an alarm to trigger correctly at midnight. I think I can still see the logic issue with saving time though:



Code:


if (menu.getCurrent().getName() == "SET TIME") {
        if ( editingActive == true ) {
          if (_24hr==false) {
            if (saveRTC.tAM==false) {
              if (saveRTC.tHour!=12)
                saveRTC.tHour=saveRTC.tHour+12;
            } 
          }

          time_t t;
          tmElements_t tm;
          tm.Year = CalendarYrToTm(year());
          tm.Month = month();
          tm.Day = day();
          tm.Hour = saveRTC.tHour;
          tm.Minute = saveRTC.tMinute;
          tm.Second = saveRTC.tSecond;
          t = makeTime(tm);

          if(RTC.set(t) == 0) setTime(t); // set RTC if successful

          setSyncProvider(syncProvider);
        }
      }

When you hit the menu to edit it, it uses a function to determine what it is displaying to you should be in 12 or 24 hour format and then determines if it is AM or PM. That seems to work. The above part says it if it "AM" save the hour. So if it is 12 AM, it will save it as 12 and the RTC clock is 24 hour only so that automatically becomes 12 PM after you save it in 12 hour format. This might be a similar issue with you trying to save LightsOff at midnight with 12 hours. I think the fades should be ok.

No clue why I couldn't get my Daily reset alarm to trigger at 12 AM. I ended up doing this as a work around which works:



Code:


flowDailyResetAlarmID = Alarm.alarmRepeat(23,59,59,AlarmFlowDailyReset);

So if you do run into issues, you might want to try tweaking the seconds in code. Normally it is set at "0"

fade1alarmID = Alarm.alarmRepeat(fade1.onHour,fade1.onMinute,0,AlarmFade1);

I'm still working on my tank build so I'm still just running the default fades and LightOn & LightOff with no issues.

I did this mod to get it to allow you to save the clock at 12 AM during 12 hour mode:

if (menu.getCurrent().getName() == "SET TIME") {
if ( editingActive == true ) {
if (_24hr==false) {
if (saveRTC.tAM==false) {
if (saveRTC.tHour!=12)
saveRTC.tHour=saveRTC.tHour+12;
} else if (saveRTC.tHour == 12) {
saveRTC.tHour = 0;
}
}

Bump:


natebuchholz said:


> This is a wonderful thread! I just ordered the parts necessary to build one of these units. I was just curious what you use for your light cycles? do you have an example?


The PDF manual explains how to to set the light cycles and the code defaults to the light cycles detailed at the top of the thread.


----------



## xtremebassist

*iAquaLite Flow sketch*

My original concept was to use a flow meter to help chop up the bubbles from my inline CO2 diffuser. This is my first experience working with Arduino so after getting the IR transmitter working, I figured I would add a Flow meter to this project. The Flow meter will clue me in when the filter needs to be changed by the reduced flow. 

I bought this flow meter from evil bay mostly because it is clear and I could see when it needs to clean or replaced:

Water Flow Control Switch Hall Effect Sensor Flowmeter Counter 1-30L/min 1.75Mpa

You will need to update your TimeAlarms.h for the additional alarm to reset the total daily from 8 to 9:



Code:


#define dtNBR_ALARMS 9   // max is 255

You will have to be closed out of the Arduino IDE to get it to recompile this library.

You will need to hook the yellow wire to pin 21, the red wire to either of the two 5 volt pins (the top two pins on the row the RTC & IR transmitter is connected on) and the black wire to either of the two ground pins (the botton two pins on the row the RTC & IR transmitter are connected on).

I used a heat gun and 5/8" tubing with clamps to get the sensor inline. Pay attention to the flow direction on the bottom of the sensor. 

After you compile and upload the code, you will have a Flow menu with two settings. You can either rotate the display from Flow and the Light (30 seconds on each) or just display Flow. Then the output could be displayed in Liters or Gallons. The Total amount is cleared daily at 11:59:59 PM or when you power off or reset the device. You can a different flow meter and you might need to play with calibration factor to suit the flow meter or get more accurate results:



Code:


float calibrationFactor = 4.5;

The low flow rate in the photos is from my QT running a cheesy sunsun canister filter.


----------



## kman

Impressive! I'm not quite ready to add one, but I'll keep this in mind for future playing. 

What's the FleaBay part number for the sensor you're using?

Is your code annotated as to Flow Control-specific changes? I'd need to integrate each change into my code since they're different (Sat+ vs. E-Series).


----------



## xtremebassist

.


kman said:


> Impressive! I'm not quite ready to add one, but I'll keep this in mind for future playing.
> 
> What's the FleaBay part number for the sensor you're using?
> 
> Is your code annotated as to Flow Control-specific changes? I'd need to integrate each change into my code since they're different (Sat+ vs. E-Series).


FleaBay - 381036289375

I commented all my code and used the naming standards and programming convention of the original code. Incorporated the existing menu & drawscreen functions. There are a extra pulsecount and alarm daily reset alarm functions. Most of the distinct flow code lies in the first part of setup and the first part of the loop. The additional menu code is place after the previous menu code. All should be pretty easy to spot.

Don't use if you don't have a flow meter because it will try to process the flow pulses every second and there is no way for it to detect it not present and not do it or menu option to disable the flow functionality.


----------



## xtremebassist

The waterflow sensor was under $5 shipped and then you just need so pin connectors,wire and some hose clamps. Little additional expense and effort to have a flow meter.


----------



## Notorious93

-_- I had the idea of adding a flow meter a while ago, although I may have posted it on the iAqua thread. From what I've read the flow meters aren't all that accurate, but I wouldn't know first hand. Try to manually measure the flow and compare it to the sensor, if its fairly accurate I need one 


Still haven't gotten around to putting together one of these bad boys yet although I should soon. If anyone would like to put one together for me, I'd happily pay extra.


----------



## natebuchholz

Is it normal to have an error while compiling? 
The error describes a non used file called robotIR? any ideas? 
I appologize this is new to me.

To clarify where I am; I have uploaded the original zip files and appropriately replaced them with the ones above provided by xtremebassist. What is my next step?


----------



## xtremebassist

Might be something with a newer version of the Arduino IDE. I originally had an error with the DateTime.h file and had to declare the constants. The robotIR library isn't used so you can safely remove it from the libraries in Arduino. We are using the IRRemote library. I'm using Arduino 1.6.1 with no issues except with the DateTime library and I posted the fix for that in an earlier thread.

After you get it to compile just upload and you should be good to go.


----------



## natebuchholz

Great! I have made those changes and now it compiles. I'm still waiting for all the parts to arrive so I can't test it yet. I just wanted to get a head start editing the code. I really appreciate your help and patience. Im certain I will have more questions as this project progresses.


----------



## kman

Welp, I've now had two iAqua Lite setups controlling Sat+ lights at the office and at home, running flawlessly for over a week.

At work, I have a Sat+ on my desktop shrimp tank, controlled by iAqua Lite, and at home, my main tank has both a Sat+ (not the new PRO, the original) and an E-Series light. The E-Series is controlled by the full iAqua controller. That secondary Sat+ is now controlled separately by the iAqua Lite. (before, it was separately controlled by one of the more primitive Arduino-based controller discussed in other build threads, as the iAqua can only control one _kind_ of light at a time)

Interestingly (although it makes sense in retrospect since the cross-fading code is from the same source), setting this up to use similar cross-fade timing and color settings, the Current Sat+ and Ecoxotic E-Series both show nearly identical color shifts for the whole light period. Very nice! The ramping is much smoother on the E-Series (100 steps for each color channel) compared to the Sat+ (~42 steps), but it's really an unnoticeable difference. I'm quite pleased with how well the two are blending.

There are still minor issues with the iAqua Lite code, which various people have pointed out, but nothing that can't be worked around fairly easily, IMO.

I'll clean up the code (which I've commented heavily while playing with various options, some of which didn't really pan out), and then post some working code as soon as I have time. EDIT: Code now attached to post. Search "kman" in the code text to see each change annotated from AnotherHobby's original stock code.

(Have I mentioned that I'm not a huge fan of the confusing terminology AH used for the iAqua Lite? Day/Sunrise/Dawn/Moon is actually far less clear than the simple "Daylight/Mid Sun/Low Sun/Moonlight that AH used for the full iAqua controller. Someone can probably tweak all the labels if they want, but I am tired of futzing with the code, personally, and this works well enough... and it does look good while it's running, so I'm leaving well enough alone.)

NOTE: The code is for the regular Current USA Satellite+ fixtures, NOT the new Sat+ PRO model. I don't have a Sat+ PRO so I have no idea what IR codes it uses, compared to the regular Sat+. Might be the same as the Sat+, might be the same as the E-Series, or might be completely different. I wish there was someone who had all three who could verify, but so far I haven't seen anyone post with feedback on this specific issue.

The initial setup and programming is a little more funky with the Sat+ compared to the E-Series, since it doesn't have the external controller showing precisely where you are with your settings, but it's really not bad at all.

This post is going to be a bit long, sorry!

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

*Here is how to make one of these work with a Sat+ (regular, not PRO):*


*Assemble*: Assemble the iAqua Lite controller (as directed in Post #1). It's nearly as easy as Legos; you literally plug everything into slot A and hole B until you're out of parts. 

*Upload Code*: Upload the modified code (which I'll attach later if I can still add it, or in a new post soon). Direction in post #1... essentiully, you run the desktop software, paste in the code, plug the USB into the controller, and click upload.

*Color Settings in Sat+ Memory Presets*: Figure out your desired color settings for the Sat+ for each of the four time periods (1-daylight, 2-mid-sun aka Sunrise/Sunset, 3-low sun aka Dawn/Dusk, and 4-Moonlight), and program them into M1-M2-M3-M4, respectively, of the light fixture itself with the remote. _Details below_.

*Color Settings in Controller*: Fill in the same color settings on the iAqua Lite using the built-in keypad buttons (see post #1 for AH's manual)... this is really easy once you get the general feel for navigation.

*Other controller settings*: Set your time, power schedule, and light time schedule as you like. Very straightforward.

*IR Receiver Wiring*: Decide how you want to deal with logistics of placing the IR receiver in front of the IR LED of the controller. (you can get fancy, or simply tie down the receiver with a twist tie and point the box at it!)

Enjoy. 

The only "tricky" step is #3, above. I'll go into detail here. 

Basically you're flying blind since there is no display showing the "value" of each color channel, like there is on the E-Series and Sat+ PRO, so you just have to count steps. Just set all four channels to zero (so you have a known starting point) and count the button presses (on the remote) needed to get to the color level you want, for each channel. Each color channel on the Sat+ has ~42 possible brightness values (actually 0-42, I think). BUT each button press on the remote is ~2 steps in the software (AH determined that the remote button press apparently fires twice, so our controllers can handle more precision than the stock remote can)... so if there are 42 steps, going from 0 to full brightness is 21 presses on the remote.

As an example, here are the light settings I'm using on my iAqua Lite and Sat+, here at the office:

*WRGB* (White-Red-Green-Blue... and recall that max setting is 42 for Sat+)


Daylight:
028 042 000 000 (_note my full daylight is actually only about 3/4 strength for this tank, on the white channel which is where the most PAR comes from... Your setup will likely be different, as to this aspect... and the red is maxed out at 42, giving a lovely warm tone to the daylight_ This light is stronger than my small 5 gal tank can handle without getting algae issues)

Mid Sun (aka Sunrise/Sunset):
003 042 000 000 (_very low PAR on this setting for me, but it's still putting out some light for viewing purposes_)

Low Sun (aka Dawn/Dusk):
000 028 012 002 (_still heavy on the reddish tones, but a lot more green than my other settings_)

Moonlight:
000 003 001 001 (_nice and low_)

Those paying close attention will note that there is no way to achieve a "1" setting (or any odd number) with the remote, since each button press goes 2 steps. So I get it as close as possible. It works out fine. Here's how to dial in those settings:

Daylight:
028 042 000 000

Manually set all 4 colors to zero. The click "Up" on the white channel 14 times, and up on the red channel 21 times (or just hold down until it's at max level). Store that in the M1 memory position on the light (press and hold M1 on the remote).

Mid Sun (aka Sunrise/Sunset):
003 042 000 000

Easiest way for this is to start with the Daylight preset (M1), take the white all the way to zero, and then step up 2 presses (which brings you to 4, which is close enough in my book). Red stays max. Save to M2.

Low Sun (aka Dawn/Dusk):
000 028 012 002

Here, I start by resetting back 4 channels back to zero. White stays off. Step the Red channel up 14 presses, the Green channel up 6 presses, and one press up for Blue. Save to M3.

Moonlight:
000 003 001 001

Again, start at zero. Press the Red channel up 2 presses (close enough, as before), and Blue and Green each get one tap up. Save to M4.

Now the light is programmed in sync with the controller, the controller is programmed to match the light (I can explain why this is needed if you want), and everything is ready to run. 

*Yes. It's a bit of a pain*. But you basically do this ONCE, and you're done. 

Note that if you decide to tweak your colors with the remote, and you find one you like, you'll need to carefully record how you get to the new settings so you can adjust the settings in the controller to match the new preset on the light. But that's not likely something you'll do too often once you find settings you like.

But after the colors and times are all dialed in, you're done. Every now and then you'll want to adjust the clock to correct for drift (and Daylight Savings Time), but otherwise, you'll never have to touch it again.

This seems pretty complicated, I suspect, and a little intimidating, but really do I think it should all be pretty clear once you actually wade into it. That said, if anyone needs an actual video how-to on color settings I can probably do something at some point. Honestly, though, the hard part has been done by others. It's not very difficult to set up if you just follow the steps one by one.

*THE CURRENT WORKING CODE FOR SAT+ LIGHTS (non-PRO version) IS NOW ATTACHED TO THIS POST. NOTE THAT YOU MUST USE THE OLDER VERSION OF THE ARDUINO SOFTWARE TO COMPILE PROPERLY (1.0.6, still available to download).*


----------



## kman

Code added to post above. Hopefully someone finds it helpful. 

A number of people have noted that there are still a few bugs to work out in stock code (ok, xtremebassist has done the most work on this by far), and those are still present (I think there is, in particular, some bug with setting fades for midnight?). As fixes come in, however, I'll do my best to keep the Sat+ version of the code updated.

But for a majority of Sat+ users, I think the code I just posted is 100% ready to go to work in real world environments.

NOTE: I have not, to date, made the changes xtremebassist noted as necessary for the new Arduino IDE software that was released a few months ago. The code I just posted works and compiles just fine using the prior version (1.0.6). New users pulling down the the software from the Arduino website (current version is 1.6.3 as of this moment) will either want to seek out these prior versions (they're still available right on the Arduino download page, see "Previous IDE releases"), or will need to make the code changes xtremebassist mentioned above (see posts #99 and 141).


----------



## kman

xtremebassist said:


> .
> 
> FleaBay - 381036289375
> 
> I commented all my code and used the naming standards and programming convention of the original code. Incorporated the existing menu & drawscreen functions. There are a extra pulsecount and alarm daily reset alarm functions. Most of the distinct flow code lies in the first part of setup and the first part of the loop. The additional menu code is place after the previous menu code. All should be pretty easy to spot.
> 
> Don't use if you don't have a flow meter because it will try to process the flow pulses every second and there is no way for it to detect it not present and not do it or menu option to disable the flow functionality.


My flow sensor arrived today. 

I'm going to back-burner this, though... I need to connect it inline with my canister and do some tests (read: timed bucket filling!) to see how much it impacts my flow rate. If the flow rate is still good, I'll probably add it in. Although I'll need to figure out a nice clean way to add it to the enclosure, since AH's original design is so neat and clean and I don't want to mess that up any more than necessary.


----------



## xtremebassist

Great work and write up on the Sat codes. Definitely took some effort since the IR codes don't match. 

For the flow meter to connect it nice I'm waiting on this from Fleabay:

151424395128

This should work with the case since they are right angle pins. Then I was looking to use these:

181700286455

To connect the cable to the pins. Finally I'm hoping this is the right connector for the 3 pin Flow meter piece:

111380527966

If not I got some old CPU case around with similar 3 pin connectors that will work. If all goes well, should be able to wire up the flow meter without soldering like AH original design. I'm looking at use 3 wire thermostat cable from HomeDepot. You can just use the basic Arduino jumper wires if you place the flow meter close enough. 

I'm looking to pimp out my iAquaLite a little more. Thinking of adding a couple of pressure transducers. Due to my tank build it would be nice to look at the PSI measurements of the filter as well as the flow. Also thinking about maybe adding a the "cloudy sky" preset in the middle of the daylight fade. Kind of like the effect and I was thinking I could use a random effect so it wouldn't be every day. With that said, I might have to fix more of the 12 / 24 hours issues I seem to encounter.


----------



## kman

Interesting idea. I look forward to seeing photos of the final flow connector installation. I have plenty of right angle headers.

Have you ever played with crimping those Dupont connectors before? Looks like an incredible PITA. I think you need a special crimping tool, too, and the ones that I've seen on Amazon (that don't have zillions of complaints in the reviews) aren't cheap. I find it easier to buy a bag of prewired connectors and just extend the wires as needed.

There's a bunch of random thunderstorm code in the original Arduino controller thread that you may be able to re-use.

I'm not sure how much I want to pimp my iAqua Lite, though. I kinda like it simple. I'd look into the full iAqua, instead, if I were you, for additional pimping. At least that's already set up to deal with lots of i/o wiring, since it's needed anyway, unlike the purposely simple iAqua Lite.

I have to admit, though, as much as I liked my original Arduino light controller (from the other thread), I'm a LOT happier with the iAqua light, since the fades match up so well with the full iAqua, and more importantly, since there is a direct button interface so simple things like clock and schedule adjustment can be handled without disconnecting the whole thing and bringing it over to hook up to a computer.


----------



## natebuchholz

Hey guys, just received all of my parts to assemble. Everything seems to be working well with the exception of the time. I am unable to set it and have it save. Does anyone have any ideas why? thank you for all the help.


----------



## kman

natebuchholz said:


> Hey guys, just received all of my parts to assemble. Everything seems to be working well with the exception of the time. I am unable to set it and have it save. Does anyone have any ideas why? thank you for all the help.


Which code did you use? Another Hobby's original code has some errors.

Another thing to check is that your clock chip is in correctly, that the battery is installed facing the right way (the writing should face out so you can read it), and that the battery actually has some juice. I've bought a few that arrived with dead batteries, unfortunately.


----------



## natebuchholz

kman said:


> Which code did you use? Another Hobby's original code has some errors.
> 
> Another thing to check is that your clock chip is in correctly, that the battery is installed facing the right way (the writing should face out so you can read it), and that the battery actually has some juice. I've bought a few that arrived with dead batteries, unfortunately.


I have used Extremes updated version with AH's original. I believe the battery is installed properly. The battery could be a possibility. Does the date use the RTC to store its information; because I can store that info with the current battery installed.


----------



## kman

natebuchholz said:


> I have used Extremes updated version with AH's original. I believe the battery is installed properly. The battery could be a possibility. Does the date use the RTC to store its information; because I can store that info with the current battery installed.


The time and date is of course dependent on the RTC. It is not stored anywhere else (if it was, it would be outdated from the moment it was written/saved).

The settings, OTOH, such as fade schedules, WRGB settings, and power settings, are all stored in eeprom, so they remain intact if power is lost. If the RTC battery is dead, however, and power is lost for a moment, the time and date are reset to zero. (midnight, Jan 1)


----------



## natebuchholz

kman said:


> The time and date is of course dependent on the RTC. It is not stored anywhere else (if it was, it would be outdated from the moment it was written/saved).
> 
> The settings, OTOH, such as fade schedules, WRGB settings, and power settings, are all stored in eeprom, so they remain intact if power is lost. If the RTC battery is dead, however, and power is lost for a moment, the time and date are reset to zero. (midnight, Jan 1)


 When I cut power to the unit, the date will remain. This leads me to believe that my RTC is both installed correctly and has battery power. Am I correct in assuming this? 

Any alternative ideas about what is going on?


----------



## xtremebassist

Sounding like you might have a battery or RTC issue. The code in question is this piece:



Code:


 // if the select button is pressed in the time or date menu, and we are editing, set the RTC immediately
      if (menu.getCurrent().getName() == "SET TIME") {
        if ( editingActive == true ) {
          if (_24hr==false) {
            if (saveRTC.tAM==false) {
              if (saveRTC.tHour!=12)
                saveRTC.tHour=saveRTC.tHour+12;
            } else if (saveRTC.tHour == 12) {
              saveRTC.tHour = 0;
            }
          }

          time_t t;
          tmElements_t tm;
          tm.Year = CalendarYrToTm(year());
          tm.Month = month();
          tm.Day = day();
          tm.Hour = saveRTC.tHour;
          tm.Minute = saveRTC.tMinute;
          tm.Second = saveRTC.tSecond;
          t = makeTime(tm);

          if(RTC.set(t) == 0) setTime(t); // set RTC if successful

          setSyncProvider(syncProvider);
        }
      }
      
      if (menu.getCurrent().getName() == "SET DATE") {
        if ( editingActive == true ) {
          
          time_t t;
          tmElements_t tm;
          tm.Year = CalendarYrToTm(saveRTC.tYear);
          tm.Month = saveRTC.tMonth;
          tm.Day = saveRTC.tDay;
          tm.Hour = hour();
          tm.Minute = minute();
          tm.Second = second();
          t = makeTime(tm);
          
          if(RTC.set(t) == 0) setTime(t); // set RTC if successful
          
          setSyncProvider(syncProvider);
        }
      }

I tweaked it so you can save it during noon or midnight. Before it would automatically flip flop and it wouldn't save the date. 

There is also this chunk of code when it first starts up:



Code:


RTC.get();
  lcd.begin(16, 2);  

  // sync the RTC to the Arduino
  setSyncProvider(syncProvider);

  // for troubleshooting, output to serial if the RTC is running or not
  if (! RTC.haltRTC()) 
  {
    // If no RTC is installed, alert on serial
    Serial.println("RTC is stopped!\n");  // Store this string in PROGMEM
  }
  else Serial.println("RTC is running!\n");  // Store this string in PROGMEM

If I run the Serial Monitor, I always get the "RTC is stopped!" print out because the logic is backwards :hihi: It should be this:



Code:


if (RTC.haltRTC()) 
  {
    // If no RTC is installed, alert on serial
    Serial.println("RTC is stopped!\n");  // Store this string in PROGMEM
  }
  else Serial.println("RTC is running!\n");  // Store this string in PROGMEM

Without the "not" (!). Try booting it and have the serial monitor enable. If it says "RTC is running!" then your clock is having issues.


----------



## xtremebassist

kman said:


> Interesting idea. I look forward to seeing photos of the final flow connector installation. I have plenty of right angle headers.


Haven't got my right angle headers yet but was able to wire the backside permanently. 


















kman said:


> Have you ever played with crimping those Dupont connectors before? Looks like an incredible PITA. I think you need a special crimping tool, too, and the ones that I've seen on Amazon (that don't have zillions of complaints in the reviews) aren't cheap. I find it easier to buy a bag of prewired connectors and just extend the wires as needed.


Yeah even me being trained as a musician those Dupont connectors are kind of PITA. After about three tries, you get them down. This guy's method seemed to work best with me by putting the cable in the connector first and then into the crimper:

https://www.youtube.com/watch?v=GkbOJSvhCgU

Works best with two hands so I got the wife's help and knocked them out. Ended up using the extend wires like you mentioned because the thermostat wire is 18g and pretty stiff. I just put some shrink wrap over them and they are working like a champ.




kman said:


> I'm not sure how much I want to pimp my iAqua Lite, though. I kinda like it simple. I'd look into the full iAqua, instead, if I were you, for additional pimping. At least that's already set up to deal with lots of i/o wiring, since it's needed anyway, unlike the purposely simple iAqua Lite.


I agree, I like how simple it is and the fades are perfect! I just noticed it has a lot of extra horsepower sitting around and I could use it for my tank build needs. I bought Apex Neptune earlier so I've been adding features to iAquaLite that Apex won't do for my build. 










I'll start a tank build thread but I might as well let the cat out of the bag about my build. 

I'm building a coffee table tank so the flow meter let's me tell when it is time to clean the filter:























Hehehehe, you can see my ghetto fabulous mounting job. Going thru my next couple of stages of testing before I finalize it. What you are seeing is the extreme rough. The top piece of glass is some skylight piece I found in my laundry room when I moved in. Trying to get this baby self contained, low maintenance as I can.

iAquaLite's IR transmitter is really good. You can see from my photos I have it mounted right next to E-Series and it controls it perfectly.


----------



## kman

I'm a little surprised the Apex can't handle a flow meter?

But that's going to be a sweet build. Be sure to post the build thread back here so we don't miss it.


----------



## xtremebassist

Apex is pretty much cookie cutter stuff like ph, orp, salinty, etc probes. It's break out box only handles on / off switches. I don't see any way to add a flow meter 

I loved how iAquaLite handles an extended lighted period like what I will need with the coffee table. I setup Innovative Marine tanks for the kids and ended up using two timers to get the extended daylight (can't fade their LEDs) since they have power supplies for white and blue. I could get a happy medium where I don't have algae bloom since they are low tech tanks.

I've thought about having iAquaLite sync the time of E-Series so you don't have two places to set the time. I noticed a little drift in my RTC so haven't went for it yet.

If I get some time, I'll revisit the whole time thing with the code. I see where AH define a time structure but never used it



Code:


struct RTC_T  // used for time
{  
  int tHour;
  int tMinute;
  int tSecond;
  boolean tAM;
  int tDow;
  int tDay;
  int tMonth;
  int tYear;
} 
prevRTC, saveRTC;

prevRTC is used nowhere. It seems where the code gets goofy is when AH is trying to deal with displaying 12 hour clock. I would've made a "displayRTC" to store the display and there I could modify it to be 12 or 24 hour. The RTC and Arduino clocks are 24 hour so I would use the saveRTC for actually saving values always in 24 hour format. The code is trying to juggle saving the time and display the right format at the same time, same place and that is where things start to go awry. For the actual fades AH uses Unix time so no issues there. Just when saving & displaying time settings.


----------



## kman

xtremebassist said:


> Apex is pretty much cookie cutter stuff like ph, orp, salinty, etc probes. It's break out box only handles on / off switches. I don't see any way to add a flow meter


Hmm. I haven't looked too much into it. I was under the impression you could add random hardware, such as the DIY dosing pumps instead of the special prepackaged ones, but maybe that's a specific case. 

Food for another thread, perhaps.


----------



## natebuchholz

It is fixed, my code was messed up. Thank you extreme and cool project above. excited to see how it progresses


----------



## xtremebassist

Glad you got the code working. iAquaLite works great! Once you get the rest of pieces it is cactus, drop it on the ground and walk away :hihi: The fades are really smooth and it turns the light on and off with no problem. I can't see having an E-Series / Sat without it to be honest. Their built in program and ramps are pretty limited. Slick of AH to make a IR remote controller so you can see the real potential of these lamps.

Apex is pretty sweet. It works mostly by controlling outlets so you can have a DIY dosing pump because you can turn the power on & off via times & conditions. Over priced in my opinion but I was looking at a ph controller so when you compare that cost plus all the other things an Apex can do, it was almost worth it :hihi: It does have a variable output were you could control dimming of lights but it couldn't come close to iAquaLite in this scenario. I have my Tunze pump hooked up to its variable speed but haven't dorked much with it yet. It would be cool if I could tap into the seasonal table for daylight times built into the Apex but again iAquaLite just rocks all by itself. 

For my build I got several LifeGard filters off of Craig's List. They were the only canister filtration I could think of that you could mount horizontally so to fit under the coffee table. The mechanical filter has an overkill micron cartridge in it so the iAquaLite w/ Flow will give me indication when it gets clogged by seeing the flow drop. The biological filter canister the guy sold also has the same cap & pressure gauge as the mechanical filter. It allows me to bleed out all the air in the system. The pressure gauges on them is also how to tell when they are getting clogged. The gauges are pretty cheesy so that is where I was looking at this on evilBay:

171527601550

Since there is plenty of horsepower left in the iAquaLite, I'm going to setup a pressure screen like with the flow meter. The pressure is linear and should be pretty straight forward. Accuracy isn't a real concern, just want to have an external visual clue and not have to peak underneath and gauge if the water flow has dropped considerable. Plus the flow meter should help chop up co2 bubbles from the atomizer. I don't like that 7up tank look. Apex doesn't seem to have anything to handle variable inputs, just on / off so iAquaLite is the perfect tool for the job. 

Trying to get the kids interested in Arduino & Raspberry PI so hence the additions, crimper and connectors. Still probably build another pure iAquaLite for my wife's shrimp tank in the future. You could probably stick a thermometer on it pretty easy ........ :hihi: Nah, it will be pure and no unnecessary pimping.


----------



## natebuchholz

That's all really great Extreme! Im really interested in coding something like this. Do you have any resources that would be useful for a beginner like me to cut my teeth on?


----------



## xtremebassist

This is my first attempt at programming an Arduino myself. I'm a closet programmer so all the syntax and function goop made sense to me but for the Arduino code / functions, I used Google and found a bunch of sketches like this flow meter:

https://www.youtube.com/watch?v=HMtp8cs0Mxs

Then I've been looking at the reading of Analog Voltage:

http://www.arduino.cc/en/Tutorial/ReadAnalogVoltage

And the pin outs of the board. Knowing the interrupt pins are key:

http://forum.arduino.cc/index.php?topic=125908.0

We were all spinning wheels until I figured out we need to "pull up" the IR pins to get the thing to work :hihi: Can't tell you how many times I was powering up the thing pointing it to the E-series with AH original code with bukis. Dooh! I was about to order another IR transmitter but finally looked at the code for the RTC and saw the pins being "pulled up" but nothing for the IR transmitter. It finally dawn on me that bank of pins that AH used were digital pins.

You can use analog pins but I'm learning that the digital pins have "pull up" resistors on them. Basically a built in way to prevent a short. So I might switch up the code & pins on my iAquaLite_Flow in the future. 

Looking at the Raspberry PI for the kids since it uses Python language which is easier to understand that C++. Fortunately AH didn't program with typical C spaghetti code. C language is your drinking buddy and not your friend. It will allow you to do something totally stupid :hihi: Hence why viruses are written in C. 

There are ton of cool projects out there for Arduino and with this Mega board, you really have a lot of power and options. If you need more precision I would look to using a 9V power supply instead of the 5V USB we are using. I would think you would get more reliable results because not sure how constant the voltage is with USB.

I think Arduino has flash EEPROM capability of like 10,000. So you can pretty much go hog wild trying and uploading new code. You see they are pretty cheap on Fleabay. Waiting for the local RadioShack to finish going out of business and putting a huge discount on them. The have it listed for like $70.00! No wonder they are going out of business 

I did come across this awhile back and it looks real promising if you want an "out-of-the-box" solution:

http://www.cooking-hacks.com/docume...arium-aquaponics-fish-tank-monitoring-arduino


----------



## xtremebassist

*Zigo Case*

My Zigo case finally arrived and unfortunately I can say it is crap  



He engraved the logo on the top even though his reply email from my order was that he wouldn't engrave it. Of course the logo sits right on top of the LCD.
There are no holes cut out to get power to the board. Same to sides just one without "Arduino Inside"
The one side is badly machined and it won't fit.
Fun waiting over 5 weeks for some that doesn't work out of the box  Looks like the site is offline so maybe I got the last hurray of parts. Doubt he will respond to my emails. I will try to salvage it but definitely looking for another box. The one I got from evilBay was machined well but it just covers the board. If I find a good box, I'll post. I can't recommend the Zigo box for sure.


----------



## natebuchholz

^disappointing. I also ordered one and have yet to receive it; 4 weeks now. I now have little hope it will be adequate.


----------



## xtremebassist

Yeah disappointing. It is workable because it all will fit in the case. Just sucks I got to make it fit and cut out the logo over the LCD & for the power :-( I bought 381093754869 off Fleabay and it is great. Fit together perfectly. There are plenty of such cases for even cheaper but I found this guy's video on putting it together (totally different case now) and figured it was worth the couple of extra bucks. It just doesn't protect the LCD, IR transmitter or RTC. Kind of weird that LinkSprite since they make the LCD, don't have a case that fits their LCD when it is plugged into the board. Even the case they offer that will fit the LCD doesn't give you access to the buttons. I'll keep looking since it seems nobody really injection molds cases for Ardunio, only CNC machined ones.

iAquaLite is working perfectly and I couldn't be happier with it. Might look to see if I can turn off that red LED on the LCD since I can look at the LCD to see it working.


----------



## Fodder

xtremebassist, I'm not going to use my Zigo and would be willing to send it to you. The very bottom plate cracked in shipping (or they put it in the box that way) and the top has the logo in it even though I requested it be left blank. The rest of it is nice, fits well and has the proper holes.

If you PM me a shipping address I'll send it to you.


----------



## kman

Hey, Fodder, if xtremeb doesn't want it, I'll take that extra case off your hands! Happy to pay your for the case plus reasonable shipping fees.

Bummer if the Zigo thing doesn't straighten out. The cases are pretty perfect (size-wise). I THINK I'm still waiting on one but it's so hard to tell for sure, given the bizarre paypal setup he had going on. The one case I got was pretty perfect, though... I'd like a decent case for my second controller at the office.

Bump:


xtremebassist said:


> Yeah disappointing. It is workable because it all will fit in the case. Just sucks I got to make it fit and cut out the logo over the LCD & for the power :-( I bought 381093754869 off Fleabay and it is great. Fit together perfectly. There are plenty of such cases for even cheaper but I found this guy's video on putting it together (totally different case now) and figured it was worth the couple of extra bucks. It just doesn't protect the LCD, IR transmitter or RTC. Kind of weird that LinkSprite since they make the LCD, don't have a case that fits their LCD when it is plugged into the board. Even the case they offer that will fit the LCD doesn't give you access to the buttons. I'll keep looking since it seems nobody really injection molds cases for Ardunio, only CNC machined ones.
> 
> iAquaLite is working perfectly and I couldn't be happier with it. Might look to see if I can turn off that red LED on the LCD since I can look at the LCD to see it working.


Yeah, I'm going to keep an eye out, too.

I agree the perfect case would case let you push buttons while remaining closed... I'd almost be willing to glue the case closed if I could still get to the buttons. It's a little funky popping off the top and squeezing my fat fingers in to push the buttons. Fortunately that's pretty rare, since everything is humming along nicely now and don't really need to tweak anything (just twice per year for daylight savings, and perhaps every couple of months to correct clock drift... maybe).

That Fleabay board you found looks like a decent (and very cheap) semi-protective option. I may just grab one. At least it gets the bottom of the Arduino protected, and offers some corner protection and gives a way to hold it without touching circuitry. Good find! I hope they get more in stock? EDIT: This looks similar, and might work the same way? EvilBay Item # 291422910332

Ideal is a taller version of item 281618337463 (sized for the Mega, of course). Then the lid could be easily flipped open to access the buttons when needed.

And yes. That red LED is pretty obnoxiously bright. I've been considering hitting it with a sharpie. Or even a paint pen!


----------



## xtremebassist

Thanks Fodder, I think I'm all set. Had to get Dremel on its @ss. Not the prettiest but I made the cutouts and tweaked the side so it all fits together. Still stuck with the logo which sits across the LCD. Ditched the top for now. Might try to build one without the logo but it still be a PITA with just a Dremel. You might want to hook up natebuchholz if he doesn't get his or kman.

It does look like EvilBay Item # 291422910332 is the same enclosure. Since they are CNC they should all be same. No clue why Zigo sucked. Guessing he is going out of business and just selling scrap. The EvilBay case works good enough to protect your board without costing a fortune.

I looked at these guys before and I think I'm going to reach out to them:

http://www.tux-lab.com/product_detail?id=3

Main selling point for me is the country of origin  I'm thinking about asking them to design a box cover to their aluminum chassis for our project. If not, it might be easy enough to stack an acrylic box on it.

Definitely see what you mean with the Zigo case about sticking your fingers to tweak the buttons. Looking at the schematics / datasheet seems like that LED is hard wired. You are right, might need to hit it with a paint pen.


----------



## Fodder

kman said:


> Hey, Fodder, if xtremeb doesn't want it, I'll take that extra case off your hands! Happy to pay your for the case plus reasonable shipping fees.


PM me your address and I'll ship it. No need to compensate me for it - just pay it forward someday.


----------



## kman

Fodder said:


> PM me your address and I'll ship it. No need to compensate me for it - just pay it forward someday.


Very kind of you, although again, I'm perfectly happy to paypal you $20. Have a couple of beers on me. 

PM sent.


----------



## AlanLe

Finally subscribed to this thread. I'm bored of seeing my ecoxotics go on and off without any effects. 


-Alan


----------



## kman

AlanLe said:


> Finally subscribed to this thread. I'm bored of seeing my ecoxotics go on and off without any effects.


You're going to like it. I recommend reading the thread backwards from the end, to get the current working code. Since AH disappeared, the earlier posts can't be updated, and there were some issues in the original code.

The case is the biggest issue at the moment since the guy selling it appears flaky, but there are options (and it's somewhat optional anyway). Otherwise, start ordering the parts on the first page! (if you can't find some parts, replacement options are sometimes covered in later posts by myself and others)


----------



## AlanLe

kman said:


> You're going to like it. I recommend reading the thread backwards from the end, to get the current working code. Since AH disappeared, the earlier posts can't be updated, and there were some issues in the original code.
> 
> The case is the biggest issue at the moment since the guy selling it appears flaky, but there are options (and it's somewhat optional anyway). Otherwise, start ordering the parts on the first page! (if you can't find some parts, replacement options are sometimes covered in later posts by myself and others)



Thanks! I'll order the parts. 


-Alan


----------



## HolyAngel

Ok, I bit the bullet and ordered all the parts for this. Going to try my hand at it. I've scoured the thread and pulled the patches and whatnot, I usually make kernels and such for android as my other hobby so the code makes sense to me at least and I want to adapt this to a fluval aquasky led. I've already pulled the IR codes from the remote for it.

Any chance someone can point me to a github or zip of the latest %100 fixed/working files to program it? So far it looks like I need the original AH zip, xtremebassist patch, rtc clock fix, and possibly kman's files too.. Am I missing anything?

Edit: forgot to mention, THANK YOU to all who have pioneered this process. Should have all the parts coming in this week but will have to get an ir receiver in order to pull the ir codes from the aquasky. I was able to program it with my phone but the app doesn't give me access to the codes.. I do have a windows media center ir receiver but haven't been able to find any software that will let me pull the codes with it.. At worst I'll wait on this until I eventually get my planted+ 24/7.


----------



## HolyAngel

hmmm so I can't get this to compile with any of the ide's using xtremebassist patch files. 1.0.5 has a ton of erros. 1.6.x gives me much less but still can't do it. 

AH's original files compile fine however but I know i'm missing the clock/date fixes. Going to try and make those changes myself and see how it goes. I definitely feel like I'm missing some code even though I've read this thread front to back at least 12 times. :/


----------



## AlanLe

HolyAngel said:


> hmmm so I can't get this to compile with any of the ide's using xtremebassist patch files. 1.0.5 has a ton of erros. 1.6.x gives me much less but still can't do it.
> 
> AH's original files compile fine however but I know i'm missing the clock/date fixes. Going to try and make those changes myself and see how it goes. I definitely feel like I'm missing some code even though I've read this thread front to back at least 12 times. :/



Please keep is updated. Im still waiting for the parts to arrive.


-Alan


----------



## HolyAngel

AlanLe said:


> Please keep is updated. Im still waiting for the parts to arrive.
> 
> 
> -Alan


Will do ^^ If I can't get an updated working folder set of all the files from someone here then I'll do the patches myself and upload it for all, as well as put it on github.


----------



## HolyAngel

Ok, pushed everything i've been able to find on this thread to github with (at least decent [emoji14] ) commit history. I've been able to compile this with Arduino IDE 1.6.0, I haven't had a chance to try 1.6.4(latest) yet. 

https://github.com/holyangel/iAqua-Lite.git

If I missed anything i'd love comments on there, or pm's/post's here, whatever's easiest for you. I haven't gotten in my LCD or IR Receiver yet. I've only received the arduino itself and the IR transmitter so I can't test this yet. I don't have an ecoxotic or sat+ yet either or i'd test it without the screen so yeah. Will be a bit before I know for sure.

Edit: forgot to mention, I didn't add in the patch from xtremebassist as I still can't get it to compile..
I did get my LCD today however so will at least see if I can get it up and running and loaded tomorrow for testing with what I have gathered so far.


----------



## HolyAngel

Hmm.. well the time functions are definitely messed up. I mean I don't have the RTC yet but I should still be able to set the time. If I try it as soon as I hit select to finish it just resets the clock back to 12am/00:00. The same thing happens with the Light On/Off function, I can't set it to anything but 12:00am/00:00. Going to have to go over the code again.

Edit: Looks like the power off time and clock time/date can't be set. Only power on and fade schedules can be set. I don't have my RTC yet but that shouldn't stop it from setting those I would think...


----------



## xtremebassist

I've been using Arduino 1.6.1 to compile the sketches. Most errors I encountered were from the header files not properly declaring variables. You will see some of the errors and fixes in this thread. 

I believe AHs code is always writing to and reading from the RTC so if you don't have it plugged in, it will always revert back to midnight. He just saves the fade schedules to EEPROM. His code juggles the time from 12 and 24 hour format and things get a little squirrely there. I believe I fixed all the ones I came across. You typically see it when you try to save something at 12:00 AM and once saved, it reverts to 12:00 PM. 

I believe the Lights off / on issue was with the use of the wrong variables that should've been resolved. I'm pretty sure I cleaned up the code here but taking account for 12:00 AM:



Code:


lcd.setCursor(0,1);
  boolean pm=false;

  if (_24hr==false) {
    if (onHour >= 12) pm=true;
    if (onHour > 12) onHour=onHour-12;
    if (onHour == 0) onHour=12;
    if (onHour < 10) lcd.print(" ");
  }
  else {
    if (onHour < 10) lcd.print("0");
  }

Really should do a rewrite of the code so it just keeps the time in 24 hour format and only worries about 12 hour when it gets displayed. I haven't changed the default fade schedules so more of this can still be lurking in the code.


----------



## HolyAngel

xtremebassist said:


> I've been using Arduino 1.6.1 to compile the sketches. Most errors I encountered were from the header files not properly declaring variables. You will see some of the errors and fixes in this thread.
> 
> I believe AHs code is always writing to and reading from the RTC so if you don't have it plugged in, it will always revert back to midnight. He just saves the fade schedules to EEPROM. His code juggles the time from 12 and 24 hour format and things get a little squirrely there. I believe I fixed all the ones I came across. You typically see it when you try to save something at 12:00 AM and once saved, it reverts to 12:00 PM.
> 
> I believe the Lights off / on issue was with the use of the wrong variables that should've been resolved. I'm pretty sure I cleaned up the code here but taking account for 12:00 AM:
> 
> 
> 
> Code:
> 
> 
> lcd.setCursor(0,1);
> boolean pm=false;
> 
> if (_24hr==false) {
> if (onHour >= 12) pm=true;
> if (onHour > 12) onHour=onHour-12;
> if (onHour == 0) onHour=12;
> if (onHour < 10) lcd.print(" ");
> }
> else {
> if (onHour < 10) lcd.print("0");
> }
> 
> Really should do a rewrite of the code so it just keeps the time in 24 hour format and only worries about 12 hour when it gets displayed. I haven't changed the default fade schedules so more of this can still be lurking in the code.


Yeah I agree, all the time code should be 24hr by default and only display 12hr if that's what the user wants. I did find the fix to the light power off time not saving, was the wrong variable. Just gotta push it to github. Only bug I can see left is I can't set the current time/date... but you're saying if the rtc is not plugged in then that's why its not saving? If so then it's done for now. Thanks for posting 

Also would be interested in working in that timelord library at some point, may have to get a hold of scallas ^^


----------



## xtremebassist

Yeah AH has his code always saving the time to RTC even if you just look at the setting:



Code:


// if the select button is pressed in the time or date menu, and we are editing, set the RTC immediately
      if (menu.getCurrent().getName() == "SET TIME") {
        if ( editingActive == true ) {
          if (_24hr==false) {
            if (saveRTC.tAM==false) {
              if (saveRTC.tHour!=12)
                saveRTC.tHour=saveRTC.tHour+12;
            } 
          }

          time_t t;
          tmElements_t tm;
          tm.Year = CalendarYrToTm(year());
          tm.Month = month();
          tm.Day = day();
          tm.Hour = saveRTC.tHour;
          tm.Minute = saveRTC.tMinute;
          tm.Second = saveRTC.tSecond;
          t = makeTime(tm);

          if(RTC.set(t) == 0) setTime(t); // set RTC if successful

          setSyncProvider(syncProvider);
        }
      }

I've been noticing a drift in the RTC that Ecoxotic doesn't experience. I thought about using an alarm to sync the time from iAquaLite because after a week, they get out of sync. Also my LinkSprite LCD start cheesy out on me and apparently there isn't any support from their website :-( So I'm thinking about biting the bullet and trying out the Yun Shield:

http://www.geeetech.com/wiki/index.php/YUN_SHIELD

The newer version looks like it will fit, I can use NTP to sync the time, create an html web interface to configure iAquaLite and display feedback from the additional sensors I'm using. I see them hovering around $21 - 30 on evil bay. I'm looking at a replacement Chinese LCD still so to have the original interface. I can probably ditch the RTC and use the Yun shield & NTP instead.


----------



## HolyAngel

That sucks your lcd is going out. I did figure there wouldn't be much support from linksprite, the screens are so cheap so they probably figure you should just buy another :/

That yun shield looks pretty nice though, the NTP would definitely be better than the RTC and wifi connectivity is always nice... Could even make a mobile interface or app for it.. Would require rewriting the code though.. Github would be super useful here lol, I can always make you a contributor on mine if you want, just make a new branch and code away or make you're own. I'd definitely be interested in messing with it.


----------



## Dmarksvr

Dmarksvr said:


> :help: Could someone who has done one of these cross faders for Ecoxotic post a vid of it working? ...Perhaps timelapse? ...So we can get a feel for how cool it is before we jump in? :help:
> 
> :iamwithst


I've gotten a bit lost in this thread. I can't tell where the original project ends and if all this extra code stuff and whatnot is just to expand its functionality or integrate it with an actual I aqua, or just to get the original version working?

At first I thought as an arduino newb I might be able tackle this, but things are so convoluted now I'm not sure which posts are relevant to completing just the original crossfader?

Also i know this supposed to be a a simple project, but if anyone could make a video Snaping this together step by step, and going through set up, to showing it working, and maybe how to change setting do different cycles... that would be really helpful for us confused arudino sissies 

Crossing my fingers


----------



## xtremebassist

I like Holy Angel's concept of Git Hub. There are couple of patches to original code to get it working. Enabling the IR transmitter is the key and then there are some fixes on how it saves times. I've personally haven't done anything but the default fades which work great for me.

Got to troubleshooting the LinkSprite LCD and I see the analog input values from the buttons got cheesy. Just needed to capture and then tweak the values. To capture the values, I added this Serial output:



Code:


//read the button ADC pin voltage
  buttonVoltage = analogRead( BUTTON_ADC_PIN );
  [COLOR=Red]Serial.println(buttonVoltage);[/COLOR]

and pushed the buttons to get the correct values. Then I just updated them in the declaration:



Code:


// ADC readings expected for the 5 buttons on the ADC input
#define RIGHT_10BIT_ADC          0  // right
#define UP_10BIT_ADC            142  // up
#define DOWN_10BIT_ADC          325  // down
#define LEFT_10BIT_ADC          489  // left
#define SELECT_10BIT_ADC        690  // right

Not sure how long the LCD will last but if others run into issues with the buttons but the LCD is still working, this might be the fix.


----------



## HolyAngel

Dmarksvr said:


> I've gotten a bit lost in this thread. I can't tell where the original project ends and if all this extra code stuff and whatnot is just to expand its functionality or integrate it with an actual I aqua, or just to get the original version working?
> 
> At first I thought as an arduino newb I might be able tackle this, but things are so convoluted now I'm not sure which posts are relevant to completing just the original crossfader?
> 
> Also i know this supposed to be a a simple project, but if anyone could make a video Snaping this together step by step, and going through set up, to showing it working, and maybe how to change setting do different cycles... that would be really helpful for us confused arudino sissies
> 
> Crossing my fingers


Not sure I can do the video but it's pretty easy from the pics. For the code, check my github page here, there's a 'download zip' button on the right that you can click to grab the updated code. Once it's downloaded, unzip it into documents/arduino folder on your pc. Open arduino ide, go to file->Sketchbooks and you should iaqualite in there, if not just do file->open and point to the iAquaLite.ino file in the folders you extracted. Once it opens you and you have your arduino connected, click Sketch->verify/compile, if it compiles, follow up with file->upload.

--

Side note: I finally got the RTC today! Plugged it in and couldn't get the date/time to save after a power loss. Took me about 5 min to figure out they shipped it with the battery in backwards! Turned it around so the '+' faces me and bam, works! So i'm thinking all my code on github is perfect. 

If anyone would like to go over it and make sure it's good that'd be helpful but I do think its all good. Only thing missing at this point might be that timelord library to follow the sunrise/sunset/moon phases but thats no biggie, important thing is that it works as is.

It'd be really nice if everyone doing these arduino/custom controller projects that are posting the code here would just upload it all to github. This way the code is never lost if someone leaves the forum, and anyone can fork it and improve upon it so anyone else can use it without having to hunt through 100's of pages, its all %100 free. I'm tempted to just to go around this subforum and do it myself lol but it's hard to find all the code and updates :/


----------



## kman

I can't recall if I ever posted my code. Works well in the original IDE (1.0.5 or 1.0.6), but mine is modified for the Sat+ instead of the Ecoxotic. I have two of them up and running, one at home, and one in the office.

Edit: Ah, yes, I did, back in April. Post #143 has the full working code for Sat+ lights, and setup instructions.


----------



## kman

Dmarksvr said:


> Also i know this supposed to be a a simple project, but if anyone could make a video Snaping this together step by step, and going through set up, to showing it working, and maybe how to change setting do different cycles... that would be really helpful for us confused arudino sissies


Snapping it together truly is as simple as AH's original instructions indicate. Literally all you do is plug in the RTC and LED boards, and then plug in the LCD on top of everything. AH's photos are lovely and clear, and as long as the pins are in the right holes, you're done with assembly, and haven't even touched a computer.

For the computer part, yeah, you need to find the right code, but it's all here somewhere. I'm pretty sure someone posted (or linked) the full fixed Ecoxotic code somewhere in the past several pages.

Install the software (old version or current version, depending on the software) and the libraries (just copy the files into the right folder and you're good), then literally copy/paste the code in, plug in the USB to your controller, and click upload.

From there, setup is all pushing buttons on the controller itself. AH's original instruction manual that he linked on page 1 of this thread covers that reasonably well. But if you've ever set the clock on a VCR, or a clock radio, or a digital watch, you have all the skills needed to set the time(s) on the controller.


----------



## xtremebassist

Got my Yun Shield and you can stack it on with no issues. You have to use 9v to power the Arduino instead of USB. It is nice you can program it via wireless from your laptop. Just did a week burn it with the Yun Shield just sitting on top with no issues with our current build. I got it off evilbay for $23 bucks:

Item #201359112747

Now that HolyAngel has brought up Git hub, I'm proposing a rewrite utilizing the features of the Yun Shield. First we can ditch the RTC (what I'm messing with now) and use NTP servers from the internet to set the time & date. Next the Yun shield has USB port where you can hookup a SD card. We can then build CSV files for the different lights IR codes and read the variables in the sketch. So when a new light system comes out, just create a CSV file for the light name & IR codes instead of having to unique sketch for each. Then just select your light and go! You can get SD cards for cheap. Plus we can save our settings to a CSV file and keep from burning to EEPROM which has a limited amount of writes. Finally the Yun Shield allows for a Web interface! Can even recreate the light remote so you can manage all the features from your smartphone. 

What do you guys think? I know it bumps the price up and of course it can't fit in the case. Still keep the LCD for a local display and in case of manual updates. Since Yun is Linux I guess we could do MySQL instead of CSV but sounds like overkill now. Many ways to do the Web Interface. Local with HTML5, AJAX, Python, PHP, etc. Or use a cloud service so you can turn your lights on to show your friends from your smartphone as you pull into your driveway. Sky is the limit.


----------



## Dmarksvr

Thanks for the comments guys... I'm still pondering whether or not to attempt this, so I'll be watching. 

So far I'm fairly happy with what my finnex 24/7 does on it's own. I mainly just wanna add a storm event, with sound loop/sound responsive lightning, and timed with a mist system/or rain bar (This is for a vivarium). So I've pretty much got that worked out with a led music controller/extra light bar, and probably an MP3 alarm clock phone app or something; without needing the crossfader, but more functionality is always nice and this arduino stuff is so dang useful :hihi:


----------



## kman

Sounds pretty impressive, xtremebassist, but for me, I'm happy with keeping this as a simple cross-fading timer that fits in a small, compact case. If I was starting from scratch, I'd be interested in the enhanced capabilities for sure, but I like the KISS nature of this particular project.

If you take the project in a more feature-filled direction, I'd be interested in following along, but I suggest perhaps another thread / Project name would be in order? Just to keep what is pretty clearly becoming a different product from the one originally envisioned by AH when he started this off. His was only ever intended to be a simple cross-fading light controller, that needed zero electronics knowledge or soldering skills, just plug everything in, and upload the code, and everything else is done via the pushbuttons. I worry about the price getting too high, for a simple controller, too. (as you mention, the sky is the limit for an enhanced controller, but I think this should remain as simple and inexpensive as possible)


----------



## xtremebassist

I agree with you Kman. I'll split it off to another thread. Basically it will be simple and solderless but have the ability to handle multiple lighting systems like the SAT+ via a config file selection instead of whole different sketch. I'm looking at going with native python and its ConfigParser class. So if you want to control a new light, just create the config with the IR codes. All the light needs is 4 user memory storage places and RGB. AH fade code is solid and works great! Just need a simpler way to control different lights without having to rewrite the whole sketch. 

Finished switching to NTP time and it saved a chunk of memory with all those global variables. So nice not to have to deal with the clock drift or getting my fingers to push the little buttons to update the time. Ditching the RTC seem to remove most of the buggy time setting code too. 

I'll start working on the getting the settings saved and read from a config.ini file. I'll keep you posted on the progress. 

What we've built now works per AH goal with the supplied fixes. If you want to control another light, it is up to you do a rewrite.


----------



## Marthinius

It is possible to reduce the size code for the Arduino UNO board ?


----------



## Harry Muscle

Marthinius said:


> It is possible to reduce the size code for the Arduino UNO board ?


If you're willing to wait I'm working on a light controller that has similar functionality to this one (just lights ... none of the extras that I think have been added in the last few pages) and it will work on an UNO, plus be web enabled so you can check and change things via a browser. I've talked a bit about it in my tank build thread:

http://www.plantedtank.net/forums/showthread.php?p=7847289

Thanks,
Harry


----------



## Harry Muscle

Harry Muscle said:


> If you're willing to wait I'm working on a light controller that has similar functionality to this one (just lights ... none of the extras that I think have been added in the last few pages) and it will work on an UNO, plus be web enabled so you can check and change things via a browser. I've talked a bit about it in my tank build thread:
> 
> http://www.plantedtank.net/forums/showthread.php?p=7847289
> 
> Thanks,
> Harry


I also have a full thread on it with lots more details:

http://www.plantedtank.net/forums/showthread.php?t=867209

Thanks,
Harry


----------



## sma

These may be a dumb questions but 
1. Does the Ardino always have to be plugged in for it to work?
2. Should the ecoxotic automatically connect when it's set up?
3. How close does the ardino and the ecoxotic display have to be to each other?


----------



## xtremebassist

> These may be a dumb questions but
> 1. Does the Ardino always have to be plugged in for it to work?
> 2. Should the ecoxotic automatically connect when it's set up?
> 3. How close does the ardino and the ecoxotic display have to be to each other?


I know it is a tired saying but I truly feel the only dumb question is the one you don't ask.



Yes, the Arduino has to be powered on in order to perform the fades and power off. It utilizes the RTC to keep the time in case of power failure.
Think of the Arduino as your personal remote control butler. As soon as the Arduino is powered on and its IR transmitter is pointing at the ecoxotic light, it automatically starts its program and fades. In a nutshell is Arduino is just manipulating the settings via remote control to produce the fades and power off instead of you.
Definitely at least 18", probably more. Again it is a remote control like the one that came with ecoxotic so it you probably could shoot it across the room. Just be careful of other devices like your TV getting and trying to respond to the IR commands.


----------



## xtremebassist

*Code fix: Button behavior*

Found where you can't exit the WRGB sub menu. Here is the original:



Code:


else if ((changed.from == miWRGB)&&(changed.to == [COLOR=Red]miDAYLIGHT[/COLOR])) subMenu=true;

The fix:


Code:


else if ((changed.from == miWRGB)&&(changed.to == [COLOR=SeaGreen]miMOON[/COLOR])) subMenu=true;


----------



## HolyAngel

xtremebassist said:


> Found where you can't exit the WRGB sub menu. Here is the original:
> 
> 
> 
> Code:
> 
> 
> else if ((changed.from == miWRGB)&&(changed.to == [COLOR=Red]miDAYLIGHT[/COLOR])) subMenu=true;
> 
> The fix:
> 
> 
> Code:
> 
> 
> else if ((changed.from == miWRGB)&&(changed.to == [COLOR=SeaGreen]miMOON[/COLOR])) subMenu=true;


ah nice catch, will get that fixed and uploaded to github ^^

edit: patched! Now i just need to go through the other fixes and verify they are correct for the satplus mod version..


----------



## xtremebassist

Also found this unused structure prevRTC:



Code:


struct RTC_T  // used for time
{  
  int tHour;
  int tMinute;
  int tSecond;
  boolean tAM;
  int tDow;
  int tDay;
  int tMonth;
  int tYear;
} 
[COLOR=Red]prevRTC[/COLOR], saveRTC;

and you can kill the doNothing empty function:


Code:


[COLOR=Red]void doNothing()
{
}[/COLOR]

The rest looks good so far. Thanks HolyAngel for keeping the GitHub for the code.


----------



## sma

Thanks for answering my questions xtremebassist.

There's one more thing i need help on. Everything seems to be working fine except that I can't get the power off working. I'm using HolyAngel's code from github and I'm setting the light to power off at 1:00 am but it seems to just stay in moon lighting all night.


----------



## HolyAngel

xtremebassist said:


> Also found this unused structure prevRTC:
> 
> 
> 
> Code:
> 
> 
> struct RTC_T  // used for time
> {
> int tHour;
> int tMinute;
> int tSecond;
> boolean tAM;
> int tDow;
> int tDay;
> int tMonth;
> int tYear;
> }
> [COLOR=Red]prevRTC[/COLOR], saveRTC;
> 
> and you can kill the doNothing empty function:
> 
> 
> Code:
> 
> 
> [COLOR=Red]void doNothing()
> {
> }[/COLOR]
> 
> The rest looks good so far. Thanks HolyAngel for keeping the GitHub for the code.


No problem! Will get those fixes added in right now ^^

Edit: Patched! Haven't tested any of this but yeah. Let me know if there's anything else that comes up.
@sma, i'm really not sure, I assume you're using the standard iaqua ino for the ecoxotic and not the sat plus mod? I'd say either the controller isn't configured right, or maybe the power off ir code is wrong, or could be something else. I've changed a couple of those lines so could be calling the wrong function for poweroff but since i don't have an ecoxotic or sat+ plus to test with, I'm not sure.. Hopefully xtreme can give it another look over and see if there's something else I need to correct..


----------



## xtremebassist

> There's one more thing i need help on. Everything seems to be working fine except that I can't get the power off working. I'm using HolyAngel's code from github and I'm setting the light to power off at 1:00 am but it seems to just stay in moon lighting all night.


I took a look and the code in GitHub appears to be correct. What do you have the power on time set to? If they are set the same, then it will disable the function. When I get time, I will test out the code.

HolyAngel,

I took a look at Harry Muscles project and I noticed he had the Sat Pro Plus codes so I nabbed them and translated them for iAquaLite:


Code:


const unsigned long POWER = 0x20DF02FD;
const unsigned long REDUP = 0x20DF0AF5;
const unsigned long REDDOWN = 0x20DF38C7;
const unsigned long GREENUP = 0x20DF8A75;
const unsigned long GREENDOWN = 0x20DFB847;
const unsigned long BLUEUP = 0x20DFB24D;
const unsigned long BLUEDOWN = 0x20DF7887;
const unsigned long WHITEUP = 0x20DF32CD;
const unsigned long WHITEDOWN = 0x20DFF807;
const unsigned long DAYLIGHT = 0x20DF58A7;  // Sat Pro+ M3
const unsigned long M2 = 0x20DF9867;
const unsigned long M1 = 0x20DF18E7;
const unsigned long MOON = 0x20DFD827;      // Sat Pro+ M4

// REMOTE CONTROL CODES FOR SAT PRO PLUS NOT USED IN THIS SKETCH (KEPT FOR FUTURE USE)
const unsigned long SETCLOCK = 0x20DF3AC5;
const unsigned long ONTIME = 0x20DFBA45;
const unsigned long OFFTIME = 0x20DF827D;
const unsigned long POWER = 0x20DF02FD;
const unsigned long HOURUP = 0x20DF1AE5;
const unsigned long MINUTEDOWN = 0x20DF9A65;
const unsigned long ENTER = 0x20DFA25D;
const unsigned long RESUME = 0x20DF22DD;
const unsigned long SUNLIGHT = 0x20DF2AD5;
const unsigned long FULLSPECTRUM = 0x20DFAA55;
const unsigned long CRISPBLUE = 0x20DF926D;
const unsigned long DEEPWATER = 0x20DF12ED;
const unsigned long DYNAMICMOON1 = 0x20DF28D7;
const unsigned long DYNAMICMOON2 = 0x20DFA857;
const unsigned long DYNAMICCLOUD = 0x20DF6897;
const unsigned long DYNAMICDAWNDUSK = 0x20DFE817;
const unsigned long STORM1 = 0x20DF08F7;
const unsigned long STORM2 = 0x20DF8877;
const unsigned long STORM3 = 0x20DF48B7;
const unsigned long STORM4 = 0x20DFC837;

I don't have a Sat Pro Plus and it looks like he went with using M3 & M4 for Daylight and Moon.

I finally got my YunShield / Config file concept working with the LCD interface and now I can switch between what lights I'm controlling. I only have an Ecoxotic to test with though. Anywho, I was thinking about making the following byte:


Code:


byte colorMax = 100  // Ecoxotic
//byte colorMax = 42 // Sat Pro

That way can just update the variable between the sketches:


Code:


else if (EDIT_FIELD==EDIT_DAYWHITE) {
        if (lightDaylight.White<colorMax) lightDaylight.White++;


----------



## yobofofas

Huge thanks to all the work you guys have done on this. I'm a complete Arduino newb and I think I've got everything sorted with you're directions. I'll update and let ya know how it goes.

Awesome work!

Sincerely;
Arduino dummy


----------



## yobofofas

Ok, so everything complied but upon uploading I get this error message:
Arduino: 1.6.5 (Mac OS X), Board: "Arduino Mega ADK"

Multiple libraries were found for "IRremote.h"
Used: /Users/mynameismattbaum/Documents/Arduino/libraries/IRremote
Not used: /Users/mynameismattbaum/Downloads/Arduino.app/Contents/Java/libraries/RobotIRremote

Sketch uses 35,676 bytes (14%) of program storage space. Maximum is 253,952 bytes.
Global variables use 1,660 bytes (20%) of dynamic memory, leaving 6,532 bytes for local variables. Maximum is 8,192 bytes.
avrdude: ser_open(): can't open device "COM1": No such file or directory
ioctl("TIOCMGET"): Inappropriate ioctl for device
ioctl("TIOCMGET"): Inappropriate ioctl for device
avrdude: ser_send(): write error: Bad file descriptor
Problem uploading to board. See http://www.arduino.cc/en/Guide/Troubleshooting#upload for suggestions.

This report would have more information with
"Show verbose output during compilation"
enabled in File > Preferences.

I tried compelling with both the Mega ADK and Mega or Mega 2560.

I'm sure I'm missing something simple and any help will be appreciated.

Thanks


----------



## xtremebassist

yobofofas,

In the Arduino IDE look under Tools->Port and see if you see you board connected. Make sure you plugged in your board and it is recognized. It should then be attached to a COM port like COM4. Select the right port and the right board type.

Bump: Has anybody had issues with clock drift? I noticed the sketch is missing a sync interval for time. I added the following to my sketch to keep the NTP time updated:



Code:


[COLOR=DarkGreen]setSyncInterval(5);[/COLOR]
setSyncProvider(syncProvider);

From what I'm getting from the Library docs is that you need to update the time:

http://playground.arduino.cc/code/time

I see the sketch updates the time when you look at it to edit but if you're not always editing it, seems like it should have some sync interval.

HolyAngel,

We might want to test this out and add it to the code. I noticed a slight time drift before I switched to NTP. Probably due to not syncing the board to the RTC.


----------



## xtremebassist

Never mind about the sync interval. Did some debugging and the code is set to auto update every 5 minutes. I think that should be good.


----------



## yobofofas

*Arduino problem with Mac OS X*

So after trying to upload several times without any success I enlisted help from a programmer buddy. He did a little research and found that, for some reasons, Arduino for Mac OS X doesn't recognize the USB connection and defaults to Bluetooth. Anyone have a similar experience? Know a workaround?


----------



## xtremebassist

I don't have a Mac. Did you try these steps in this doc?

https://www.arduino.cc/en/Guide/MacOSX

Only workaround I can think of is configuring a virtual machine running Windows. I did find this googling:

http://forum.arduino.cc/index.php?topic=292284.msg2229300#msg2229300

Seems like it is a missing double quotes in some files. Hope this helps.


----------



## xtremebassist

*New Case*

First I want to give a shout out to Kman. I finally got a SAT plus for my wife's shrimp tank and his settings & instructions are great! Current needs to hire him for documentation for sure :hihi: Thanks Kman!

I found this case and reached out to the builder:

http://www.thingiverse.com/thing:565828

He gave me a quote of $25 a case for the initial tooling. I will send him the project so it will be built to fit it exactly. I've been calling mine configuration "iAquaLite +" since it has the additional YunShield. I'm going to ask him to build one without the shield for users of this forums. So while I got him doing a custom build, I was wondering:

A. Anybody interested in a better case?

B. Is there anything we should have mod to fit this build?

I'm going to have the extra cutouts for the YunShield USB & Ethernet as well as some slits to allow wires for additional sensors on the front. Thinking might as well put a hole for IR transmitter to. 

I'll been sending him the project hopefully by the end of next week (Waiting on another YunShield) so would great if answers can be posted by then. Hopefully he will drop the price further with a bigger demand but I'm willing to eat the initial tooling cost for the rest of you. That is a sweet looking case and takes care of the buttons.


----------



## ipkiss

Hi Guys, 

I finally got around to building this and I used the code from github. Tried to do the iaqualite and as I was uploading, it complains about sketch too big! would using v1.6.5 of the arduino ide affect this? 

thanks

edit: 

feh, nevermind. In my excitement, I was on the wrong com. If anyone ever gets this, you may want to re-verify the com ports being selected in the menu. By default for me, the IDE selected com1/arduino uno.


----------



## ipkiss

sma said:


> Thanks for answering my questions xtremebassist.
> 
> There's one more thing i need help on. Everything seems to be working fine except that I can't get the power off working. I'm using HolyAngel's code from github and I'm setting the light to power off at 1:00 am but it seems to just stay in moon lighting all night.


Same here. I can't get the light to power off with the same github code. 
sma, did you ever find a fix for this?

EDIT: nevermind. My IR led was in a bad position. On top of that, I thought the iAquaLite would've displayed OFF instead of MOON. 

Anyway, I think it works now. Thanks to AH again for the great idea and to everyone else who has and who will improve on it!


----------



## Dobie Swift

I can't seem to find the dimensions on the website. Do you all think this enclosure is big enough?

https://solarbotics.com/product/60105/


----------



## ipkiss

Dobie Swift, a little while back in this thread I had spotted that case and I asked the vendor about the size. Here's the discussion

post #94

and the dimensions according to the vendor are 35x75x120mm. It's 10mm short of the zigo, but like kman said, the zigo uses up a lot of space with its floating bottom plate.


----------



## xtremebassist

*Build-to-Spec case*

I got two cases from Build-to-Spec for $25 each and they are awesome!! Love the push buttons. I added a YunShield to my project so it stands quite a bit higher. He has a similar case without the YunShield here for $8.50:

Built-to-Spec's Store | Arduino Adafruit LCD Case | Online Store Powered by Storenvy

I told him that I was part of this thread and that users might be contacting him for a case without the YunShield. Hopefully he will give you a deal. They are custom to fit, easy to assemble and extremely well made. Definitely the best I've seen and my Zigo case was pretty sorry. I highly recommend it. It has mounting holes as well as the floating bottom plate. There is a cutout for the brightness and all the buttons including the reset have custom keypads that are so slick. He can make additional mods as well. Besides the cutouts for the YunShield, I had him add slits so I could wire additional sensors. The last photo is of it mounted on the wall above my wife's shrimp tank.

You can contact him via email. I had to send my project so he could design the case but I specifically asked him to remove the YunShield and design a case for this project at the same time. Otherwise you can send him the project and the turnaround was 2 weeks for me. Since they are laser built, additional orders don't require sending the project. I love these cases!


----------



## Dobie Swift

My Mega, LCD and IR emitter all arrived today. My RTC is still WAY out. Bummer.


----------



## xtremebassist

Forgot to add that the $25 price included the initial tooling for the case. 

Dobie Swift,

Bummer on the RTC Clock. I got one here that I ended up ditching since I got the YunShield and use NTP. Got tired of dorking with daylight savings time. Do you want it? I can ship it to you, I'm stateside. It cost me $3.67 with shipping. You might need to replace the battery. I didn't flip it over after I stopped using it.


----------



## Dobie Swift

xtremebassist said:


> Forgot to add that the $25 price included the initial tooling for the case.
> 
> Dobie Swift,
> 
> Bummer on the RTC Clock. I got one here that I ended up ditching since I got the YunShield and use NTP. Got tired of dorking with daylight savings time. Do you want it? I can ship it to you, I'm stateside. It cost me $3.67 with shipping. You might need to replace the battery. I didn't flip it over after I stopped using it.


That'd be solid. I'll pay your cost plus postage.

Also, with a name like xtremebassist I would guess that you have several, so which is your favorite bass?


----------



## xtremebassist

Cool. I can throw in my Zigo case but it is such a POS really. It is crack a little because the parts weren't machine right, I had to get ugly dremel about it for the Arduino USB port. Finally he stamped the top even though I asked him not to and he agreed not to stamp. After a couple of time of having to pop the case top off and trying to push the buttons you will be so over it 

Currently my main bass is a Status 5 string I had custom made for me. I love it! I got a Chapman GrandStick but I'm an instant bass idiot because the bass strings are upside down and tuned in fifths  

Going to take the family out to dinner now but I'll be back later. Tell me if you want the Zigo case too, no charge


----------



## ipkiss

xtremebassist. that case is nice! Thanks for going through the trouble of working with the guy to get it built. I saw that case during my hunt as well, but then I noticed the one in the picture wasn't long enough it seems as it was the exact size of the lcd shield. I realized he made custom cases, but my cheap nature (to my detriment as it seems!) and my lack of understanding of all this "project" stuff caused me to end up just ordering the zigo case out of simplicity. Now that I see your case, I'm envious!  I'd imagine you need extra code to integrate the yun shield into the existing setup. Did you modify the code on github or a pretty extensive rewrite of the whole thing?


----------



## xtremebassist

ipkiss said:


> xtremebassist. that case is nice! Thanks for going through the trouble of working with the guy to get it built. I saw that case during my hunt as well, but then I noticed the one in the picture wasn't long enough it seems as it was the exact size of the lcd shield. I realized he made custom cases, but my cheap nature (to my detriment as it seems!) and my lack of understanding of all this "project" stuff caused me to end up just ordering the zigo case out of simplicity. Now that I see your case, I'm envious!  I'd imagine you need extra code to integrate the yun shield into the existing setup. Did you modify the code on github or a pretty extensive rewrite of the whole thing?


I should've posted the photos when I first got the cases but got sucked up in coding for the YunShield. I almost order a case just for this project so he would have the tooling / design in place but the thread seemed a little dead. The Zigo case was a nightmare for me unfortunately. At first the guy's PayPal account was dead. Then I placed the order and he said no logo. Got the case with logo and it wasn't machined well at all. Had to get Dremel about it to get it to even work. Then a couple of times sticking my fingers in trying to change the settings made me realize there had to be something better. I'm hoping he will honor my requests for this thread and provide them at price similar to his Arduino Uno case. No more waiting months for case :grin2:

I plan to make a new thread for the YunShield since it does jack the price up over AH original price by $20. You do save on the RTC cost and hopefully the case though. Right now it is the same code and functions the same but it uses .ini files for the settings instead of EEPROM burns. You can switch between the three lights listed on the thread with a push of a button instead of re-compiling the code for each. It uses NTP time instead so it is very accurate as long as you have Internet connectivity and you don't have to mess with daylight savings time.

My next step is to build a WebInterface so there will be three ways to control it like Harry Muscles code:

http://www.plantedtank.net/forums/20-diy/867209-web-based-ir-light-controller.html

I plan to build a remote widget so you can completely control the lights and the "Resume" button will bring you back to the iAquaLite program. Just got to find the time though :smile2: I have additional sensors (TDS, Flow, Leak Detection, etc) that I've been working on which makes it more customized. I will try to come up with a standard with a generic stub so adding sensors if desired would be easy. I've got the display to rotate between the iAquaLite fades and sensor readings, just sensor readings or just iAquaLite display. With the Web Interface you could ditch the LCD keypad but I kind of like having that manual control options. My original LinkSprite keypad likes to act up and switch its voltage for the "Select" button so having the .ini files have been so useful instead of having to keep reprogramming the voltages. 

So basically the same code so I've been dubbing it iAquaLite Plus on the startup display. I will try to work more on it and get a GitHub project setup. Once the Web Interface is working then I think the additional $20 for the YunShield is justified. So nice to be able to program it via wireless. The YunShield is Linux server so I'm using Python to talk directly to the Ardunio. Takes a bit to boot at first but afterwards it works just the same. All the settings are written to .ini files and not the EEPROM so it saves the life of the Arduino which has a lot but limited amount of EEPROM writes. 

Definitely drop this thread and the cases I bought when you contact Build-to-Spec. I would love to see him offer his awesome case to thread members for under $20, hopefully under $10. It is custom built for this project, great fittings and the keypad buttons are just the best! I original sent him the project in my Zigo case so it does have the floating plate and the same backside mounting holes. I can't see how anybody could do a better case.


----------



## ipkiss

sounds very cool. It's always hard to find time for hobbies  I'll be looking out for the new thread! thanks!


----------



## xtremebassist

Besides having a cool case, YunShields and some jamming basses, I must say this project has been a god send for my tanks. The difference is amazing after months of using it. First no harsh lights on / lights off shock for sensitive fish. They act more natural and my shrimp & fish have been breeding like mad. Better colors too. Now I have a long photo period so I can still enjoy the tanks after work but no algae for the long light periods. The plants are just thriving. My tanks never looked so good. I couldn't see not using it with these lights. Their built in fade program doesn't even come close and won't fully shut off. Highly, highly recommend it.


----------



## ipkiss

Yea, it's a shame the built in program wasn't a little more intelligent about it. I guess it's a disconnect between lighting people and programmers. That's why "glue" projects like this are wonderful. The Finnex 24/7 light came close to doing this but then they failed by not letting you control the presets. And I agree, by being able to control the presets AND time, it opens up a whole new level of customization of lighting period to avoid algae. For my tank, it has allowed me to burst a serious midday blaze for an hour to get to the plants at the bottom without running too much light for the rest of the day. Granted, you could probably simulate some of this with neptune controllers/timers/multiple fixtures, but that gets pretty expensive.


----------



## xtremebassist

Being able to fade the RGWB makes all the difference. Seems like all the other lights just dim from white to moon. My daughters neons seem to get mating during the fade to daylight. Never saw the behavior with my old on/off timers. My shrimps seem to dig the fade to Moonlight. Controlling the presets lets you pick colors that are pleasing to you and keeps the algae at bay. 

The best thing about this project it is truly fire and forget. Cactus, drop it on the ground and walk away. Hence why this thread goes quiet from time to time :smile2:

I just finished paying it forward by sending Dobie my RTC and Zigo case. He might have something to say about the "Forward" part when he dorks with the case though :grin2:

Anywho I hope anybody who gets a Built-to-Spec case for this project will also pay it forward and list it as an alternative of the Zigo or really the main case. Even at $25 for my YunShield case is cheaper than waiting over 6 weeks for the Zigo with expedited shipping.


----------



## Dobie Swift

Thanks to @xtremebassist I now have a working iAqua Lite. His RAOK for sending me his RTC module and a spare Zigo has me up and running. I plan on tinkering with the "stock" version for a bit and then I plan on modding mine to include the YunShield. I would also like to run an autofeeder and possible include a 12v relay to power off my filter during feeding.

I'd also like to thank @AnotherHobby for the original concept and @kman for his work on the Current Satelite + mod.


----------



## Mumford

Oh man this looks awesome...

I'm reading through and I've seen some things for current sat+'s but nothing for sat+ pros. Any idea if I missed something?


----------



## xtremebassist

Awesome Dobie! Check out this link about your planned mods and the code:

https://www.cooking-hacks.com/docum...arium-aquaponics-fish-tank-monitoring-arduino

Before their code was rawer but I see now they've started to consolidate into libraries. Still you can problem pick up the code you need. Cool project!

Bump: I posed the Sat+ Pro IR codes that I got from Harry Muscle's thread awhile back but don't think anybody on this thread has a Sat+ Pro to try them out. A Sat+ Pro should work just fine once you plug in the IR codes and setup the user programs. Should be that easy.


----------



## xtremebassist

Mumford said:


> Oh man this looks awesome...
> 
> I'm reading through and I've seen some things for current sat+'s but nothing for sat+ pros. Any idea if I missed something?


With my YunShield fork, I'm using .ini files to easily switch between lights. I have a Sat+ & Ecoxotic. Here is what I got for the Sat+ Pro IR codes:



Code:


[ir_codes]
power = 0x20DF02FD
redup = 0x20DF0AF5
reddown = 0x20DF38C7
greenup = 0x20DF8A75
greendown = 0x20DFB847
blueup = 0x20DFB24D
bluedown = 0x20DF7887
whiteup = 0x20DF32CD
whitedown = 0x20DFF807
daylight = 0x20DF58A7  ; Sat Pro+ M3
m2 = 0x20DF9867
m1 = 0x20DF18E7
moon = 0x20DFD827      ; Sat Pro+ M4
setclock = 0x20DF3AC5
ontime = 0x20DFBA45
offtime = 0x20DF827D
power = 0x20DF02FD
hourup = 0x20DF1AE5
minutedown = 0x20DF9A65
enter = 0x20DFA25D
resume = 0x20DF22DD
sunlight = 0x20DF2AD5
fullspectrum = 0x20DFAA55
crispblue = 0x20DF926D
deepwater = 0x20DF12ED
dynamicmoon1 = 0x20DF28D7
dynamicmoon2 = 0x20DFA857
dynamiccloud = 0x20DF6897
dynamicdawndusk = 0x20DFE817
storm1 = 0x20DF08F7
storm2 = 0x20DF8877
storm3 = 0x20DF48B7
storm4 = 0x20DFC837
color_max = 42

I don't have a Sat Pro + to verify them though. I also tweak the code for the variable "color_max" because Ecoxotic has color setting of 0-100 whereas the Sat + has a range of 0-42. You will have to count for this range in the code like kman did if the Sat Pro + has a different range:



Code:


lightM1.Red=EEPROM.read(208);                                  
// if the value is out of range, set it to 0 and re-save it                                  if ((lightM1.Red <= 42) && (lightM1.Red >= 0))  ;                                  else {                                    lightM1.Red=0;                                    EEPROM.write(208,0);                                  }

Then it is setting the four presets and you should be good to go.


----------



## SL Dan

FYI - I just setup iAqua Lite for my Satellite + Pro. Initially I attempted to use the Sat+ .ino file, but that only confused me. Then I used the default iAquaLite.ino to program my arduino and it appeared to work normally. Running it through a full cycle, it works just as expected! The Sat+Pro has a range of 0-100 and from what I can tell has the same IR codes as the E-Series. The layout of the remotes between the E-Series and the Sat+Pro are very similar (except the storm modes), so it makes sense they would be the same code.

Thanks for everyone that has contributed to this project! It addresses my biggest complaint with the Sat+Pro.


----------



## xtremebassist

Sweet! Glad it worked out. I couldn't see having my Current or Ecoxotic without this controller. Definitely has been a fire & forget and their built in dimmer modes are pretty pointless for the reasons you pointed out. I like that my lights turn off and remembering to hit "resume" was a PITA.


----------



## eklu65

So I'm buying the parts for this controller, and it looks as though they have taken the link down on the manufacturer page for the linksprite version A keypad shield. I also noticed a few people in this thread have reported issues with that piece of equipment. Anyone care to weigh in? Should I still try to find this specific item, or try to find a replacement?


----------



## bcarl_10gal

Has anyone modified the code to add dynamic effects such as storms or clouds? For example could you make it: M1(FADE)Daylight(FADE)M2>Clouds>M2(FADE)Moonlights? '>' represents a button push.


----------



## SL Dan

eklu65 said:


> So I'm buying the parts for this controller, and it looks as though they have taken the link down on the manufacturer page for the linksprite version A keypad shield. I also noticed a few people in this thread have reported issues with that piece of equipment. Anyone care to weigh in? Should I still try to find this specific item, or try to find a replacement?


I ordered via Amazon at the end of October and had no difficulties receiving the correct product. It works fine for me. This is what I ordered:

Amazon.com : LinkSprite 16X2 LCD Keypad Shield for Arduino Version A : Everything Else


----------



## xtremebassist

eklu65 said:


> So I'm buying the parts for this controller, and it looks as though they have taken the link down on the manufacturer page for the linksprite version A keypad shield. I also noticed a few people in this thread have reported issues with that piece of equipment. Anyone care to weigh in? Should I still try to find this specific item, or try to find a replacement?


The LinkSprite keypad shield Version A fits properly over the board so the case works but you lose access to several unused pins. I tried a generic keypad shield and it is moved over to the left to allow more access to the unused pins but it won't fit in the case. Also the voltage programming is slightly different but pretty straight forward.

My problem with my one linksprite keypad shield is the select button voltage fluctuates so it becomes unusable unless I recompiled the code to deal with the new voltage. If you can't select, you can't change the value so a real PITA. I use a YunShield and I coded it to use the keypad input as well as .ini files so with that keypad, I update the values in the .ini file. The other LinkSprite keypad as been working correctly. The bad one worked well for over a month and then the select button cheesed out on me. If I want it to work again, I just uncomment the line to display the voltage, press the select button and get the new value:



Code:


//read the button ADC pin voltage
  buttonVoltage = analogRead( BUTTON_ADC_PIN );
  //Console.println(buttonVoltage);

Once I get the current voltage for the select button, I update this part:



Code:


#define SELECT_10BIT_ADC        665  // select

PITA really but normally it is fire & forget and you don't tweak things much after you got it setup. 

So it is really all about the case and the aestehtics of keypad shield lining up nicely on the left edge compared to hanging over it. Seems like all the other keypads including the other versions of linksprite are configured with this overhang to allow access to the non-used pins.


----------



## xtremebassist

bcarl_10gal said:


> Has anyone modified the code to add dynamic effects such as storms or clouds? For example could you make it: M1(FADE)Daylight(FADE)M2>Clouds>M2(FADE)Moonlights? '>' represents a button push.


Definitely possible with the current code but I haven't heard anybody doing it yet. The only catch is how the fades work. The logic actually determines the current light setting and the next light setting and fades the WRGB settings. It is basically a remote controller butler, hitting White for example and pressing the down arrow to decrease the value. I don't think the fades would work during the dynamic effects and you would have the controller fighting with the settings. You probably should remove the fade logic during the time span of the dynamic effects:


----------



## bcarl_10gal

xtremebassist said:


> Definitely possible with the current code but I haven't heard anybody doing it yet. The only catch is how the fades work. The logic actually determines the current light setting and the next light setting and fades the WRGB settings. It is basically a remote controller butler, hitting White for example and pressing the down arrow to decrease the value. I don't think the fades would work during the dynamic effects and you would have the controller fighting with the settings. You probably should remove the fade logic during the time span of the dynamic effects:


My thought is you would switch it into a preset right after the dynamic mode then start the fade from the preset.


----------



## xtremebassist

bcarl_10gal said:


> My thought is you would switch it into a preset right after the dynamic mode then start the fade from the preset.


Looks like that will work but you might want to call smartStartup() right after switching into a preset after the dynamic mode to get the fade caught back up. It looks like the rest of the code expects the fade has been running the whole time, slowly decreasing / increasing the colors. Since there is no two communication, the controller doesn't know to recalculate to the end of the fade. The smartStartup() has to the logic to do this via the time but is only called at power on.


----------



## xtremebassist

Tried to order from LinkSprite thru Amazon and even though Amazon showed 6 in stock, I was contacted by LinkSprite to say they were completely out of stock. They were willing to send Version B but not sure if the form factor / pin out is still left aligned plus that big power supply smoothing cap or whatever it is sticking out on the left side like a sore thumb isn't going to fit in the case or the custom cases I use. I wrote back to see if their V2 is left aligned to the Arduino Mega 2560. Will keep you posted.


----------



## xtremebassist

When I asked about the form factor / left alignment of their Version B and V2 keypads, this was their answer:

_Sorry we have no version A any more. If version B does not work for you, please 
cancel the order._

When I open a support ticket about the bad voltage for select button for the Version A keypad, they never responded and just closed the ticket :-( No way I'm going to buy a Version B or V2 keypad to see if it will fit right from them. Hopefully there is another keypad that will fit or they will get more in stock. I have an iRobot keypad that works fine with a little code tweaks but it doesn't left align properly due to giving access to the unused pins on the Arduino. If somebody does find a good replacement for the LinkSprite, please update the thread.


----------



## eklu65

xtremebassist said:


> When I asked about the form factor / left alignment of their Version B and V2 keypads, this was their answer:
> 
> _Sorry we have no version A any more. If version B does not work for you, please
> cancel the order._
> 
> When I open a support ticket about the bad voltage for select button for the Version A keypad, they never responded and just closed the ticket :-( No way I'm going to buy a Version B or V2 keypad to see if it will fit right from them. Hopefully there is another keypad that will fit or they will get more in stock. I have an iRobot keypad that works fine with a little code tweaks but it doesn't left align properly due to giving access to the unused pins on the Arduino. If somebody does find a good replacement for the LinkSprite, please update the thread.


I managed to get a hold of a Version A from amazon, but it looked like it was some of the last stock they had available. 

My problem currently is the case. I bought the case from built-to-spec listed in post #214, and also emailed the seller to ask if that case fit the build. Here is his response: 



> Sorry for not getting back to you sooner, I had to track down the source files for this job. Attached are the pics of the case I did for him. If you just want a copy of this case, I can cut you one for about $9.50. I don't have a variant without the YunShield, unfortunately. I don't have a lot of idle time to make one up right now either. If you want to get a custom variant, you'll have to get me the specific hardware you want to run, pay for the redesign (probably about $35 for the drafting), and wait a couple weeks for me to get to it and test everything out.


So, I have all the parts, just don't have a fitting case.

edit: I'll be honest, the yunshield build is looking pretty tempting at this point...


----------



## xtremebassist

I found a couple of vendors that still sell the LinkSprite LCD keypad version A:

LinkSprite 16X2 LCD Keypad Shield for Arduino/pcDuino Version A

https://abra-electronics.com/opto-i...-2-lcd-keypad-shielda-for-arduino-ls-110.html

Sorry to hear about the Built-to-spec case. I specifically asked and I thought I paid for tooling for a non-Yunshield case for this project. I actually plan to buy 2 more YunShield cases so good to know he still has that design. Unfortunately my Yunshield code is pretty much a hack and I haven't had the time to finish it off and clean it up. Right now I've got it running with it using .ini files for the settings so you can easily switch from the various LED lights, it uses NTP for the time so no RTC chip and no updating for Daylight savings time and you can modify the settings from the keypad or the .ini files. I'm throwing some sensors depending on my use cases and I want to go back and setup a "stub" for sensors that people can add their own. Of course want to add a Web interface with pretty graphs  With the YunShield is also possible to script the shield to download the seasonal weather patterns, update and push the changes as required.

I think you can add and configure the YunShield and use the current code as is. Of course you won't be gaining anything from the YunShield except having a super cool case and the ability to update the Arduino board over wireless or ethernet. I say think because as soon as I got the YunShield, I just went for programming to use it and getting rid of the RTC. I have to say it is so nice not ever having to dork with the time. It has truly been a cactus, drop on the ground and do nothing, on my wife's shrimp tank. Unfortunately the code that is running I don't have saved because I started on adding the TDS meter functionality. I know what I got now in the sketch is still dorked and won't run. Hope to get some time hear soon to finish it off. As soon as I do, I will post it or upload it to GitHub.


----------



## xtremebassist

*Another time bug*

Stumbled across another 24 vs 12 hour time bug. I rebooted my iAquaLite right after noon (12:38PM) and it went to Sunset fade. After it hit 1:00PM, it reverted to the proper fade. Looks like there is a discrepancy on how the current time is calculated and compared in the smartStartup function and main loop program. smartStartup code:



Code:


void smartStartup()
{

  int onHour, offHour;

  // get the current time in UNIX time, which is FAR easier for time calculations and comparisons
  time_t currentTime = tmConvert_t(year(),month(),day(),hour(),minute(),second());

'

Main loop code


Code:


void loop()
{

  // Get the UNIX time in seconds (since 1970), using UNIX time because the calculations are MUCH easier
  unsigned long rightNow = now();

Hoping it is as easy as replacing the smartStartup time calculation with the main loop. So far only seen the bug when I reboot between noon and 12:59 PM. Everything works if it is just running. Hoping "MUCH easier" is the ticket :grin2:


----------



## xtremebassist

Crude. After digging it is kind of PITA to fix. Instead of a dirty hack, I'll just live with it until I or somebody can finally re-code this project to always save and evaluate the time in 24 hours and just use 12 hours for displaying if it is set. It appears if you have it set for 12 hours and you start it up after noon, the fade will be incorrect until it reaches the end of the hour and the main loop code gets evaluated and executed.


----------



## astex

So I have all the parts and am trying to upload the program and it's coming up with tons of errors. The two most common are either 'xxxxx' was not declared in this scope or 'xxxxxx' does not name a type.

Does anyone out there have a version that is currently working that they can share? I downloaded the last version posted to the GitHub site and it's the one I'm having the problems with.

Thanks,


----------



## Loumeer

Anybody have an alternative source for DS1302. Can't find that part anywhere.


----------



## jeffkrol

Real Time Clock RTC DS1302 Board - RobotShop

Like this one???


----------



## Loumeer

jeffkrol said:


> Real Time Clock RTC DS1302 Board - RobotShop
> 
> Like this one???


The post on page 1 said it had to look EXACTLY like the one pictured. Will this work?


----------



## David Nottelling

I was looking over this project, came across it while building the iAqua. How would you go about sending multiple IR codes, is that even doable with arduino. For my light, I'd like to turn if off at night, then on and with a memorized pattern. To do so I would send one code for off, but would need to send that same code to turn it on again, but followed by a time code and finally a set code. I know the codes and can operate the light, just not how to transmit more than one per call out.


----------

