Show Posts
Pages: 1 [2]
16  Using Arduino / Programming Questions / Re: Please help with aquarium lights. on: August 10, 2011, 10:10:40 am

The item "sizeof(bluepercent)/sizeof(bluepercent[0])" is a way to indicate your array length without putting a specific value in it - as you add/remove from the bluepercent array, the count will always be correct. As well, 'i' can start counting at 0, not 1.



David,

This value is used to calculate many other parameters. Now it become too complicated as is very masive. For example :

 if (((ontime * 60) + photoperiod + whiteramptime + 2*blueramptime + (blueramptime/10*9)) >= daybyminute)

Now i need to use "sizeof(bluepercent)/sizeof(bluepercent[0])"  instead of 10. And "sizeof(bluepercent)/sizeof(bluepercent[0])" -1  instead of 9.

becomes :  if (((ontime * 60) + photoperiod + whiteramptime + 2*blueramptime + (blueramptime/sizeof(bluepercent)/sizeof(bluepercent[0])*sizeof(bluepercent)/sizeof(bluepercent[0])-1)) >= daybyminute)

Seems crazy to me  smiley-mr-green  Please advice on this.

 Can I do like that:

Int array;
array = sizeof(bluepercent)/sizeof(bluepercent[0]);
 if (((ontime * 60) + photoperiod + whiteramptime + 2*blueramptime + (blueramptime/array*(array-1))) >= daybyminute)
17  Using Arduino / Programming Questions / Re: Please help with aquarium lights. on: August 10, 2011, 09:07:52 am
Thanks David ,

Thats exactly what I wanted. I will try it and report back how things are going.

Thanks Paul,

There are other procedures in the code too, that are responsible for fading sped, start time etc. ... I just wanted to be simple here .

18  Using Arduino / Programming Questions / Re: Please help with aquarium lights. on: August 10, 2011, 02:13:37 am
Hi,

Thanks for input. That was exactly one thing what I understood by myself 
May be I need to paste more of the sketch  ?

Can anybody explain what is (i). If I can give different names for this like (i) and (f)  , then I can run both at the same time ?
19  Using Arduino / Programming Questions / Please help with aquarium lights - one more question- solved on: August 09, 2011, 03:36:24 pm
Hi all.
 Not many days passed, since I discovered arduino's wonders, so still not strong enough  to talk to it.  smiley-eek-blue
Hope you guys can help me solve this puzle.
 I have variation of popular controler for reef lighting .Originally written by "Christian".  I will demonstrate idea. Not whole sketch , just essentials :

Code:

int blue = 10;             // blue  LEDs connected to digital pin 10 (pwm)
int white = 11;            // white LEDs connected to digital pin 11 (pwm)


int bluepercent[11] = { 0, 26, 52, 78, 103, 128, 154, 180, 205, 230, 255 };
int whitepercent[11] = { 0, 26, 52, 78, 103, 128, 154, 180, 205, 230, 255 };


  for (int i = 1; i <= 10; i++) // setting ib value for 10% increment. Start with 0% - at given time blue leds fade in from 0 to 255

analogWrite(blue, bluepercent[i]);
lcd.setCursor(13, 1);
lcd.print(i);

  for (int i = 1; i <= 10; i++) // setting i value for 10% increment. Start with 0% - after blues are at 100% , whites start to fade in

 analogWrite(white, whitepercent[i]);
lcd.setCursor(18, 1);
lcd.print(i);


As  you see blue lights come in first and fade in following  " bluepercent" schedule. After it finishes , whites start  fading in folowing its own " whitepercent" schedule which is same in my case.

What I want to change , is that I want  both lights fading in  at the same time but different schedules : like


int bluepercent[11] =  { 0, 26, 52, 78, 103, 128, 154, 180, 205, 230, 255, 255, 255, 255, 255 };
int whitepercent[11] = { 0, 0,  0,  0,  0,   26,  52,  78,  103, 128, 154, 180, 205, 230, 255 };

"11" as i understand is not the right number anymore.And  thats all what I understand at the moment $ smiley-red
And how to make LCD to show real degree of each  light intensity in this case ?  Better 0 as min  to 10 as max. LCD space is limited  smiley

Thanks in advance to anyone, who will bother to help or just read to this word.
 

  
20  Using Arduino / Displays / Re: LCD randomly reverts to displaying hieroglyphs on: July 07, 2011, 07:55:49 am
One more update

Guys advised to twist all signal wires with ground. I will try where it is possible. LCD is connected via 8 wires and i dont know if it is good idea also using twist idea there ,or shielding is more advanced.
 I can only work with arduino when lights come down in tank and that's is damn hard. smiley-twist
21  Using Arduino / Displays / Re: LCD randomly reverts to displaying hieroglyphs on: July 05, 2011, 03:15:15 pm
Now only manual switching of pumps troubles LCD.
Would shielded cable for LCD connection help ?
22  Using Arduino / Displays / Re: LCD randomly reverts to displaying hieroglyphs on: July 04, 2011, 07:06:20 am
 Added magnetic chocke to 12v powerline.
 So far - so good.
23  Using Arduino / Displays / Re: LCD randomly reverts to displaying hieroglyphs on: July 03, 2011, 02:41:16 am
I will try to move components apart. Its the most easy test at the moment anyway.

floresta,

Characters move to the left. 1st line to 3rd and 2nd to 4th. Sometimes blinking cursor appears somewhere. Sometimes all is just stationary.
24  Using Arduino / Displays / Re: LCD randomly reverts to displaying hieroglyphs on: July 02, 2011, 08:38:03 am



This is how it usually looks. Temp sensors disconneced- so -127
Forgot to mention -  hieroglyphs are scrolling.  Roughly 1 character per second.
25  Using Arduino / Displays / Update on: July 02, 2011, 06:31:51 am
Just noticed.  LCD reverted to hieroglyphs after my auto-top-of  system kicked in. But it is 100% separate system. 240v pump supply and 5v controller supply are connected to same 240v power outlet though.

 Is it interference via power cables or magnetic interference via air ?
26  Using Arduino / Displays / Re: LCD randomly reverts to displaying hieroglyphs on: July 02, 2011, 05:56:36 am










Cant switch of lights for now as corals are sensitive animals. First need to master another source. Then I try to run controller
separately if better solution will not appear till then.

Wiring : http://www.reefledcontroller.com/images/lcd_bb.png   except connect to pins 13, 12, 7, 6, 5, 4 instead of 12, 11, 5, 4 , 3, 2
27  Using Arduino / Displays / Re: LCD randomly reverts to displaying hieroglyphs on: July 01, 2011, 01:42:11 pm
I use this LCD :

http://cgi.ebay.com/HD44780-20x4-LCD-module-Blue-backlight-Free-pin-header-/320537704483?pt=LH_DefaultDomain_0&hash=item4aa1893823#ht_2302wt_1017

All stuff is placed separated from aquarium - so its not wet. I checked wiring and soldering twice, also executed "earthquake" test.  Arduino is used for PWM controlling LED lights. Lights has own 24V  ps and driver. I disconnected all relays  for now. I can simulate event by plugging in-out other devices to same power outlet where arduino 12v PS sits. I need several tries to trigger usually.  And in real life its happening by itself, with no side intervention.

Im using code v1.03 from there : http://code.google.com/p/aquatroller/downloads/list

Hyeroglyphs are difficult do describe. Just strange unseen characters all over screen. Randomly screen is blank at all. Sometimes I  can see clock ticking through hyeroglyphs but differently placed .
28  Using Arduino / Displays / LCD randomly reverts to displaying hieroglyphs on: July 01, 2011, 07:00:23 am
LCD randomly reverts to displaying kind of hieroglyphs
After LCD go berserk, program on arduino continues working properly. After resetting arduino all returns to normal.
Guys was discussing this on aquarium forum, and most suspected that it is interference from switching on and of other electric equipment.
Anyone else  has experienced this  and successfully overcome ?

LCD is standard 20 x 4  and duemilanove
Pages: 1 [2]