The Planted Tank Forum - Reply to Topic
Planted Tank Forums
Your Tanks Image Hosting *Tank Tracker * Plant Profiles Fish Profiles Planted Tank Guide Photo Gallery Articles

Go Back   The Planted Tank Forum > Specific Aspects of a Planted Tank > DIY > Guide: Arduino based LED controller for Current Satellite LED+

Thread: Guide: Arduino based LED controller for Current Satellite LED+ Reply to Thread
Title:
  
Message:
Post Icons
You may choose an icon for your message from the following list:
 

Register Now

In order to be able to post messages on the The Planted Tank Forum forums, you must first register.
Please enter your desired user name, your email address and other required details in the form below.
User Name:
Password
Please enter a password for your user account. Note that passwords are case-sensitive.
Password:
Confirm Password:
Email Address
Please enter a valid email address for yourself.
Email Address:

Log-in

Human Verification

In order to verify that you are a human and not a spam bot, please enter the answer into the following box below based on the instructions contained in the graphic.



Additional Options
Miscellaneous Options

Topic Review (Newest First)
12-14-2014 01:48 AM
kman
Quote:
Originally Posted by O2surplus View Post
Ah ha! The old "pre- Arduino 1.0" library incompatibility raised it's ugly head again. The libraries that you downloaded from "Sink"'s site haven't been updated to work with Arduino 1.0 & above.

Try these copies of the libraries. They work fine for me.
Ha! That did it, thanks! I'll definitely use that sketch next time I tinker with the code on my controller.

(I already have a current Time library, of course, it just needed the ds1307 one updated)
12-14-2014 01:21 AM
O2surplus
Quote:
Originally Posted by kman View Post
Hmm. I tried this code today, and I can't get it to compile and verify.

At first, it complained about RTC.set not being defined, but then I realized I needed to add the libraries from the link in the code. (in particular, ds1307rtc)

So I added the libraries and restarted the IDE, and now it's giving me a bunch of errors from within the ds12307rtc library:

Code:
  This report would have more information with
  "Show verbose output during compilation"
  enabled in File > Preferences.
Arduino: 1.0.6 (Mac OS X), Board: "Arduino Uno"
/Users/kman/Documents/Arduino/libraries/DS1307RTC/DS1307RTC.cpp: In static member function 'static void DS1307RTC::read(tmElements_t&)':
/Users/kman/Documents/Arduino/libraries/DS1307RTC/DS1307RTC.cpp:56: error: 'class TwoWire' has no member named 'send'
/Users/kman/Documents/Arduino/libraries/DS1307RTC/DS1307RTC.cpp:62: error: 'class TwoWire' has no member named 'receive'
/Users/kman/Documents/Arduino/libraries/DS1307RTC/DS1307RTC.cpp:63: error: 'class TwoWire' has no member named 'receive'
/Users/kman/Documents/Arduino/libraries/DS1307RTC/DS1307RTC.cpp:64: error: 'class TwoWire' has no member named 'receive'
/Users/kman/Documents/Arduino/libraries/DS1307RTC/DS1307RTC.cpp:65: error: 'class TwoWire' has no member named 'receive'
/Users/kman/Documents/Arduino/libraries/DS1307RTC/DS1307RTC.cpp:66: error: 'class TwoWire' has no member named 'receive'
/Users/kman/Documents/Arduino/libraries/DS1307RTC/DS1307RTC.cpp:67: error: 'class TwoWire' has no member named 'receive'
/Users/kman/Documents/Arduino/libraries/DS1307RTC/DS1307RTC.cpp:68: error: 'class TwoWire' has no member named 'receive'
/Users/kman/Documents/Arduino/libraries/DS1307RTC/DS1307RTC.cpp: In static member function 'static void DS1307RTC::write(tmElements_t&)':
/Users/kman/Documents/Arduino/libraries/DS1307RTC/DS1307RTC.cpp:74: error: 'class TwoWire' has no member named 'send'
/Users/kman/Documents/Arduino/libraries/DS1307RTC/DS1307RTC.cpp:76: error: 'class TwoWire' has no member named 'send'
/Users/kman/Documents/Arduino/libraries/DS1307RTC/DS1307RTC.cpp:77: error: 'class TwoWire' has no member named 'send'
/Users/kman/Documents/Arduino/libraries/DS1307RTC/DS1307RTC.cpp:78: error: 'class TwoWire' has no member named 'send'
/Users/kman/Documents/Arduino/libraries/DS1307RTC/DS1307RTC.cpp:79: error: 'class TwoWire' has no member named 'send'
/Users/kman/Documents/Arduino/libraries/DS1307RTC/DS1307RTC.cpp:80: error: 'class TwoWire' has no member named 'send'
/Users/kman/Documents/Arduino/libraries/DS1307RTC/DS1307RTC.cpp:81: error: 'class TwoWire' has no member named 'send'
/Users/kman/Documents/Arduino/libraries/DS1307RTC/DS1307RTC.cpp:82: error: 'class TwoWire' has no member named 'send'

Ah ha! The old "pre- Arduino 1.0" library incompatibility raised it's ugly head again. The libraries that you downloaded from "Sink"'s site haven't been updated to work with Arduino 1.0 & above.

Try these copies of the libraries. They work fine for me.
12-13-2014 11:16 PM
kman
Quote:
Originally Posted by O2surplus View Post
Here's the sketch that I use to set the time and date on my DS1307 RTC. This sketch was written by "Sink", a forum member here at PlantedTank.net This sketch pulls the time directly from your PC, and loads it directly to the clock chip. There's no need to adjust any variables, just open the sketch, & hit the upload button. Easy Peasy
Hmm. I tried this code today, and I can't get it to compile and verify.

At first, it complained about RTC.set not being defined, but then I realized I needed to add the libraries from the link in the code. (in particular, ds1307rtc)

So I added the libraries and restarted the IDE, and now it's giving me a bunch of errors from within the ds12307rtc library:

Code:
  This report would have more information with
  "Show verbose output during compilation"
  enabled in File > Preferences.
Arduino: 1.0.6 (Mac OS X), Board: "Arduino Uno"
/Users/kman/Documents/Arduino/libraries/DS1307RTC/DS1307RTC.cpp: In static member function 'static void DS1307RTC::read(tmElements_t&)':
/Users/kman/Documents/Arduino/libraries/DS1307RTC/DS1307RTC.cpp:56: error: 'class TwoWire' has no member named 'send'
/Users/kman/Documents/Arduino/libraries/DS1307RTC/DS1307RTC.cpp:62: error: 'class TwoWire' has no member named 'receive'
/Users/kman/Documents/Arduino/libraries/DS1307RTC/DS1307RTC.cpp:63: error: 'class TwoWire' has no member named 'receive'
/Users/kman/Documents/Arduino/libraries/DS1307RTC/DS1307RTC.cpp:64: error: 'class TwoWire' has no member named 'receive'
/Users/kman/Documents/Arduino/libraries/DS1307RTC/DS1307RTC.cpp:65: error: 'class TwoWire' has no member named 'receive'
/Users/kman/Documents/Arduino/libraries/DS1307RTC/DS1307RTC.cpp:66: error: 'class TwoWire' has no member named 'receive'
/Users/kman/Documents/Arduino/libraries/DS1307RTC/DS1307RTC.cpp:67: error: 'class TwoWire' has no member named 'receive'
/Users/kman/Documents/Arduino/libraries/DS1307RTC/DS1307RTC.cpp:68: error: 'class TwoWire' has no member named 'receive'
/Users/kman/Documents/Arduino/libraries/DS1307RTC/DS1307RTC.cpp: In static member function 'static void DS1307RTC::write(tmElements_t&)':
/Users/kman/Documents/Arduino/libraries/DS1307RTC/DS1307RTC.cpp:74: error: 'class TwoWire' has no member named 'send'
/Users/kman/Documents/Arduino/libraries/DS1307RTC/DS1307RTC.cpp:76: error: 'class TwoWire' has no member named 'send'
/Users/kman/Documents/Arduino/libraries/DS1307RTC/DS1307RTC.cpp:77: error: 'class TwoWire' has no member named 'send'
/Users/kman/Documents/Arduino/libraries/DS1307RTC/DS1307RTC.cpp:78: error: 'class TwoWire' has no member named 'send'
/Users/kman/Documents/Arduino/libraries/DS1307RTC/DS1307RTC.cpp:79: error: 'class TwoWire' has no member named 'send'
/Users/kman/Documents/Arduino/libraries/DS1307RTC/DS1307RTC.cpp:80: error: 'class TwoWire' has no member named 'send'
/Users/kman/Documents/Arduino/libraries/DS1307RTC/DS1307RTC.cpp:81: error: 'class TwoWire' has no member named 'send'
/Users/kman/Documents/Arduino/libraries/DS1307RTC/DS1307RTC.cpp:82: error: 'class TwoWire' has no member named 'send'
12-03-2014 04:51 AM
Greg0u812 WOW!!!!!
Thank you @kman !

I hope that instructional post can get get stickied around here.

I had a couple of very simple and stupid questions that Google has not been able to answer for me.

The answers were right in front of me!
12-03-2014 04:24 AM
kman Nice, O2! I'll grab that. It's better the one I'd been using. (Which was already way better than others I've seen!)
12-03-2014 02:18 AM
O2surplus Here's the sketch that I use to set the time and date on my DS1307 RTC. This sketch was written by "Sink", a forum member here at PlantedTank.net This sketch pulls the time directly from your PC, and loads it directly to the clock chip. There's no need to adjust any variables, just open the sketch, & hit the upload button. Easy Peasy

Code:
 /*
 * Name:    timeset.pde
 * Author:    User "sink" at plantedtank.net forums
 * URL:        http://bitbucket.org/akl/tank-control
 *
 * This code sets the time on a DS1307 RTC chip attached to an Arduino
 * microcontroller board.  The time is set to the system time when the
 * sketch was compiled (using preprocessor macros), so make sure that:
 *
 *     1. Your system (PC) time is accurate.
 *     2. You recompile the sketch and then upload immediately.
 *
 * The time is skewed forward some seconds to accomodate for compilation and
 * upload time.  If you find the time is consistently off by the same amount,
 * you can modify the adjustment constant below.
 *
 * This code requires the following libraries: Wire, Time, DS1307RTC
 *
 * The latest version of this code can always be found at above url.
 */

/*
 * Copyright (c) 2011, User "sink" at plantedtank.net forums
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are met:
 *
 * 1. Redistributions of source code must retain the above copyright notice,
 *    this list of conditions and the following disclaimer.
 *
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.

 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 * POSSIBILITY OF SUCH DAMAGE.  
 */

#include <Time.h>
#include <Wire.h>
#include <DS1307RTC.h>

/*
 * Time adjustment forward in seconds.  Used to compensate for
 * compilation/upload time.
 */
const int kAdjustment = 25;

/*
 * Utility function for pretty digital clock time output
 * From example code in Time library -- author unknown
 */
void printDigits(int digits) {
  Serial.print(":");
  if(digits < 10)
    Serial.print('0');
  Serial.print(digits);
}

/*
 * Display time
 * Adapted from example code in Time library -- author unknown
 */
void digitalClockDisplay() {
  Serial.print(hour());
  printDigits(minute());
  printDigits(second());
  Serial.print(" ");
  Serial.print(month());
  Serial.print("/");
  Serial.print(day());
  Serial.print("/");
  Serial.print(year()); 
  Serial.println(); 
}

void setup() {

  // convert compilation time and set system clock
  char const *date = __DATE__;
  char const *time = __TIME__;
  int sec, min, hour, day, month, year;
  
  char s_month[5];
  static const char month_names[] = "JanFebMarAprMayJunJulAugSepOctNovDec";
  sscanf(date, "%s %d %d", s_month, &day, &year);
  month = (strstr(month_names, s_month)-month_names)/3;
  sscanf(time, "%d:%d:%d", &hour, &min, &sec);

  setTime(hour, min, sec, day, month+1, year);
  adjustTime(kAdjustment); // crude fwd correction
  time_t t = now();

  // set RTC
  RTC.set(t);

  Serial.begin(115200);
}

void loop () {
  digitalClockDisplay();  
  Serial.println(); 
  delay(1000);
}
12-02-2014 08:40 PM
AnotherHobby
Quote:
Originally Posted by toaduck View Post
and this text below (time alarms lib) in red is the number you change to increase time alarms correct? I increased to 25




Code:
//  TimeAlarms.h - Arduino Time alarms header for use with Time library

#ifndef TimeAlarms_h
#define TimeAlarms_h

#include <inttypes.h>

#include "Time.h"

#define dtNBR_ALARMS 25   // max is 255

#define USE_SPECIALIST_METHODS  // define this for testing
Yes.
12-02-2014 08:07 PM
toaduck and this text below (time alarms lib) in red is the number you change to increase time alarms correct? I increased to 25




Code:
//  TimeAlarms.h - Arduino Time alarms header for use with Time library

#ifndef TimeAlarms_h
#define TimeAlarms_h

#include <inttypes.h>

#include "Time.h"

#define dtNBR_ALARMS 25   // max is 255

#define USE_SPECIALIST_METHODS  // define this for testing
12-02-2014 07:32 PM
kman
Quote:
Originally Posted by toaduck View Post
I was meaning sketches. Sorry. Still learning the terminology.

I guess what I'm asking is, does the siesta sketch that "curt planted" wrote for the ramping up and down feature work correctly. It's on post 452. I like the idea of the gradual ramping but after reading I couldn't determine if he ever got it working perfectly.

You did a fantastic job on the tutorial write up.
Thanks!

No worries on the lingo, I just wasn't sure if you were trying to determine specific IR codes or something else. "Code" can be an unfortunately vague term, I agree.

I can't answer your question about Curt_Planted's sketch, unfortunately. That's something I've been meaning to look into myself. But since my Controller is working reasonably well with Dahammer's sketch (calling it that even though Indychus and others contributed, just for the record, you haven't been forgotten, guys!), and I've been busy trying to get my iAqua controller finished (WAY more complicated), I just haven't had a chance to download Curt's code and play with it yet. If he doesn't chime in soon, you may want to send him a PM?

Personally, though, in the meantime, I'd set up the Dahammer 4.1 sketch and get that dialed in, since it's much simpler and many people are using it successfully. Once you have everything fully functional and working, then start playing with Curt's fancy sketch. You'll always have a fully functional fall-back position while you experiment. That's what I've done, anyway, so perhaps I'm biased about that being a good idea. LOL

Quote:
Originally Posted by toaduck View Post
another question just to make sure. All i do is replace times in parenthesis in the sketch to customize it to my desired schedule, correct? nothing else to change for that?

Code:
// Set up your desired alarms here
  // The default value of dtNBR_ALARMS is 6 in TimeAlarms.h.
  // This code sets 9 alarms by default, so you'll need to change dtNBR_ALARMS to 9 or more
  // Changes the times to suit yourself. Add as many alarms as you like, just stay within dtNBR_ALARMS
  Alarm.alarmRepeat(16,59,0, PowerOnOff);   // power on at 4:59pm (still moonlight mode)
  Alarm.alarmRepeat(17,00,0, DawnDusk);     // Dawn/Dusk mode at 5pm for 30 min
  //Alarm.alarmRepeat(7,30,0, Cloud2); // (HR,MIN,SEC,FUNCTION)
  Alarm.alarmRepeat(17,30,0, FullSpec);    // FullSpectrum at 5:30
  //Alarm.alarmRepeat(18,00,0, Cloud2);
  Alarm.alarmRepeat(23,40,0, DawnDusk);    // Back to Dawn/Dusk at 11:40pm for 20 min
  Alarm.alarmRepeat(23,59,0, Moon2);       // Moonlight mode at 11:59pm for 45 min
  Alarm.alarmRepeat(0,45,0, PowerOnOff);   // Power off at 12:45am
Yes, exactly. For instance, on the line that says "Alarm.alarmRepeat(17,30,0, FullSpec);" which turns on full spectrum lighting at 5:30pm, if you wanted that to happen at 10am instead, just change the time itself (bolded here) to "Alarm.alarmRepeat(10,00,0, FullSpec);"
12-02-2014 06:27 PM
toaduck another question just to make sure. All i do is replace times in parenthesis in the sketch to customize it to my desired schedule, correct? nothing else to change for that?





Code:
// Set up your desired alarms here
  // The default value of dtNBR_ALARMS is 6 in TimeAlarms.h.
  // This code sets 9 alarms by default, so you'll need to change dtNBR_ALARMS to 9 or more
  // Changes the times to suit yourself. Add as many alarms as you like, just stay within dtNBR_ALARMS
  Alarm.alarmRepeat(16,59,0, PowerOnOff);   // power on at 4:59pm (still moonlight mode)
  Alarm.alarmRepeat(17,00,0, DawnDusk);     // Dawn/Dusk mode at 5pm for 30 min
  //Alarm.alarmRepeat(7,30,0, Cloud2); // (HR,MIN,SEC,FUNCTION)
  Alarm.alarmRepeat(17,30,0, FullSpec);    // FullSpectrum at 5:30
  //Alarm.alarmRepeat(18,00,0, Cloud2);
  Alarm.alarmRepeat(23,40,0, DawnDusk);    // Back to Dawn/Dusk at 11:40pm for 20 min
  Alarm.alarmRepeat(23,59,0, Moon2);       // Moonlight mode at 11:59pm for 45 min
  Alarm.alarmRepeat(0,45,0, PowerOnOff);   // Power off at 12:45am
12-02-2014 05:48 PM
toaduck
Quote:
Originally Posted by kman View Post
What do you mean by "code"? IR code? That's all pretty well annotated in the various sketches since the start, I thought. If there is a specific section you're trying to figure out, just let me know.
I was meaning sketches. Sorry. Still learning the terminology.

I guess what I'm asking is, does the siesta sketch that "curt planted" wrote for the ramping up and down feature work correctly. It's on post 452. I like the idea of the gradual ramping but after reading I couldn't determine if he ever got it working perfectly.

You did a fantastic job on the tutorial write up.
12-02-2014 05:40 PM
kman
Quote:
Originally Posted by toaduck View Post
I agree.

Im trying different codes now. I uploaded the siesta code today. I hope it works correctly. It would be nice to have a list of codes in one spot explaining what each code did. I know it's easy for the guys who are really computer savvy to tell what does what but some of us have a hard time understanding it.
What do you mean by "code"? IR code? That's all pretty well annotated in the various sketches since the start, I thought. If there is a specific section you're trying to figure out, just let me know.
12-02-2014 02:56 PM
toaduck
Quote:
Originally Posted by jlboygenius View Post
I implemented this a few months ago, and other than the RTC being a few hours off and needing to be reset, it's worked very well.

Can we put this code on GitHub or something? The only trouble I had with this project was finding the right post that had the latest code.

kman's post was great, and should be the readme on the GitHub site.
I agree.

Im trying different codes now. I uploaded the siesta code today. I hope it works correctly. It would be nice to have a list of codes in one spot explaining what each code did. I know it's easy for the guys who are really computer savvy to tell what does what but some of us have a hard time understanding it.
12-02-2014 02:43 PM
jlboygenius I implemented this a few months ago, and other than the RTC being a few hours off and needing to be reset, it's worked very well.

Can we put this code on GitHub or something? The only trouble I had with this project was finding the right post that had the latest code.

kman's post was great, and should be the readme on the GitHub site.
12-02-2014 12:42 AM
Linwood I've touched on a Raspberry Pi vserion in a few posts. I will quit polluting his thread with that, and have started a new one describing that build: here
This thread has more than 15 replies. Click here to review the whole thread.

Posting Rules
You may post new threads
You may post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


All times are GMT. The time now is 08:42 AM.


Powered by vBulletin®
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Copyright Planted Tank LLC 2012