|
||||||||||||||||
|
||||||||||||||||
|
|
|
|
#1 |
|
Algae Grower
|
I wasn't happy with any existing Arduino code for LED control so I wrote my own. I think it's quite nice though it needs polishing and probably some features added. It does light timing, sunrise/sunset fading and all that jazz.
Some improvements over existing code:
It works great for me. I'd love feedback, error reports, suggestions, free beers, etc. Post in the thread or PM me. I hope this will be useful to people! Get the code: Latest version Libraries bundle Installing libraries: The libraries that don't come with the Arduino environment by default are bundled in the zipfile above. Just extract that zip into the libraries folder inside your sketchbook folder and then restart the Arduino IDE. If libraries doesn't exist, create it first. Until I get around to writing documentation just post or PM installation questions/issues and I'll try to help. Latest Version: 12/11/2011 (only documentation changes, no need to upgrade!) Last edited by sink; 12-11-2011 at 04:46 PM.. |
|
|
|
|
|
#3 | |
|
Algae Grower
|
Quote:
Here's a tutorial that might be applicable Adafruit also sells an RTC breakout board kit with everything you need except wires for under $10. I don't have one but I modeled my RTC circuit after theirs and it works great, so might be an option if you want to add an RTC to an existing setup. |
|
|
|
|
|
|
#4 |
|
Planted Tank Obsessed
|
I'll give it a try! Took me nearly an hour to hunt down and install the extra libraries, but I got the code to compile without issue. I'll hook up the Dueminlanove this weekend and see what happens. Good job sink- Now if you could only show me how to integrate that coding into the controller that I built, that would be awesome!
|
|
|
|
|
|
#5 | |
|
Algae Grower
|
Quote:
I'd love to make a bundle with the required libraries but I'm not sure if the licenses permit it. In the meantime I'll edit the original post with links to the needed libraries. Thanks for pointing out that task might not be trivial. I'm willing to help with any driver integration you need. Do you mean the RTC or the code? |
|
|
|
|
|
|
#6 |
|
Planted Tank Obsessed
|
Sink,
I found the TimerOne and Time libraries at Arduino.cc, so I think you could zip them up together with your code and be good to go. There's one thing you need to fix though, your code cannot be unzipped and moved directly into the Arduino IDE. The IDE will not recognize the folder until it is renamed. I had to change the name of the folder to "akl_tank_control" and the file name to "akl_tank_control.pde" and then it would open and compile properly. This is detail that may cause trouble for people who are not familiar with some of the Arduino IDE's file naming requirements. I'll have to shoot you a PM with the coding for my controller. It works great as is, but I like the fact that your code updates the PWM every second, instead of once per minute. I've got the hardware side of things nailed down but I could use your help to improve the software. Here's a photo of the controller board- without the 16x2 LCD on top. ![]() I've got enough boot loaded ATMEGA328's to build 30 more, and a newer design that supports the MeanWell ELN-P's as well as my Cat4101's. Maybe a trade- Chips or a completed controller for software? |
|
|
|
|
|
#7 | |||
|
Algae Grower
|
Quote:
Quote:
Quote:
|
|||
|
|
|
|
|
#8 |
|
Planted Tank Obsessed
|
Sink,
I loaded the code into my Duemilanove and connected it up to my Cat4101's, Looks good so far. I made some changes to the code to run the leds at max (1023) all day,and set the night time level to a minimum (20) for moon lighting at night. I think a pwm value of 20 works out to be a hair less than 2%. I should know by 10pm whether or not the leds will continue to run at such a low setting. I did notice that there's something amiss with the time display in the serial monitor. The time displayed is 1 hour less than the correct time on my PC. Any idea what's causing that? Must be something to do with the DS1307 and daylight savings time? |
|
|
|
|
|
#9 | ||
|
Algae Grower
|
Quote:
Quote:
|
||
|
|
|
|
|
#10 | |
|
Planted Tank Obsessed
|
Quote:
I'll have to try that sketch. I just adjusted the start and stop time in the main sketch to compensate for now. hehe! |
|
|
|
|
|
|
#11 | |
|
Algae Grower
|
Quote:
On battery power the DS1307 shuts down all functions except for keeping the clock running so it can run for 5+ years on a single coin cell. Pretty nifty. |
|
|
|
|
|
|
#12 |
|
Algae Grower
|
Very cool - I'd like to upgrade my controller with the new code once it is worked out!
|
|
|
|
|
|
#13 |
|
Planted Tank Obsessed
|
|
|
|
|
|
|
#14 |
|
Planted Tank Obsessed
|
Sink,
I uploaded the TimeSet code.....Worked perfectly. I also uploaded the TankControl code again after lowering the minimum PWM state to "5" and stting the fade duration to 1 hour. All I can say is "WOW!" The dimming is completely linear, seamless, and totally natural looking. That has got to be the best Dimming Simulation that I've ever seen! I now have 90 little "moon lights" over my tank. Too cool! Thanks so much for creating and posting the codes! ![]()
|
|
|
|
|
|
#15 | |
|
Algae Grower
|
Quote:
Just kidding. You are welcome and thanks for testing. Cleaning this up and making it available to others is the least I can do in return for all of the knowledge I've shamelessly mined from this forum so far. |
|
|
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|