|Today 02:31 AM|
|Curt_Planted||Oh and 42 lighting steps through arduino transmissions, 21 with the remote. They must have included the answer to the universe in our lights I noticed that the dynamic effect transitions were much smoother than the manual adjustments and now we know why. The built in controller in the light uses the 42 steps and the remote sends a double transmission with each adjustment button press.|
|03-13-2014 05:51 AM|
I went straight with loops for the sunrise/sunset. To assure any missed transmissions dont lead to a drift in the actual lights brightness I followed the sunrise with a full spectrum command and the sunset with a call to M4 that I set on the remote to be a zero light setting.
Using if's to activate lighting changes made it pretty straight forward to test counters for each color to adjust lighting to user chosen settings for the custom accent function. I think you should be able to directly grab the sunrise, sunset, and custom accent functions and use them in the original code. You'll just have to bring over the global lighting counter variables and update them after any other lighting changes as well. Or you can just delete them if you don't want the customaccent function. Just give sunrise and sunset the right inputs ( the time delay in ms between adjustments) as described in the notes and I'm sure the IDE will point out anything else you need to do to get it to work!
|03-12-2014 09:19 PM|
Interesting, in the FAQ for TimeAlarm library they state that each Alarm.alarm uses 12 bytes up to a max of 255, but Alarm.timerOnce is released immediately and there is no reset limit so maybe we can use them to fire WhiteUp or other colors repeatedly until the desired setting is acheived for a ramped effect with no performance hit? Kind of like this:
Alarm.timerOnce(30, WhiteUp); // called once after 30 seconds
This would in effect start at DawnDusk, then press the white up button every 30 seconds until you've hit max (you'd have to figure out how many times that would be). You could of course use the other colors Up functions to finish at a specific color. In the evening you would then simply reverse the order with WhiteDown until you hit your dusk color eventually hitting moonlight. I can see I'm going to have to play with this some more.
Q: How many alarms can be created?
A: Up to six alarms can be scheduled.
The number of alarms can be changed in the TimeAlarms header file (set by the constant dtNBR_ALARMS, note that 12 bytes of RAM are required for each timer)
onceOnly Alarms and Timers are freed when they are triggered so another onceOnly alarm can be set to trigger again.
There is no limit to the number of times a onceOnly alarm can be reset.
|03-12-2014 08:59 PM|
It does not do ramping as written, it uses alarms to change modes at designated times. In the section below you can specify what mode you want at what time. You are allowed up to 24 alarms as it is set up now (as outlined in the first few posts of this thread) so in theory you could use your custom colors to have a 4 step "ramp" up to your brightest setting. The max number of alarms is 255 (if you modify the library) but each one uses 12 kb memory so if you set up too many of them you will run out of memory. There may be other creative ways to accomplish this but that seems the simplest. You would also put any moonlight settings in here. I just got my kit so I'll put it together in the next couple days and post my settings once I settle on them, as I had similar ideas to you.
// Set up your desired alarms here
// The default value of dtNBR_ALARMS is 6 in Alarms.h.
// This code sets 12 alarms by default, so you'll need to change dtNBR_ALARMS to 12 or more
Alarm.alarmRepeat(9,00,0, Cloud2); // (HR,MIN,SEC,FUNCTION)
// Comment these out if you don't want the chance of a random storm each day
ThunderStorm(); // Sets up intial storm so we don't have wait until alarm time
|03-12-2014 06:35 PM|
|zodduska||Thanks for the new code to play with Curt_Planted, I'm excited to try it out tonight.|
|03-12-2014 08:18 AM|
Hi guys! I'm just about ready to jump on the bandwagon. Can someone confirm that the parts I've selected will get the job done before I pull the trigger?
Arduino UNO R3 board with DIP ATmega328P - $28
SainSmart I2C RTC DS1307 AT24C32 Real Time Clock module+board for AVR ARM PIC - $9.20
SainSmart LCD Module For Arduino 20 X 4, PCB Board, White On Blue - $12.29
Super-bright 5mm IR LED - 940nm - $1.50 (for two... Or I may just buy local)
So just over $50 for the majority of what I need.
Resistors (local purchase, once I confirm what's needed)
I have plenty of USB chargers and cables so I think power is not an issue. I have a couple of different soldering irons/guns (minor wiring, been nearly 30 years since I soldered a circuit board but I doubt much has changed). I think some wire for jumpers and perhaps a small breadbox is all I need to get going?
Does this current software do ramping on/off yet? I have the simple ramp timer but I want to incorporate sunrise and sunset lighting to the schedule, and perhaps moonlight for a couple of hours. It would be nice if I could still have the lights ramp on and off, though. A second lighting period that just brings the sunrise mode on for feeding time before work would be icing on the cake, else I can manually trigger it with the remote as I do now.
|03-11-2014 06:20 PM|
|Curt_Planted||Perhaps the lower resistance is preventing the arduino from maintaining proper voltage accross the led due to overdrawing current. Try 200 ohms (im using 2 100 ohms in series) and see what happens.|
|03-09-2014 10:08 PM|
|Aquatechtoo||Thanks, Curt_Planted. I'm using the IR led from one of Indychus' first posts. Its a LTE-5208A and according to the spec sheet, the typical V_ir is 1.2 (there's no minimum listed). I am using a 150 ohm resistor. Based on the resistance formula, it is 190. However, I'm not sure what this tells me?|
|03-08-2014 09:24 PM|
If your range is that short you may have too high a resistance with the LED. Look at the spec sheet for the ir led and see what the voltage requirement (V_ir) is. Then subtract the voltage requirement from 5 (the output voltage from the arduino I believe). That will give you the voltage left across your resistor. Since you know the current you want through the circuit (just shy of the 20 mA limit for the arduino) then the resistance is just that voltage divided by the current.
In equation form: R=(5-V_ir)/.02
For my IR led: (5-1.35)/.02=182.5 ohms
The IR led I am using needs 1.35 volts (its the forward voltage lower limit on the data sheet), and I rounded the resistance I calculated up to 200 ohms which gives me 18 mA current (slightly below the limit on the arduino). I have about a foot or so range.
|03-08-2014 07:51 PM|
|Aquatechtoo||Thanks, it does, sorta. If I recall correctly when I was building the controller, the emitter only had a range of maybe an inch. Do I need to boost that signal strength by using different hardware?|
|03-08-2014 07:37 PM|
|Curt_Planted||Aquatech2, the emission angle is not that wide. I have my two receivers staggered diagonally so the clear part of them is right next to eachother as seen from the emitter. Even then I still have them about 4 inches from the emitter. HTH|
|03-08-2014 06:55 PM|
I used much of this code and equipment from @Indychus, @Dalhammer, et. al. original posts to build a controller that's firing to two Satellite LED+ fixtures. I'm wondering if you guys know why the emitter doesn't fire consistently to both of the Satellite IR receivers. I'm assuming the emitter is the problem because randomly, either one of the fixtures appears not to receive the command from the controller because that fixture will be on one of the previous settings from earlier in the day. Some days, both lights work fine. Other days, either light can be sitting on another light setting, generally from earlier in the day. As a visual, here is how the setup looks.
|03-08-2014 08:13 AM|
|Curt_Planted||On another note, I am working on a much broader plan to automate my tank with a pair of arduinos with full redundancy. My eventual goal is to have one arduino controlling lighting, dosing, water changes, and co2 as well as acting as a tank/hose leak alert system. The second arduino will act as a fail safe, using pressure sensors, redundant water level sensors and photoresistors to confirm directly conditions are within the primary arduino's parameters and implementing a limp mode to minimize damage/risk to fish. It will also control a redundant solenoid to shut down CO2 if needed, and will control a relay controlling the power supply for the dosing system to shut it down if it fails, and a tertiary sprinkler valve to shut off water for the auto water change system ( there will already be a mechanical valve for fill control and electrical controls in place from the primary arduino). It will also include an ethernet shield to send me text alerts in the event of a failure. I have already set up a web cam and remote control of my pc with my phone so I can check the tank at work to confirm any issues. I just finished an outline plan for different phases of each control aspect and the key coding/technical issues to be solved. See what happens when a rocket scientist falls in love with planted tanks? I want to build it so there is no single point of failure and I will know within minutes if something goes wrong. It all started with me reading about how unreliable CO2 solenoids were. People suggested using 2 series pairs in parallel, and all I could think was: well it's great it will keep working if a valve fails, but what good is that? if you don't know there's a problem to fix, you've lost redundancy and your just delaying a system failure. So I want to solve that issue using sensors, and extend that idea to other damage/fauna critical systems in the controller.|
|03-08-2014 07:43 AM|
Might be a bit on the RTC, didn't realize it was so small and after my small soldering iron died I attempted it with a more broad tipped one... that is so not happening on the IC, lol! So I have to order a new iron before I can even hope to clean up the solder mess I made of my RTC kit!
Anor: If you look in my code I have already coded the sunrise and sunset as cases as in the original code, they can also be directly called as functions! Look at the main loop. For the customaccent fade the only issue is updating all the other functions to keep count of the light trackers. There is no way for the arduino to know what the light level is without doing that. To get it somewhere you want it to be it has to know where its at. I will work on adding in light tracker updates to the other functions and comment/uncomment the right spots for full manual control so you can see what I mean (Case 33 and 34 are sunrise and sunset if memory serves.) Not sure what to do with the dynamic effects... can't really assign a light level to them so may need to terminate them with a full sunrise or sunset to get to a known light level.
bcarl: I think it would be pretty straight forward to add in random t storms. Just a random number generator that initiates a break from the if-else statements, starts the tstorm function and then returns to previous lighting condition after. The issue I have with doing that is having already observed how bad the flashes freak out my fish! I certainly wouldn't use it for fear of stressing them!
|03-07-2014 04:59 PM|
|bcarl_10gal||Curt do you think you could find a way to incorporate the random t storms in with your code?|
|This thread has more than 15 replies. Click here to review the whole thread.|