Weather Simulation for Dimming expansion module

Share you PDE file with our community

Posts: 293
Joined: Tue Oct 25, 2011 7:39 am
PostPosted: Tue Jul 31, 2012 8:56 am
All right... its been a while with lots of views here and the tutorial-

-Would be curious- if you have this up and running can you reply here to let me know. I suppose its either working so well no one has issues and were good... or perhaps there is little interest. My tank has been stable for over a month now, I am waiting for the sun to start changing again so I can be sure its tracking it correctly so if your running it a few comments with regard to the timing of the tank sunrise and set v.s. your window would help me assess this.


Posts: 6
Joined: Thu May 24, 2012 10:25 am
Location: Nocera Inferiore
PostPosted: Thu Aug 02, 2012 9:14 am
Hello I would like to have your help for the setup program.
I understood very little. I built an LED lamp white and royal-blue. There are 8 blocks of LEDs.
Only one block is composed of white LEDs (W) and blue (B) distributed in this way [3W-2B-2B-3W-3W].
The white LEDs are operated by drivers 8
The blue LEDs are operated by 4 drivers.
I do not have any expansion pwm, but check the lamp with the two channels of PWM reefangel. So I can say that I have two channels?
If so how and what should I set in the file. Ino

Posts: 293
Joined: Tue Oct 25, 2011 7:39 am
PostPosted: Thu Aug 02, 2012 3:04 pm
Unfortunately you cannot currently use the program as I have been neglecting putting in the code to enable it to control dimming channels on the reef angel controller itself. Another reason you cannot use the code, is that it ABSOLUTELY requires you have a dimming expansion module, period. I doubt you could fit this code on your controller and have room enough for anything else really. Sorry!

Posts: 188
Joined: Fri Dec 30, 2011 6:57 am
PostPosted: Sat Aug 04, 2012 1:33 pm
Forgive my ignorance, but I have a couple quick questions that need to be answered before I can attempt to test this code.

1. Are we supposed to be uploading this code directly to the Dimming Module or just including it in our main controllers coding?

2. If we're uploading directly to the Dimming Module... do we need any special cables? Do we just hook up a USB cable to it?

2. If we are including it in the main controllers code... does it matter where we add our own personal function coding (ie., custom main screen, custom menus, feeding schedules, RF Module control, etc) in relation to your weather simulation coding? Is there anything that needs to be first (or last) thing in the overall coding?

Thanks in advance. I read this entire thread and the entire "Tutorial" thread you linked and neither one explained anything about where the code gets uploaded to or how to combine it with our own stuff.

The only reason I thought of this question is this paragraph in your tutorial:
As it exists today, the code runs as a stand alone software for the PWM OR ANALOG dimming expansion module. Although I use PWM, Roberto tells me that there is no difference between them aside from the output signal type so the code will work identically on either. By stand alone I mean that it completely takes over your PMW expansion module- it runs independently of the Main controller- it doesn't even acknowledge the fact that the main controller exists. This will evolve as we work to enable some comm etc but its not working now. It simply runs your lights, thats it- period. Sounds like its not doing much? Read on...

Anyway, I'm hoping to get this running this weekend so hopefully you or someone who has used this code can answer me.

Posts: 12644
Joined: Fri Mar 18, 2011 6:47 pm
PostPosted: Mon Aug 06, 2012 1:00 pm
Yes, you need to load into the dimming module. You can use the same cable you use to program RA. ... 191505.jpg

Attached is the original code if you want to revert back.
(3.04 KiB) Downloaded 209 times

Posts: 188
Joined: Fri Dec 30, 2011 6:57 am
PostPosted: Mon Aug 06, 2012 1:40 pm
Oh, I see. I need to take it apart and connect it inside? Gotcha.

Thanks Roberto!

Posts: 188
Joined: Fri Dec 30, 2011 6:57 am
PostPosted: Tue Aug 07, 2012 7:23 am
Well, I uploaded this code (after editing all the required lines as per the tutorial) last night and it didn't appear to work as intended. Granted, I only tested it by changing the time on the controller as a means of testing when the lights would come on/off.

I'm going to try it again next weekend when I can be home to watch it in real time after a natural reset of time on the clock.

Here are a couple observations I made while trying it:

1. After you upload the code (if it's not already disconnected) unplug and then reconnect the USB cable going into the Dimming Module. Until you do that, it appears that the Dimming Module remains the same as it was before changing the code on it. I'm guess that this sort of reboots the board on the module?

2. Here's the test I did and my results:

Since I set the lat / long for my house, I looked up the sunrise/sunset times for my house and found that sunrise should have been 6:04 AM and sunset was 8:09 PM. While testing this by changing the clock time on my controller, I first set it to a time that I knew it should have lights - 11:00 AM.

No lights came on at all. After taking a quick peak at the android app, I noticed that since it was after my normal lighting period, the relay ports for my LED's were turned off. I manually turned them on with the Android App and all the lights went on. At this point, I thought everything should be working great!...

So, my next test idea was to change the clock time to an earlier time when I knew they should be off (4:00 AM). My plan was to find the sunrise point that the code was calculating to see if it was close to my actual time per the table I looked up. I was going to first increase in 1 hr intervals until lights popped on, then go back 1 hr and then increase the minutes until I got it to pop on. Sounds like a solid plan right?

To my surpise, the lights actually stayed on at 4:00 AM (whites and blues) and didn't go off at all. I think this is when I discovered that I had to unplug/replug the USB cable to reset the dimming module and then all lights went off after that. I found this by just dumb luck while staring at the module, lol.

Then I increased the clock 1 hour to 5:00 AM and lights came on again (even though they shouldn't have for at least another hour). They also appeared to be on 100% (or very bright at least, not at the 10% start intensity I was expecting.) I was very confused at this point and thought that maybe I had just used the wrong lat/long and it was just working on another places settings.

At this point, I opted to increase the clock time to see if it would get even brighter (even though I thought it was already at or close to 100%). No change was noticed after going up in 1 hour intervals until 11 AM.

Now, I decided to change the clock back to 5 AM, lights stayed the same intensity. Then went back to 4 AM, still the same. At this point, I unplugged/reconnected the USB again and lights went out again.

I began ramping up the clock 1 hour at a time again and at one point I let the clock sit idle and watched for about 5-10 minutes. (I think it was around the 9 AM clock change, but I'm not positive.) There was sort of a random dimming going on and I could see what appeared to be the "cloud" feature. It didn't appear to flow from my left fixture to my right (as I had set in the variables to be changed). It was more like each light was randomly dimming/brightening/dimming/brightening/etc.... This went on for several minutes repeatedly. I should have watched longer to see if it would develop into a storm and possibly see lightning, but it was getting late at this point and I needed to get to bed.

3. I then reverted my dimming module back to the original code that Roberto provided. This morning, everything was back to normal as per my slope settings in my controller's .ino so I'm happy this test was no harm, no fowl.

While writing this post, I just had a thought that the last observation of the lights dimming/brightening repeatedly could possibly have been lightning, but maybe the "flash" interval was just set really slow? Or, perhaps my analog drivers just don't react as quickly as a PWM driver would? That's something I'll play with this weekend too.

Another thought I had was maybe my controller's slope coding had interfered with the weather sim code on the dimmer module all the while? Next time I test, I'll just comment out my dimming code on the controller and reupload before changing the code back on the dimmer module.

Anyway, hope that helps anyone else trying this that may have similar results.

Anyway, that's all I have for now. I'll report back over the weekend after I try this again.

Posts: 12644
Joined: Fri Mar 18, 2011 6:47 pm
PostPosted: Tue Aug 07, 2012 8:01 am
Did you reboot the dimming module everytime you changed the time?
I think the dimming only syncs with the time on reboot.

Posts: 188
Joined: Fri Dec 30, 2011 6:57 am
PostPosted: Tue Aug 07, 2012 9:03 am
Not every time, no. After a while, I kind of figured that was the issue... but I wasn't sure if the module just checked for the time read from the controller on every cycle of the loop?

If it only syncs time on reboot then that could explain a lot of the issues I was having.

On a side note, is there a way to see what the sunrise / sunset output values the dimming module would currently be using? I'd like to know what the unit is using after calculating the formula using my lat/long values and the current date/time. Any way I can simulate running the code in Arduino (before I upload it) and have it give me the sunrise / sunset values that the module would be using at the current time?

Posts: 12644
Joined: Fri Mar 18, 2011 6:47 pm
PostPosted: Tue Aug 07, 2012 9:31 am
Yeah, you can load it in a regular arduino board and place some Serial.println() calls.
Rufessor would be best to tell where to put the calls though.

Return to My PDE/INO file

Who is online

Users browsing this forum: No registered users and 5 guests