Reef Central Online Community

Go Back   Reef Central Online Community > General Interest Forums > Do It Yourself
Blogs FAQ Calendar Mark Forums Read

Notices

User Tag List

Reply
Thread Tools
Unread 10/28/2013, 09:20 AM   #76
d0ughb0y
Registered Member
 
d0ughb0y's Avatar
 
Join Date: Mar 2008
Location: sf bay area
Posts: 5,165
Quote:
Originally Posted by wgraham View Post
If I change out the return to make it the heater will I cause any problem.
you mean in config.h or in index.htm?
if you update index.htm to the latest version, it will get the outlet names as defined in config.h


d0ughb0y is offline   Reply With Quote
Unread 10/28/2013, 09:25 AM   #77
d0ughb0y
Registered Member
 
d0ughb0y's Avatar
 
Join Date: Mar 2008
Location: sf bay area
Posts: 5,165
Quote:
Originally Posted by wgraham View Post
I don't need to use any PWM's for lighting I have separate control for them.
that's fine. it just means the controller can have a maximum of 6 pwm lines, and function can be defined by modifying the program. Actually, 3 more can be added for a total of 9 pwm lines if I move the temp sensor onewire line to another pin.


d0ughb0y is offline   Reply With Quote
Unread 10/28/2013, 10:19 AM   #78
wgraham
Registered Member
 
Join Date: Aug 2004
Posts: 292
Yes in the config.h, I updated to the latest index.htm and when I change to 16 outlets and call out heater on outlet 9 still want open in the webpage. Also I was thinking about making this a slave mega and using a master with a touchscreen lcd to see the ph and temp reading on the touchscreen and everything else on the webpage. So I don't need to use the LCD pin. So can use the rest for the pumps. So far I got the temp and ph reading on my master LCD screen. I control all my lighting on the master with 9 channels of led's using different colors.


wgraham is offline   Reply With Quote
Unread 10/28/2013, 10:21 AM   #79
wgraham
Registered Member
 
Join Date: Aug 2004
Posts: 292
Thanks for all your help


wgraham is offline   Reply With Quote
Unread 10/28/2013, 10:46 AM   #80
d0ughb0y
Registered Member
 
d0ughb0y's Avatar
 
Join Date: Mar 2008
Location: sf bay area
Posts: 5,165
Quote:
Originally Posted by wgraham View Post
Yes in the config.h, I updated to the latest index.htm and when I change to 16 outlets and call out heater on outlet 9 still want open in the webpage. Also I was thinking about making this a slave mega and using a master with a touchscreen lcd to see the ph and temp reading on the touchscreen and everything else on the webpage. So I don't need to use the LCD pin. So can use the rest for the pumps. So far I got the temp and ph reading on my master LCD screen. I control all my lighting on the master with 9 channels of led's using different colors.
make sure you change this

#define EEPROMSIG 0xA0 //change this everytime you want the eeprom defaults to change
change it to any value, like 0xA1. That was supposed to be a checksum, but for now, just manually enter a different value.
you will know the EEPROM got updated if you hear the 2 short + 1 long beep confirmation.

changing to use I2C to communicate with another mega will be a big undertaking compared to just getting it to work on the web page. And I think it should be the other way around, the LCD display is the slave, not the master.



Last edited by d0ughb0y; 10/28/2013 at 11:00 AM.
d0ughb0y is offline   Reply With Quote
Unread 10/28/2013, 11:42 AM   #81
wgraham
Registered Member
 
Join Date: Aug 2004
Posts: 292
I already had the mega with the touchscreen controlling my lights and just use I2C to communicate the ph and temp data to it, using the wire library. But when I'm just testing the code I don't have the I2C in the code just how you got it. I change the #define EEPROMSIG 0xA0 every time I change anything. My problem is that I have 9 channel of lights over the tank and I like your interface. So basically I have two controllers on the tank. Everything work just fine as is, just wanted to use more of the outlets. I could just use one of the outlets that I don't think I will need and replace it with the heater.
But if you get a chance to see if it's just me doing something wrong with changing from 8 to 16 max outlet let me know and also when change back to 8 the page loads back up.
Thanks


wgraham is offline   Reply With Quote
Unread 10/28/2013, 11:42 AM   #82
wgraham
Registered Member
 
Join Date: Aug 2004
Posts: 292
How do you like the WP25


wgraham is offline   Reply With Quote
Unread 10/28/2013, 01:42 PM   #83
d0ughb0y
Registered Member
 
d0ughb0y's Avatar
 
Join Date: Mar 2008
Location: sf bay area
Posts: 5,165
Quote:
Originally Posted by wgraham View Post
I already had the mega with the touchscreen controlling my lights and just use I2C to communicate the ph and temp data to it, using the wire library. But when I'm just testing the code I don't have the I2C in the code just how you got it. I change the #define EEPROMSIG 0xA0 every time I change anything. My problem is that I have 9 channel of lights over the tank and I like your interface. So basically I have two controllers on the tank. Everything work just fine as is, just wanted to use more of the outlets. I could just use one of the outlets that I don't think I will need and replace it with the heater.
But if you get a chance to see if it's just me doing something wrong with changing from 8 to 16 max outlet let me know and also when change back to 8 the page loads back up.
Thanks
please email your config.h to me so I can take a look at your setup. I probably still have some other hardcoded values in the code I need to fix. I know I tested the htm file on an Apex with 24 outlets and it displayed correctly. So the problem may be in the arduino code, probably in Apex.ino.

as to using I2C, remember I changed my I2C to run 400khz. The default is 100khz. You will need to setup an I2C slave to wait for requests from your light controller if you want to set that up as I2C master. There should be plenty of example code making two arduinos communicate via I2C.

Quote:
Originally Posted by wgraham View Post
How do you like the WP25
I've only used it for a day. I like the fact that they make it easy to control.
I removed my 4 koralias and replaced it with one wp-25. Strictly speaking, I can actually get by now with just 3 outlets (return, kalk/ato, heater). I only use outlets that need to be controlled on a schedule. Things like media reactor pump that are always ON I do not use on the controller outlet.

I've already got a basic code for controlling the pwm and the frequency. next I need to come up with a method to define the patterns and the program schedule.


d0ughb0y is offline   Reply With Quote
Unread 10/28/2013, 03:23 PM   #84
rott
Head zoo keeper
 
Join Date: Nov 2005
Location: Toledo ,Ohio
Posts: 710
does your sketch have pwm pins for lighting? ramp up in the am and ramp down at night?
for 2 pins or maybe more. if not using wp pumps


rott is offline   Reply With Quote
Unread 10/28/2013, 06:28 PM   #85
wgraham
Registered Member
 
Join Date: Aug 2004
Posts: 292
Hello thanks again by putting a 9 in max outlets made the webpage come up. Also I can see that I have 9 outlets. So I guess if I add more outlets just change it to the number I'm using up to 16


wgraham is offline   Reply With Quote
Unread 10/28/2013, 07:05 PM   #86
sdtimer
Registered Member
 
Join Date: Jul 2013
Posts: 12
thank you and you help!!!

other question:
1. I have 2 DIY Leds, The Leds need 5 channel PWM. and I have 2 wp40 need use 2 channel PWM. But you program use 4 timer, then I only have 9,11,12 pin. PLS tell me, what pin can I use?

2. if I need 9:00am poweron and 20:30PM poweroff, what can i set on webpage.


sdtimer is offline   Reply With Quote
Unread 10/28/2013, 07:23 PM   #87
d0ughb0y
Registered Member
 
d0ughb0y's Avatar
 
Join Date: Mar 2008
Location: sf bay area
Posts: 5,165
Quote:
Originally Posted by rott View Post
does your sketch have pwm pins for lighting? ramp up in the am and ramp down at night?
for 2 pins or maybe more. if not using wp pumps
the current wiring diagram supports 2 10v PWM. You can add your own code and do analogWrite to pins 2 and 3.


d0ughb0y is offline   Reply With Quote
Unread 10/28/2013, 07:29 PM   #88
d0ughb0y
Registered Member
 
d0ughb0y's Avatar
 
Join Date: Mar 2008
Location: sf bay area
Posts: 5,165
Quote:
Originally Posted by sdtimer View Post
thank you and you help!!!

other question:
1. I have 2 DIY Leds, The Leds need 5 channel PWM. and I have 2 wp40 need use 2 channel PWM. But you program use 4 timer, then I only have 9,11,12 pin. PLS tell me, what pin can I use?

2. if I need 9:00am poweron and 20:30PM poweroff, what can i set on webpage.
With the latest code, you can use PWM on pins
2,3,5,9,11,12,44,45
if you move the temp sensor from pin 46 to any other free digital pin, you can use pin 46 for pwm as well for a total of 9 PWM pins.
in Sensors.ino, change

#define TEMPPIN 46
to the new pin number that is not a PWM pin.

That is all the usable PWM lines on the Mega. Since you cannot use pins 4, and 10 since they are used by ethernet shield, and pin 13 is used by LED.

The outlet scheduler is for turning the outlets on/off on a schedule. You must write your own routine to control the PWM lines for the LED. I am currently working on the code for WP pumps.


d0ughb0y is offline   Reply With Quote
Unread 10/29/2013, 01:55 AM   #89
sdtimer
Registered Member
 
Join Date: Jul 2013
Posts: 12
I was change code for PWM, not use loop. and add code update_leds() to ISR(TIMER4_COMPB_vect).

The PWM code like this:
Code:
static int bl = 0;

  lcd.setCursor(0,3);
  lcd.print("B:"); 
  if (bluePins[bl] < blueChannels) {
    value = SunLight(bluePins[bl],BluePWMHigh[bl],BluePWMLow[bl],BlueFull[bl],m_year,m_month,dayOfMonth,rtcHrs,rtcMins,m_second); 
    Serial.print(map(value,BluePWMLow[bl],BluePWMHigh[bl],0,100)); 
    Serial.print("% "); 
    analogWrite(bluePins[bl], value); 
    bl++;
  }else{
    bl=0;
  }
Is this code OK?

I want to add ORP&WI-FI module, and make this controller in china, are you agree?
If you disagree, I must stop it!



Last edited by sdtimer; 10/29/2013 at 02:32 AM.
sdtimer is offline   Reply With Quote
Unread 10/29/2013, 11:00 AM   #90
d0ughb0y
Registered Member
 
d0ughb0y's Avatar
 
Join Date: Mar 2008
Location: sf bay area
Posts: 5,165
Quote:
Originally Posted by sdtimer View Post
I was change code for PWM, not use loop. and add code update_leds() to ISR(TIMER4_COMPB_vect).

Is this code OK?

I want to add ORP&WI-FI module, and make this controller in china, are you agree?
If you disagree, I must stop it!
I don't think you can add that routine into ISR. The ISRs currently take about 100-200us time to execute. The LED functions contain a lot of floating point operations and will take a lot of time inside the ISR. Besides, you cannot call analogWrite inside an ISR, you have to write directly to timer registers. I can see a time based ramp up/ ramp down can work in ISR, but not a sunrise/sunset based function with a lot of floating point calculations.

What LED are you using? If I can get a unit to test and use, I can write a code for it.

It is possible to add ORP, Wifi etc. ORP and Conductivity/Salinity (specific gravity) probes are currently supported when using the htm with Neptune Apex controller. Arduino Wifi shield will be easier to convert. Using wifi like RN-XV wifly with serial interface will take a lot more work to convert. Do you have any low cost wifi module you plan to use?

Please email me regarding your plan with the controller.


d0ughb0y is offline   Reply With Quote
Unread 10/29/2013, 11:48 AM   #91
d0ughb0y
Registered Member
 
d0ughb0y's Avatar
 
Join Date: Mar 2008
Location: sf bay area
Posts: 5,165
I'm still thinking of the best way to hook up the jebao pump to the controller.
My controller currently use stereo jacks for connection. So for one stereo jack, I can put out 2 control lines plus ground to control two jebao pumps.

I have the option to open up the jebao controller case, and add a switched mono jack that will pass through the control signal if nothing is plugged into the jack, but will use the control line from the mono plug if plugged in.

The second option is to use a 3pin connector in series and pass through the 24v lines and use the control signal from my controller. This option does not require modifying the controller.
HTML Code:
jebao controller 3pin male =>  3pin female => 3pin male=>3pin female to pump
                                           ||
                                           \/
                                    to controller
or I could do away with the 3pin female side and just use a female DC jack to plug in the 24v power supply line.

I'm leaning towards option 2 with the DC jack. I can just unsolder the male connector from the controller and use that.


d0ughb0y is offline   Reply With Quote
Unread 10/29/2013, 01:26 PM   #92
wgraham
Registered Member
 
Join Date: Aug 2004
Posts: 292
Sound good, so with option 2 how would the arduino control the different functions


wgraham is offline   Reply With Quote
Unread 10/29/2013, 01:47 PM   #93
d0ughb0y
Registered Member
 
d0ughb0y's Avatar
 
Join Date: Mar 2008
Location: sf bay area
Posts: 5,165
Quote:
Originally Posted by wgraham View Post
Sound good, so with option 2 how would the arduino control the different functions
The "to controller" in the diagram connects to PWM pin on arduino controller.
Once I complete the code, it will include a web interface to modify settings like select mode, cycle length, and limit max, and to select sync or anti-sync for a pair. I know a lot of people need a way to limit the max output of the jebao pumps for use in smaller tanks.


d0ughb0y is offline   Reply With Quote
Unread 10/29/2013, 01:54 PM   #94
wgraham
Registered Member
 
Join Date: Aug 2004
Posts: 292
do we have to add a filter to make it analog


wgraham is offline   Reply With Quote
Unread 10/29/2013, 02:03 PM   #95
d0ughb0y
Registered Member
 
d0ughb0y's Avatar
 
Join Date: Mar 2008
Location: sf bay area
Posts: 5,165
Quote:
Originally Posted by wgraham View Post
do we have to add a filter to make it analog
I have not tested it.
I am currently using the arduino default 490hz pwm.
If that does not work, I can try to bump up the pwm frequency.
In theory, it should work. It should not be an issue to add the RC filter if needed.


d0ughb0y is offline   Reply With Quote
Unread 10/29/2013, 05:18 PM   #96
wgraham
Registered Member
 
Join Date: Aug 2004
Posts: 292
Is the Return outlet for the main return pump or it is for something else


wgraham is offline   Reply With Quote
Unread 10/29/2013, 05:28 PM   #97
djmx2002
Premium Member
 
djmx2002's Avatar
 
Join Date: Nov 2006
Posts: 355
this build just keeps on getting better i am also planning to use the jebao powerheads in my upcoming build, will most likely start it in the next few weeks.


djmx2002 is offline   Reply With Quote
Unread 10/29/2013, 08:32 PM   #98
d0ughb0y
Registered Member
 
d0ughb0y's Avatar
 
Join Date: Mar 2008
Location: sf bay area
Posts: 5,165
Quote:
Originally Posted by wgraham View Post
Is the Return outlet for the main return pump or it is for something else
main return. I only have one return pump.
The program is always on, so initial off time is 0 seconds, on time is 60*60*24 seconds, off time is 0 seconds, (on 24 hours a day).


d0ughb0y is offline   Reply With Quote
Unread 10/29/2013, 11:17 PM   #99
sdtimer
Registered Member
 
Join Date: Jul 2013
Posts: 12
Quote:
Originally Posted by d0ughb0y View Post
I don't think you can add that routine into ISR. The ISRs currently take about 100-200us time to execute. The LED functions contain a lot of floating point operations and will take a lot of time inside the ISR. Besides, you cannot call analogWrite inside an ISR, you have to write directly to timer registers. I can see a time based ramp up/ ramp down can work in ISR, but not a sunrise/sunset based function with a lot of floating point calculations.

What LED are you using? If I can get a unit to test and use, I can write a code for it.

It is possible to add ORP, Wifi etc. ORP and Conductivity/Salinity (specific gravity) probes are currently supported when using the htm with Neptune Apex controller. Arduino Wifi shield will be easier to convert. Using wifi like RN-XV wifly with serial interface will take a lot more work to convert. Do you have any low cost wifi module you plan to use?

Please email me regarding your plan with the controller.
The LED is own Diy, have 5 channel:
1, Cree white 7000-8300K 8pcs;
2, Cree blue 465-470nm 8 pcs;
2, PHILIPS deepblue 450-455nm 8 pcs;
3, Purple 415-420nm 4 pcs;
Purple 400-410nm 4 pcs;
4, Yellow 585-595nm 2pcs;
Green 515-530nm 4pcs;
Red 655-660nm 4pcs;
Per cnannel 1 Meanwell LDD-1000H. The power is Meanwell 360W 36V.
I am using arduino 2560 pin 2,3,9,11,12 Control PWM is OK.

And how much wp25&wp40 in USA.



Last edited by sdtimer; 10/29/2013 at 11:26 PM.
sdtimer is offline   Reply With Quote
Unread 10/29/2013, 11:29 PM   #100
MarquiseO
Moved On
 
Join Date: Oct 2013
Posts: 53
Nice DIY controller!


MarquiseO is offline   Reply With Quote
Reply

Thread Tools

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 On



All times are GMT -6. The time now is 11:30 AM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Powered by Searchlight © 2024 Axivo Inc.
Use of this web site is subject to the terms and conditions described in the user agreement.
Reef CentralTM Reef Central, LLC. Copyright ©1999-2022
User Alert System provided by Advanced User Tagging v3.3.0 (Pro) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.