The Planted Tank Forum banner

Guide: Arduino based LED controller for Current Satellite LED+

174K views 715 replies 69 participants last post by  Dahammer 
#1 · (Edited)
So I made an off-hand comment in one of Current USA's threads last night about an Arduino controller for their LED+ freshwater fixture. In the 12 or so hours since posting that, I have probably received a dozen PM's requesting code, IR protocol, sketches, or other information. Instead of responding to each request for information separately, it became obvious that I just needed to put together a thread for my project. This is that thread.

First, a disclaimer. While I'm not your average DIY tinkerer, I'm also not an electronics expert. I'm a mechanical engineer by day, and like to think of myself as a modern mad scientist by night. If you decide to build your own controller based on this thread, be aware that you're on your own. That's not to say I won't help... I think open source is the way of the future and love to pass knowledge on. I just mean that if you burn up your Arduino, yourself, or your house, that it's on you.

I'm putting together a guide to follow along, but none of the steps should be considered the last step. The nice thing about Arduino is how easy it is to constantly modify your code and add features. Throughout this thread, I will periodically post my newest code so that you can upload it and get the newer features. If you're experienced with Arduino, feel free to hack my code apart and have your way with it.

This process should work for any light fixture with some tweaking!

I'm writing this step-by-step so hopefully anyone can follow along. The more Arduino users we have in the world, the better life can be for everyone! If you're new to Arduino, don't be overwhelmed... it's not as difficult as it seems at first glance. And if you're an old hand please don't bash my primitive coding too much!



Everything in this post should be considered open source and public domain. Feel free to use my code, distribute it, hack it up, whatever.
 
See less See more
#371 · (Edited)
Thanks, I had a ton of fun putting it together and figuring out how everything works. I've got a smoke Arduino box and PSU from Adafruit on the way so I can clean it up and solder it to a pcb.

One thing I don't really understand though, what's the purpose of the IR receiver? To capture codes if they were to be different from the original Current ones? If I was following the thread correctly it seems one of the pins it was connected to ended up being taken over by another component.
 
#372 ·
Not sure why some pics are missing, but I'll check into it.

The receiver is not necessary unless you have different IR codes. Current had said they were changing their protocol, but as of now they have not that I'm aware of.

Sent from my HTC One X using Tapatalk
 
#373 ·
#375 ·
Texan78, I'm not the best one to answer your questions, but if I understand it correctly, yes, the storms are random. However, RandomStorm will only be called between the hours of 1:00 PM and 8:00 PM, based on how these guys wrote the program.

I'm sure you can mix this in, but I wouldn't know how to do it. I think it would take some re-writing to include 2 codes in memory for that random function. Expanding the time the RandomStorm function would be called should be as easy as allowing it to be called earlier than 13:00.

I've thought of using sound too, and I think you can use an Arduino board to process sound w/ RCA cables, but I have not looked up RF options. One question I would have is how much memory the Uno has free if the same board is managing the lights and sound. I don't think we're close to the max with just the lights, at least as v4.1 is written, but I don't know how much mem is left. I like the idea, too, but I'm not sure if this board could process both signals?

I know this isn't much help, but hopefully I'm not giving you any wrong information. If I am, I'm sure someone will jump in and correct me.
 
#376 ·
Thanks Aquatechtoo that was a big help. I guess the same thing could be wrote for random cloud cover too like with the thunderstorms? I would really like to have a nice random mix to mimic actual weather so I will learn how this works and hopefully see if I can mix that in with the thunderstorms. Don't think it should be to hard.

The sound option I figured would be stretching the memory. Only need like a very small like 2-3 sec wav file. If this is feasible I may get a Mega. I just picked up the Uno. I haven't played with this code before or yet but I don't see why it couldn't be possible to set a trigger based on the storm to trigger the .wav file. Only issue I see would be having the lights and sound synced. Then again I don't think it would matter ether way if it's synced or not. Not always do you hear thunder when you see lightning and vice versa. Hooking speakers up is the easy part.

I picked up my Uno just now and the resistor but this rat shack didn't have the IR emmitters. So I will need to look at some other places and if they don't have them order them when I order the LCD and box to enclose this all in. At the same time I am going to get the RF parts and experiment with that. I have been thinking about it for a few days and think I could get it to work. Only thing I need to sort out is powering the RF receiver box. I think a simple small battery like the RTC uses should work.

My logic is to have a small black box that has a small PCB in it just big enough to connect the RF receiver and an IR emitter in it. When the RF receives a signal from the Uno it will fire the IR emitter in the box which will also have the IR receivers for the lights in it. RF has better range than IR and will allow you to conceal the boxes and make changing the programing easier. Here is a small example on this page. As you can see when the Key FOB is pressed it lights a LED, which in our case would be an IR emitter would fire instead to trigger the light. This site has a kit that works with the Uno so this is something I am really going to dig into. This could really make this setup versatile. This is just in theory. Not sure if this would actually work.

http://www.karlssonrobotics.com/cart/rf-link-transmitter-315mhz/?gclid=CMHo0oy9-boCFRFo7AodywIALA

Example

http://www.adafruit.com/products/1096
 
#378 ·
Perhaps you can write a similar random function for clouds like was done for the storm and then use a control structure like If/Else to pull them together!? Just a shot in the dark on my part; object-oriented programming is NOT a strength of mine.

Good luck with the sound, too. Keep us posted. I think it would be a more natural experience if the sound and lighting aren't in sync with each other. This concept also reminded me of Xmas lights syncing to music and a quick search reveled this: http://forum.arduino.cc/index.php?topic=87956.0 and while it isn't exactly what you are thinking about, it could serve as inspiration as you start devising potential solutions? This is a case where the lights and sound would fire in concert with each other, but if you could take this concept and offset the lights and sound by a second or two, it might take this idea of storms over a planted tank to a "4D" level!?
 
#381 ·
Perhaps you can write a similar random function for clouds like was done for the storm and then use a control structure like If/Else to pull them together!? Just a shot in the dark on my part; object-oriented programming is NOT a strength of mine.
I am thinking the same thing as you. Just copy the random storms coding and and replace it with the rolling clouds calls. In theory that should create random clouds and random storms. I have the Current USA Ramp timer and have it hooked up and testing it. If it works out well I will use the ramp timer to control the cycles and the Uno to control the random weather events. That should also free up some memory for sound.

I think it would be a more natural experience if the sound and lighting aren't in sync with each other. This concept also reminded me of Xmas lights syncing to music and a quick search reveled this: http://forum.arduino.cc/index.php?topic=87956.0 and while it isn't exactly what you are thinking about, it could serve as inspiration as you start devising potential solutions? This is a case where the lights and sound would fire in concert with each other, but if you could take this concept and offset the lights and sound by a second or two, it might take this idea of storms over a planted tank to a "4D" level!?
I am very familiar with what you're talking about. I was doing those Christmas lights 7 years ago with the L.O.R. (Light-o-rama) controllers. LoL So I have a lot of experience with that.


It seems like the dynamic fade functions are all pretty simple loops on the LED+, you could time lightning strikes pretty easily and add the right amount of delay(s) for the audio to sync then have it repeat until the random storm duration is up. Though I've no idea how to code it.
That is an excellant idea! That makes a lot of sense. Just find out the timing between the flashes and add a delay. I will have to figure it out and play with it. I should be able to figure it out once I start digging into the code and learning it.

I am getting all my parts together now for this. I am really thinking this RF thing could work. I have found all the parts and there is even an Arduino Library for these RF parts. If you could have a small box hidden behind your tank or under it so you and keep the Uno plugged in somewhere else so you can make easy changes that will be sweet!
 
#382 ·
Texan78, I just had a realization that may help you with identifying the amount of memory available on the Uno as you start implementing on your idea. The geniuses who worked on this code included the ability to identify the amount of free SRAM. In latter versions of their code, you can see the amount of free SRAM from the serial monitor printout! In my case (I'm using Dalhammer's v4.1 code and tweaked a few minor things and I have a few more alarms firing during the day) I have 967 bytes free.
 
#383 ·
Great thanks! I remember during all my reading somewhere where that was mentioned so I will go back and see if I can locate it. I am about to head out and see if I can locate some of the last parts I need to at least get the basic functions work then I can go from there with getting the RF capabilities working and then adding the other features.

I bought the ramp timer for this as well to test and play with it. It works fine on the preset I was using to dim the lights. I was disappointing with the fact it doesn't dim to moonlight, it just dims them to off. So I am probably going to send those back. I was hoping to use the Ramp Timer to control the dimming of the lunar/day cycle and use the Uno to handle events hoping that will free some memory up too. Looks like that won't be the case. Just so I have an understand and clear. With this mod this will dim to moonlight at night?

-Thanks!
 
#384 ·
With the way it's set up by default it's switching the built in modes at the end of the day to the dusk/dawn dynamic fade before switching to moonloght, its not set up yet for a true ramp up/ ramp down. You could do it with a bunch of alarms using the individual channel intensity adjustments but you'd need a lot at intervals, the TimeAlarms library is limited to 256 and I'm not sure that's the cleanest way to do it as you may run out of memory before that limit is reached.
 
#385 ·
The best way to trigger a fade would be to use a sinusoidal function to repeatedly press the up or down command for each channel. You'd have to write a new function for this, and just trigger the function with a single alarm. This is something I have been toying around with, but I've been out of the country with work and haven't had much time to play with it.
 
#391 · (Edited)
Hi Indychus and others:

Thank you very much for providing this clear step-by-step guide for the project. I have it up and running on my 29 gallon tank with the RTC and LCD display.

Question: Has anyone worked out a method for turning off the LCD backlight at night?
My fish all gather in the corner of the tank by the LCD and stare at it all night, and more importantly, my wife doesn't like it!

Thanks!
 
#392 · (Edited)
I was looking into dimming it, I think you can use a PWM pin and some code to do it but I'm not sure how. I'm personally adding a resistor to the default hookup tonight to reign in the brightness a little.

Edit: I put a 1k ohm resistor between the backlight 5v, red wire—second from the right in my pic, it's no longer annoyingly bright. Use a higher value resistor if you want it even dimmer.
 
#393 ·
Method to turn off LCD at night



Thanks Zodduska, I also tried a few resistors found found one that gave a pleasing brightness.

Also I worked out a way to turn it on and off with alarms: I used Pin 13 as the power source for the backlight, and controlled it like this (with new "cases" for testing):

Code:
void SetAlarms()
{
// ... later ... 
  pinMode(13, OUTPUT); //DJT 11/25/13 for LCD screen power on and power off
  LCDPowerOn();        //DJT 11/25/13 Turn on LCD when program initializes
  Alarm.alarmRepeat(6,00,0, LCDPowerOn); 
  Alarm.alarmRepeat(7,00,0, M1Custom);
//... later ... end of day alarms
  Alarm.alarmRepeat(21,00,0, Moon2);
  Alarm.alarmRepeat(22,00,0, LCDPowerOff);
//... later ... cases for testing
    case 33:  //DJT 
      LCDPowerOn();
      break;
    case 34:   //DJT
      LCDPowerOff();
// ... later ... the functions:
void LCDPowerOn() //DJT
{digitalWrite(13, HIGH);}
void LCDPowerOff()  //DJT
{digitalWrite(13, LOW);}
This works so far - now my fish won't stay up all night watching the LCD!:drool::drool::drool:
 
#395 ·
Hey guys, I just need some advice since this is where I fail when it comes to the technical side. I am ordering all my parts and the last thing I am stumped on is how to power this PCB that will contain the RF receiver with IR emitter to fire at the fixture IR. My thought was to use a 3.6V @ 110mAh coin cell battery breakout. Would that been enough to power the PCB with the RF receiver and IR emitter?

-Thanks!
 
#401 ·
Is anyone out there putting this DIY into a nice package and selling it?

I know I am not the only one hoping someone can deliver on the goods we were all hoping would come when we bought these lights. I am completely clueless when it comes to coding, and attempting this would only lead to wasted time, frustration, and a broken controller. :fish:
 
#402 ·
You don't need to know any coding, we've already done it for you. If you can put it together and copy/paste the code, you're good to go. I had hopes of making a complete unit to sell, but my work schedule is crazy right now and I'm always out of the country.

My intentions from the beginning were for this to be open-source. If someone else has the skills and time to build these to sell I'm fine with it, as long as its sold at as low a cost as possible to support the community and not to make money.

Sent from my HTC One X using Tapatalk
 
#403 ·
If you'll post a complete wiring diagram and parts list, I'll convert it into a Printed Circuit Board for you. This project can be boiled down to a "stand alone" arduino based controller that will free up your stock UNO or MEGA for other uses.
 
This is an older thread, you may not receive a response, and could be reviving an old thread. Please consider creating a new thread.
Top