Improved Arduino LED lighting code - Page 3
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


Reply
 
Thread Tools Display Modes
Old 12-04-2011, 12:41 PM   #31
Tbakes
Algae Grower
 
Tbakes's Avatar
 
PTrader: (4/100%)
Join Date: Mar 2011
Location: Schwenksville, PA
Posts: 77
Default

Any update on this? Even though I can't get all my strings lit concurrently, I'm interested in the new Typhoon code!
Tbakes is offline   Reply With Quote
Sponsored Links
Advertisement
 
Old 12-04-2011, 01:30 PM   #32
sink
Algae Grower
 
PTrader: (2/100%)
Join Date: Jun 2011
Location: Boston, MA
Posts: 148
Default

I've done quite a bit of tinkering with the Typhon code, but it's a lower priority than the mountain of stuff that will get me fired if I don't do it . Inexcusable delay though, and I apologize about that. I'll do my best to get it done.

I do have an improved version of my simpler code (see first post in this thread) that I wrote a few months ago. It supports the ChronoDot RTC (the DS3231) and now you can set the time to the second from a PC without having to reflash the Arduino. Much cleaner than the previous way. I didn't post it because it isn't very documented yet, but it does work fine. If anybody wants this, let me know and I'll clean it up.
sink is offline   Reply With Quote
Old 12-04-2011, 02:38 PM   #33
MoeBetta
Planted Tank Obsessed
 
PTrader: (10/100%)
Join Date: Feb 2011
Location: Dayton, OH
Posts: 357
Default

Sink, is be very interested to see that, my chronodot rtc is already on order.

Don't feel bad, and there is nothing inexcusable about it. Thanks for doing whatever real life allows.
MoeBetta is offline   Reply With Quote
Old 12-05-2011, 01:52 AM   #34
sink
Algae Grower
 
PTrader: (2/100%)
Join Date: Jun 2011
Location: Boston, MA
Posts: 148
Default

Okay, I've posted the latest version of my code (not the Typhon stuff yet, sigh) on bitbucket. I also updated the libraries.zip archive to include the library for the ChronoDot. The links in the first post point to the latest version of the code.

This one works a bit differently. Once you've uploaded the tank-control sketch to the Arduino, you can get the time/set the time using a Python script (client.py) you run on your PC while connected to the Arduino over USB. You'll need to change the "PORT" line in that script to match your system. You also need to install the "serial" library for Python for your system. Once that is done, you run the script and enter "sync" at the prompt to set the Arduino time from your PC system time. You can also enter "time" to see what the Arduino thinks the current time is. Finally, either "quit" or "exit" will quit the program.

It needs to be documented better and I'll get around to that eventually, but if you have any problems just PM me and I can help.
sink is offline   Reply With Quote
Old 12-05-2011, 02:05 AM   #35
MoeBetta
Planted Tank Obsessed
 
PTrader: (10/100%)
Join Date: Feb 2011
Location: Dayton, OH
Posts: 357
Default

Hey, thanks a lot.



Hope you had a good weekend.
MoeBetta is offline   Reply With Quote
Old 12-10-2011, 02:31 PM   #36
MoeBetta
Planted Tank Obsessed
 
PTrader: (10/100%)
Join Date: Feb 2011
Location: Dayton, OH
Posts: 357
Default

Sink,

The errors I was getting were while using the newest version of the Arduino IDE (1.0)

After finding the errors I PMed you about I looked at them in C++ and not knowing enough to fix them I decided to try them in the .0023 beta of the arduino IDE and it uploaded fine.

I'm working on the remaining steps, but just wanted to post this in case anyone had the same problem. It seems the 1.0 checks all included codes, while the beta did not?
MoeBetta is offline   Reply With Quote
Old 12-10-2011, 03:05 PM   #37
MoeBetta
Planted Tank Obsessed
 
PTrader: (10/100%)
Join Date: Feb 2011
Location: Dayton, OH
Posts: 357
Default

I'm currently stuck on the python bit, but that's more due to ignorance than anything.
MoeBetta is offline   Reply With Quote
Old 12-10-2011, 03:11 PM   #38
sink
Algae Grower
 
PTrader: (2/100%)
Join Date: Jun 2011
Location: Boston, MA
Posts: 148
Default

Quote:
Originally Posted by MoeBetta View Post
Sink,

The errors I was getting were while using the newest version of the Arduino IDE (1.0)

After finding the errors I PMed you about I looked at them in C++ and not knowing enough to fix them I decided to try them in the .0023 beta of the arduino IDE and it uploaded fine.

I'm working on the remaining steps, but just wanted to post this in case anyone had the same problem. It seems the 1.0 checks all included codes, while the beta did not?
Welcome to the exciting world of Arduino 1.0, which broke compatibility with nearly every existing library for no particularly good reason. The internet is littered with posts like this. In your case the included Time library is incompatible with 1.0. Probably others are too, but it didn't get far enough in the compilation to find out.

I'm not using the Arduino IDE at all but my hacked together build environment is based on the Arduino 0023 core libraries so the code is written to compile against that. I will eventually upgrade even though there isn't a very good technical reason to do so: the new core uses more RAM than before -- a big deal on a microprocessor -- and adds few useful features. But since it'll likely require modifying the libraries I'm not in a big hurry to do so. Use 0022 or 0023 for now .

Thanks for the report. Please let me know about any other issues you run into and I'll update the docs. Or write it up for me and I'll include it in the distribution .
sink is offline   Reply With Quote
Old 12-10-2011, 03:20 PM   #39
sink
Algae Grower
 
PTrader: (2/100%)
Join Date: Jun 2011
Location: Boston, MA
Posts: 148
Default

Quote:
Originally Posted by MoeBetta View Post
I'm currently stuck on the python bit, but that's more due to ignorance than anything.
PM me with details

Nah, it's a good learning experience. Install python 2.7 (code isn't compatible with 3.x yet) and then the pyserial library (http://pypi.python.org/pypi/pyserial).

They you just have to figure out what the usb-serial port is called on your system, change that line ("PORT = ???") in the code, and you're off to the races.
sink is offline   Reply With Quote
Old 12-11-2011, 03:05 PM   #40
MoeBetta
Planted Tank Obsessed
 
PTrader: (10/100%)
Join Date: Feb 2011
Location: Dayton, OH
Posts: 357
Default

I got this script up and running last night. It works like a charm!

Esp. if you wire your circuit right.

Thank you Sink!
MoeBetta is offline   Reply With Quote
Old 12-11-2011, 04:48 PM   #41
sink
Algae Grower
 
PTrader: (2/100%)
Join Date: Jun 2011
Location: Boston, MA
Posts: 148
Default

Quote:
Originally Posted by MoeBetta View Post
I got this script up and running last night. It works like a charm!

Esp. if you wire your circuit right.

Thank you Sink!
You're welcome, let me know how it works when you have it all hooked up.

I just uploaded a new version with a bit better comments in the code for what people need to change to make it work. It doesn't add any features so no need to upgrade.
sink is offline   Reply With Quote
Old 01-27-2012, 09:12 PM   #42
stephenpence
Planted Member
 
PTrader: (7/100%)
Join Date: Mar 2010
Location: Laramie, WY
Posts: 165
Default

Well i'm playing catch up on this whole Code thing.. I'm basically worthless at it. BUT i bought an arduino Uno and a chronoDOt RTC and by gosh i'm gonna make this thing work. so a few questions:
If i were to reduce the code to only have one driver running off of it, what would i need to edit?
Also, for the life of me, i can't figure out what the heck Python is. I got it, installed it, and i am still just absolutely clueless.

In my defense, i am not an idiot.. i'm just an engineer. so i've never had a good reason to try and delve into this. Thanks in advance for the help!!
stephenpence is offline   Reply With Quote
Old 01-27-2012, 10:35 PM   #43
MoeBetta
Planted Tank Obsessed
 
PTrader: (10/100%)
Join Date: Feb 2011
Location: Dayton, OH
Posts: 357
Default

Just remove the lines that reference one of the channels.

"const int kChan1Pin = 10; // Channel 1 Pin" is where the second channel is assigned to pin 10

" if (state[1] >= 0 && state[1] <= 1023) Timer1.setPwmDuty(kChan1Pin, state[1]);" Where the second channel state is set.

Really, all I did was delete that first line and try uploading it via the Arduino alpha ide, it told me what else wouldn't work.

Once I deleted the lines it told me to it uploaded and worked just fine.

Python is another program that works in a slightly different language. Let me see if I can remember how I set my RTC.
MoeBetta is offline   Reply With Quote
Old 01-27-2012, 10:47 PM   #44
stephenpence
Planted Member
 
PTrader: (7/100%)
Join Date: Mar 2010
Location: Laramie, WY
Posts: 165
Default

great thank you! also, is there a program that will show what's going on on the arduino board as it happens? I'm not used to sending a program, and hoping it's doing what i told it to.
stephenpence is offline   Reply With Quote
Old 01-27-2012, 10:59 PM   #45
MoeBetta
Planted Tank Obsessed
 
PTrader: (10/100%)
Join Date: Feb 2011
Location: Dayton, OH
Posts: 357
Default

You can set up code for serial monitoring, as far as I know, that's the only way to do it.
MoeBetta is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not 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

Forum Jump


All times are GMT. The time now is 07:15 PM.


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