|
10/11/2013, 03:02 PM | #51 |
Registered Member
Join Date: Aug 2004
Posts: 292
|
Yes that what I want to do I have a 300 gallon tank and just got the new jebao wp-60 in yesterday and have the wp-40 since Feb. I change the names in the config.h in it still but the koralia in the web page. I will try again when I get home. I also got 2 atlas ph boards in, and going to add one more ph to the code.
Thanks for your help |
10/11/2013, 09:16 PM | #52 |
Registered Member
Join Date: Mar 2008
Location: sf bay area
Posts: 5,165
|
I'll try to add a write up on how to modify the outlet program.
For temp probe code, the current code is optimized for one slave in the onewire bus. I use the ds.skip call (i.e., there can only be one temp probe). OneWire code is extremely slow, so adding a second temp probe, you have to split up the updating of temp readings to multiple loop cycles so it does not consume too much time per loop cycle. There is a trick to broadcast the convert command to all temp probes on the onewire bus, so you do not need to send the address of each probe and then send the convert command, Then just read the temp values of each probe in the succeeding loop cycle. For the ph probe, you will need to make use of Serial2 for the second ph probe. The ph code is more straightforward to expand to support a second probe. I configured the main loop to execute at 60hz or 60x per second, this means for each cycle, I have 16ms to complete all tasks. The current code takes only 1ms to complete all tasks in a loop cycle, so there is plenty of cpu cycles left for adding additional probes. Try to keep the normal loop cycle execution time under 3ms and everything should be fine. If the code is optimized properly, the 16mhz atmega has more than sufficient cpu power so there is absolutely no need to use an ARM 32bit cpu. For the jebao, you can get by not using a controlled outlet, and just plug the jebao to your regular always ON outlet, and just use the pwm to control the on/off of the powerhead. always test each component type (temp probes, ph, etc) individually to make sure the hardware and software works before merging in to the main code. it will be easier to troubleshoot any issues later. |
10/13/2013, 10:21 PM | #53 |
Registered Member
Join Date: Mar 2008
Location: sf bay area
Posts: 5,165
|
ok, I just updated my program to enable the heater since its starting to get cold.
When you change the program in config.h, make sure to change the EEPROMSIG value to something else, it can be any value as long as it is different from the current value in your mega. To change the program, you need to first define the "String" description of the devices in the exact order you are plugging to each outlet in #define OUTLET1 ... OUTLETn, the enter the same outlet names in #define OUTLETDEFS without the quotes. Next the actual program goes into #define OUTLETSDEFAULT one line for each outlet. There are 3 types of program, outlets that are always on outlets that are controlled by sensors outlets that run on timed schedule you specify 3 time values in seconds per outlet, initial off time, on time, off time for always on, enter 0, SECS_PER_DAY,0 this means the outlet is on 86400 seconds. for outlets controlled by sensor (like temp, ph or ATO), enter 0,0,0 for outlets on timed schedule, figure a cycle time for the schedule, that divides equally into 24 hours, say repeat a sequence every half hour. Then in that half hour, enter the number of seconds for initial off time, on time, then off time. The total number of seconds must equal half hour. That's it. enter the active days (0xff for every day), and the mode (usually _auto) active day value is bit mapped. sun - bit 0, mon - bit 1, tue - bit 2, etc. |
10/13/2013, 11:32 PM | #54 |
Registered Member
Join Date: Jul 2013
Posts: 12
|
I want use WIFI module, the WIFI module I was test other program is OK.
Where code can i change? Thank you |
10/14/2013, 08:15 AM | #55 |
Registered Member
Join Date: Aug 2004
Posts: 292
|
do you change the #define MAXOUTLETS 8 to 16 or leave it at 8. So I would use outlet9 and call it heater or use one of the outlets that you have available.
Thanks |
10/14/2013, 08:24 AM | #56 |
Registered Member
Join Date: Aug 2004
Posts: 292
|
also do you uncomment #define_HEATER
|
10/15/2013, 08:39 PM | #57 | |
Registered Member
Join Date: Mar 2008
Location: sf bay area
Posts: 5,165
|
Quote:
|
|
10/15/2013, 08:43 PM | #58 | |
Registered Member
Join Date: Mar 2008
Location: sf bay area
Posts: 5,165
|
Quote:
set MAXOUTLETS 16 if you are connecting to two 8 channel relays (or chauvets). The Heater outlet can be assigned to any outlet number that is available. There is already code in Sensors.ino to turn Heater on or off, you just need to change the default temperature value to your preference. The high/low temperature to control heater (and fan) can be changed in the mobile app. |
|
10/24/2013, 10:38 PM | #59 |
Registered Member
Join Date: Mar 2008
Location: sf bay area
Posts: 5,165
|
just updated the source on github with a fix to a bug in buzzer and PWM code. I had to move the buzzer from using timer3 to timer4 so it does not conflict with digital pins 2 and 3 PWM. I currently don't use the 10v PWM.
I just ordered a jebao wp-25. It is on sale now on ebay. I plan to make the connection from the wp-25 controller pwm to arduino analog in, and then an arduino pwm out goes to the wp-25. This way, I can just pass through the pwm signal from the wp-25 controller to the pump, but can override the pwm signal if needed. The initial implementation will just be on/off so I can turn it off during feed mode. I'll see how well the stock wp-25 controller works to determine if I need to write my own pwm routine to control the wp-25. |
10/25/2013, 03:13 AM | #60 |
Registered Member
Join Date: Jul 2013
Posts: 12
|
Where can i change timerzone to china?
|
10/25/2013, 03:16 AM | #61 |
Registered Member
Join Date: Jul 2013
Posts: 12
|
And not need "Daylight Saving Time". I found "#define STDTZOFFSET +8" on Config.h. But the time is daylight time.
|
10/25/2013, 10:39 AM | #62 |
Registered Member
Join Date: Mar 2008
Location: sf bay area
Posts: 5,165
|
That is correct.
#define STDTZOFFSET -8L is my local (Pacific Time in California) timezone, Standard Time. If your standard time offset is +8, just use #define STDTZOFFSET 8 The current code has calculation for daylight savings time switch, which will occur next in US on November 3. I will update the code later with a new #define AUTODST so you can comment that out if your location does not use daylight savings time. check github later for my update. |
10/25/2013, 06:29 PM | #63 |
Registered Member
Join Date: Mar 2008
Location: sf bay area
Posts: 5,165
|
sdtimer, I have committed the changes to github.
just define STDTZOFFSET 8 for your local timezone and comment the define for AUTODST in config.h since your location does not use DST. |
10/25/2013, 07:52 PM | #64 |
Registered Member
Join Date: Jul 2013
Posts: 12
|
Thank you.
|
10/25/2013, 10:55 PM | #65 |
Registered Member
Join Date: Jul 2013
Posts: 12
|
I was download new code. It is OK. Thank you very much!
And I have other questiuons 1. I want change outlets schedule to 'start timer&end time'. Not now, I don't know 'INIT OFF & ON & OFF'. Can we use the really time. We have RTC! 2. I found the sunrise&sunset code in this forums, maybe can insert to program. PHP Code:
|
10/26/2013, 06:15 PM | #66 |
Registered Member
Join Date: Mar 2008
Location: sf bay area
Posts: 5,165
|
The outlet program is for programming the outlets only, the PWM is controlled separately.
The code you posted is for PWM. I currently do not have code for PWM, since I originally planned to use the 2 PWM channel to control LEDs, but I have since bought a Maxspect Razor and I am just using the built in timer and do not need the PWM anymore. You can try to integrate that PWM code into my code. That code does not use timer interrupts and everything is executed in the main loop so you can simply add the routine to the main loop. My main loop code consumes only approximately 1ms, so you can add that code in no problem. If I have time, I can write the code for PWM scheduling. |
10/26/2013, 06:59 PM | #67 |
Registered Member
Join Date: Mar 2008
Location: sf bay area
Posts: 5,165
|
I just got the WP-25 I ordered. Delivered in 2 days.
I opened up the controller to check the circuit. The output control signal is a 3.9 khz pwm signal, 256us period. It controls the output in 8 steps, starting from 256us for 100% then decrements 16us for each step until it reaches 128us or 50% duty cycle. W2 and W3 are like sawtooth waveform, with W2 incrementing up in 6 steps and down 6 steps, while W3 increments in 6 steps and down in 8 steps from 50% to 100% and back down to 50%. The knob controls the frequency of the sawtooth wave. this shows the W1 mode low (or pump off), is 1us on to 255us off. at the lowest time setting (fully counter clockwise) in W1 mode, pump is off for 0.24seconds and on for 0.24seconds. The white block you see is actually comprised of tons of the 1us pulses shown above. The output pwm is passed through a resistor /capacitor to convert the pulses to an analog signal. I think it should be possible to read the control signal using the arduino analog read, and then for Pass-Thru, simply do a digital write to a PWM output pin. I'm not sure if feeding PWM to the pump will work, but it should be easy enough to add a resistor/capacitor to convert it to analog if needed. I can then program the controller to override the control signal. The modes on the stock controller seems to work fine. It does not go down below 50% though, except for W1 mode which pulses between 0% and 100%, but the maximum can be controlled via S1 S2 and S3. S1 is 100%, S2 is more like 80% and S3 is more like 60% (the documentation says its 100%, 75% and 50%). I can see the need to override the stock controller signal say if you got a WP-40 and find it too strong for your tank, as there is currently no way to lower the maximum flow. The S1 S2 S3 flow control only works with W1 mode. I don't think it is proper to be reducing the 24V power to reduce the pump flow as others are doing in the wp-40 thread. I can implement override to reduce flow to a user controllable value. I don't really see the need to re-invent the different modes that already works fine on the stock controller. I think one cool feature would be to plot in the pump flow level say for the last 3 minutes, which is simply the value of the analog read of the control signal. So far, I think the WP-25 is a very nice pump, and probably should be a standard issue for any reef tank. Last edited by d0ughb0y; 08/03/2017 at 11:25 PM. |
10/26/2013, 08:43 PM | #68 |
Head zoo keeper
Join Date: Nov 2005
Location: Toledo ,Ohio
Posts: 710
|
I have all my parts now to start making this I hope you find the time to add the pwm to the code for lighting would be nice to add that to the tank
|
10/26/2013, 09:04 PM | #69 | |
Registered Member
Join Date: Mar 2008
Location: sf bay area
Posts: 5,165
|
Quote:
You can revise the sunlight and moonlight functions to simply return result and do the analogWrite separately. You can greatlly simplify this by simply passing the full value (37.5 for white, 25 for blue, 30 for UV), and return the result then do analogWrite using the return value to the PWM pin. You can just use in the main loop(), just add call to int result = sunLight(37.5); analogWrite(pwmpin1, result); result = sunLight(25); analogWrite(pwmpin2, result); There are a lot of floating point operation inside the functions. I don't think you need to call it on every loop. You can call it once a minute. |
|
10/27/2013, 01:39 PM | #70 |
Registered Member
Join Date: Mar 2008
Location: sf bay area
Posts: 5,165
|
on second thought, I think I will implement the WP controller modes in my controller. I'm thinking it would be nice to be able to switch to different modes during the day, which currently cannot be done in the WP controller. Like for example, W1 in the morning, ELSE in the afternoon and H3 at night. The night mode in the controller simply switches to H3 when ambient light level is low.
I'll probably create predefined modes like that ones in the controller, plus a user defined mode. And all modes can have max flow and frequency, plus duty cycle control (the wp controller frequency control is fixed at 50% duty cycle). I'll create 2 channels, and can be operated in independent, sync or anti sync mode (both running exact same program, or the opposite program, i.e. when pump1 is on, pump2 is off) |
10/27/2013, 03:48 PM | #71 |
Registered Member
Join Date: Mar 2008
Location: sf bay area
Posts: 5,165
|
fixed a bug in index.htm.
I originally hard coded the outlet names. I fixed this so it gets the names from the controller. https://github.com/d0ughb0y/Chauvet16 |
10/27/2013, 04:35 PM | #72 |
Registered Member
Join Date: Aug 2004
Posts: 292
|
That would be great, I have two WP60 and two WP40 and would love to control them as you describe. Also when I added the heater to outlet 9 and change the max outlet to 16, I couldn't get the webpage to open until I went back to the 8 outlet max. Also the heater doesn't show up in the webpage.
|
10/27/2013, 05:23 PM | #73 |
Registered Member
Join Date: Mar 2008
Location: sf bay area
Posts: 5,165
|
ok, if you need to control 4 WP pumps, I will need to move buzzer connection from D5 to D6, so that will free up PWM on D5, D9, D11, D12. D2 and D3 are already used in the 10v PWM. That's all the PWM pins that can be used on the mega.
Get the update to index.htm, and see if it works. I have not tested on 16 outlets |
10/28/2013, 07:00 AM | #74 |
Registered Member
Join Date: Aug 2004
Posts: 292
|
If I change out the return to make it the heater will I cause any problem.
|
10/28/2013, 07:01 AM | #75 |
Registered Member
Join Date: Aug 2004
Posts: 292
|
I don't need to use any PWM's for lighting I have separate control for them.
|
|
|