Page 13 of 14
Re: JEBO WP-40
Posted: Mon Jun 17, 2013 8:02 pm
by bhazard
daniella3d wrote:HI everyone, I just installed the jebao cable and uploaded the code but the short pulse mode does not work, wondering why?
I can hear the pump go into cycle but it seem to be going at 100% but never really stop, just slow down. What am I doing wrong? With the jebao controller the W1 mode, short pulse, the pump goes to 100%, then completele stop, then 100% then stop. You can actually see the propeller stops. With the RA it never really stop??
the code I am using:
ReefAngel.PWM.SetDaylight( ShortPulseMode(0,100,500,true) ); // Short pulse at 60% with 200ms pulse on sync mode
I didn't like short pulse. It doesn't make a wave like W1.
This piece of code makes a wave like W1 between two pumps.
ReefAngel.PWM.SetDaylight(millis()%1200>800?80:0);
ReefAngel.PWM.SetActinic(millis()%1200<400?0:80);
Re: JEBO WP-40
Posted: Mon Jun 17, 2013 8:07 pm
by lnevo
A lot of the timings are going to be unique for each tank dimension and what speed the pumps are run at.
Your function is pretty good though, we should make it a submitted function...
How about BioHazardMode()

Re: JEBO WP-40
Posted: Tue Jun 18, 2013 6:47 am
by bhazard
lnevo wrote:A lot of the timings are going to be unique for each tank dimension and what speed the pumps are run at.
Your function is pretty good though, we should make it a submitted function...
How about BioHazardMode()

Haha I like that. I can't take full credit though. Kenargo (
http://www.kenargo.com/apexProgram/index.php) provided the initial timings when I tried it for the Apex. 7/4 and 8/4 make the best waves on a lot of tanks. Those two make the best wave on mine.
Oh, and on an unrelated note, those Sosci Led lights have PWM drivers..........
Re: JEBO WP-40
Posted: Tue Jun 18, 2013 6:57 am
by daniella3d
I only have one pump though. Problem is that the short pulse mode does not go to 0, so there really is no wave or bearely any, no matter what value I use.
Also the custom code is not random enough, at least no like the Else mode. I listen to the pump with the Jebao controller in Else mode and it's really random. It does these speeds at about 1 second duration:
10, 15, 20, 60, 100, 30, 100, 20, 15, 10, 5, 80, 60.
It goes up slowly, then down quickly, then up, then down slowly, then anything pretty much random. with the custom RA code all it does is going to 0, then something random around 40%, then it goes to the maximum speed, then again, 0, like this:
0, 37, 80, 0, 40, 80, 0, 23, 80, 0, 26, 80, 0, 37, 80. So the only randomness is in the middle value. Is it possible to have something that does what the else mode do?
Re: JEBO WP-40
Posted: Tue Jun 18, 2013 7:11 am
by bhazard
daniella3d wrote:I only have one pump though. Problem is that the short pulse mode does not go to 0, so there really is no wave or bearely any, no matter what value I use.
Also the custom code is not random enough, at least no like the Else mode. I listen to the pump with the Jebao controller in Else mode and it's really random. It does these speeds at about 1 second duration:
10, 15, 20, 60, 100, 30, 100, 20, 15, 10, 5, 80, 60.
It goes up slowly, then down quickly, then up, then down slowly, then anything pretty much random. with the custom RA code all it does is going to 0, then something random around 40%, then it goes to the maximum speed, then again, 0, like this:
0, 37, 80, 0, 40, 80, 0, 23, 80, 0, 26, 80, 0, 37, 80. So the only randomness is in the middle value. Is it possible to have something that does what the else mode do?
For just one pump, use one line, like this:
ReefAngel.PWM.SetDaylight(millis()%1200>800?80:0);
The 80 value is the intensity on. You can change it up to 100. The 0 stops the pump, just like W1.
As far as the randomness of ELSE mode, I'm sure we'll all eventually figure it out to get it close. There was no W1 like code as of a few weeks ago, and with a group effort, now there is. The support from the guys here at Reef Angel, along with the potential of the RA itself is just awesome.
Re: JEBO WP-40
Posted: Tue Jun 18, 2013 7:16 am
by cosmith71
Else mode isn't really random. It's a long, complex repeating pattern. My WP40 was very loud for a time and I could almost hum along with it.
--Colin
Re: JEBO WP-40
Posted: Tue Jun 18, 2013 7:23 am
by daniella3d
Ok tanks!
Looking forward to that else mode. I wish I could contribute something but I am just learning what the code is doing, nevermind trying to compose something, I know zero in programmation.
The else mode seem pretty random and with very short pulse at least on the wp25 controller. The pulse seem to be even less than a second each. I am sure someone will figure it out, it's just a matter of time.
bhazard wrote:daniella3d wrote:For just one pump, use one line, like this:
ReefAngel.PWM.SetDaylight(millis()%1200>800?80:0);
The 80 value is the intensity on. You can change it up to 100. The 0 stops the pump, just like W1.
As far as the randomness of ELSE mode, I'm sure we'll all eventually figure it out to get it close. There was no W1 like code as of a few weeks ago, and with a group effort, now there is. The support from the guys here at Reef Angel, along with the potential of the RA itself is just awesome.
Re: JEBO WP-40
Posted: Tue Jun 18, 2013 10:29 am
by bhazard
daniella3d wrote:Ok tanks!
Looking forward to that else mode. I wish I could contribute something but I am just learning what the code is doing, nevermind trying to compose something, I know zero in programmation.
The else mode seem pretty random and with very short pulse at least on the wp25 controller. The pulse seem to be even less than a second each. I am sure someone will figure it out, it's just a matter of time.
bhazard wrote:daniella3d wrote:For just one pump, use one line, like this:
ReefAngel.PWM.SetDaylight(millis()%1200>800?80:0);
The 80 value is the intensity on. You can change it up to 100. The 0 stops the pump, just like W1.
As far as the randomness of ELSE mode, I'm sure we'll all eventually figure it out to get it close. There was no W1 like code as of a few weeks ago, and with a group effort, now there is. The support from the guys here at Reef Angel, along with the potential of the RA itself is just awesome.
I have absolutely no idea how to code either, but I am starting to understand where/what to modify in code that I can copy/paste. If people weren't as helpful as they are, most of us would be lost. You'll start picking up on things more and more.
Re: JEBO WP-40
Posted: Tue Jun 18, 2013 10:48 am
by Sacohen
I have absolutely no idea how to code either, but I am starting to understand where/what to modify in code that I can copy/paste. If people weren't as helpful as they are, most of us would be lost. You'll start picking up on things more and more.
I'm the same way. I have no idea how to code, but I can look someone else's code and kind of figure out what is going on and what I would need to change to make it fit my needs.
You'll pick it up.
Re: JEBO WP-40
Posted: Tue Jun 18, 2013 4:50 pm
by bhazard
Looks like its new library time, with DC pumps included in the portal! Great job.
We'll need to modify code I guess. How should we reference the pumps to enable the modes to be changed through the portal?
Do they stay like this?:
ReefAngel.PWM.SetDaylight( ReefCrestMode(60,20,true) ); // ReefCrest at 60% +/- 20% on sync mode
ReefAngel.PWM.SetActinic( ReefCrestMode(60,20,false) ); // ReefCrest at 60% +/- 20% on anti-sync mode
Re: JEBO WP-40
Posted: Tue Jun 18, 2013 5:05 pm
by lnevo
I don't think you'll have to worry about any of that anymore.
I would try a run through with the wizard to see what it will look like.
Re: JEBO WP-40
Posted: Tue Jun 18, 2013 9:12 pm
by bhazard
Yep. DC Pump control section in the wizard. Writes new library code in the loop such as:
ReefAngel.DCPump.UseMemory = true;
ReefAngel.DCPump.DaylightChannel = Sync;
ReefAngel.DCPump.ActinicChannel = AntiSync;
Cool. Now for custom modes....... that's still a question mark.
Re: JEBO WP-40
Posted: Wed Jun 19, 2013 4:55 am
by lnevo
Roberto needs to add custom to the drop down like he did for RF... And you'd just do...
if (ReefAngel.DCPump.Mode==Custom) {
ReefAngel.DCPump.UseMemory=False;
ReefAngel.PWM.SetDaylight(.....);
}
You could retrieve the Duration and Speed from the DCPump class to use in your SetDaylight or custom function by using ReefAngel.DCPump.Speed and ReefAngel,DCPump.Duration
Re: JEBO WP-40
Posted: Wed Jun 19, 2013 5:39 pm
by oscarinw
daniella3d wrote:Ok tanks!
Looking forward to that else mode. I wish I could contribute something but I am just learning what the code is doing, nevermind trying to compose something, I know zero in programmation.
The else mode seem pretty random and with very short pulse at least on the wp25 controller. The pulse seem to be even less than a second each. I am sure someone will figure it out, it's just a matter of time.
Hey you may want to take a look at what I did... i used the ReefCrestMode and made its time intervals random between 5 and 15 seconds and then at random power between the set values on a parabola for stronger during the day and slower at night...
http://forum.reefangel.com/viewtopic.php?p=28423#p28423
I like it so far...
BTW, not really me but 'lnevo' did all the logic behind it. I also don't know any programming...
Re: JEBO WP-40
Posted: Thu Jun 20, 2013 8:52 am
by Smotz
lnevo wrote:Roberto needs to add custom to the drop down like he did for RF... And you'd just do...
if (ReefAngel.DCPump.Mode==Custom) {
ReefAngel.DCPump.UseMemory=False;
ReefAngel.PWM.SetDaylight(.....);
}
You could retrieve the Duration and Speed from the DCPump class to use in your SetDaylight or custom function by using ReefAngel.DCPump.Speed and ReefAngel,DCPump.Duration
Is this in place?
Re: JEBO WP-40
Posted: Thu Jun 20, 2013 9:07 am
by rimai
Yes, I just added custom to the list
Sent from my SPH-L710 using Tapatalk 4 Beta
Re: JEBO WP-40
Posted: Thu Jun 20, 2013 9:09 am
by lnevo
Awesome. That will make things easier.
Re: JEBO WP-40
Posted: Thu Jun 20, 2013 9:22 am
by Smotz
You guys rock.
Looks like I will be making some changes.
Re: JEBO WP-40
Posted: Thu Jun 20, 2013 9:24 am
by Smotz
if (ReefAngel.DCPump.Mode==Custom) {
ReefAngel.DCPump.UseMemory=False;
ReefAngel.PWM.SetDaylight(.....);
}
Questions about the above code -
If I use
if (ReefAngel.DCPump.Mode==Custom) {
ReefAngel.DCPump.UseMemory=False;
Then it will use my internal code for my pump settings.
Will it still read the portal to see if I change the custom to a standard wave mode?
Also,
How would I display my wave pattern selection (from the portal) on my LCD ?
I would like to do something like this:
sprintf(buf,ReefAngel.DCPump.Mode);
ReefAngel.LCD.DrawText(0,255,x,y,buf);
Re: JEBO WP-40
Posted: Thu Jun 20, 2013 9:52 am
by lnevo
Your sprintf is wrong and I dont think you need to set the usememory to false or at least you should add an else and set usememory=true;.
It will only do whats in your if statement when the mode is custom. So anything else will revert to that mode. As long as usememory = true;
Re: JEBO WP-40
Posted: Thu Jun 20, 2013 10:00 am
by Smotz
lnevo wrote:Your sprintf is wrong and I dont think you need to set the usememory to false or at least you should add an else and set usememory=true;.
It will only do whats in your if statement when the mode is custom. So anything else will revert to that mode. As long as usememory = true;
Gotcha - here's my code. (sorry to threadcap by the way)
I have the usememory=true further up in the code
this is what I want to get to work:
Code: Select all
if (ReefAngel.DCPump.Mode==Custom) sprintf(buf,"RC %d% +/-%d%",wpWavStr,wpWavOff);
else sprintf(buf,ReefAngel.DCPump.Mode);
<---I know this is incorrect - I need the correct syntax
Code: Select all
//// Port 1 Heater
//// Port 2 ATO pump
//// Port 3 Reactor Pump
//// Port 4 Protien Skimmer
//// Port 5 Return Pump
//// Port 6 Wavemaker
//// Port 7 UV Sterilizer
//// Port 8 Fuge Light
//// Always on - Lights & Salinity Module
#include <ReefAngel_Features.h>
#include <Globals.h>
#include <RA_Wifi.h>
#include <Wire.h>
#include <OneWire.h>
#include <Time.h>
#include <DS1307RTC.h>
#include <InternalEEPROM.h>
#include <RA_NokiaLCD.h>
#include <RA_ATO.h>
#include <RA_Joystick.h>
#include <LED.h>
#include <RA_TempSensor.h>
#include <Relay.h>
#include <RA_PWM.h>
#include <Timer.h>
#include <Memory.h>
#include <InternalEEPROM.h>
#include <RA_Colors.h>
#include <RA_CustomColors.h>
#include <Salinity.h>
#include <RF.h>
#include <IO.h>
#include <ORP.h>
#include <AI.h>
#include <PH.h>
#include <WaterLevel.h>
#include <DCPump.h>
#include <ReefAngel.h>
////// Place global variable code below here
#define Heater Port1
#define Topoff Port2
#define Reactor Port3
#define Skimmer Port4
#define Return Port5
#define Wave Port6
#define UVlight Port7
#define Fugelight Port8
#define FugelightBit 1<<7
#define UVlightBit 1<<6
#define WaveBit 1<<5
#define ReturnBit 1<<4
#define SkimmerBit 1<<3
#define ReactorBit 1<<2
#define TopoffBit 1<<1
#define HeaterBit 1<<0
static byte wpMode;
static byte wpWavStr;
static byte wpWavOff;
////// Place global variable code above here
void setup()
{
// This must be the first line
ReefAngel.Init(); //Initialize controller
// Ports toggled in Feeding Mode
ReefAngel.FeedingModePorts = TopoffBit | ReactorBit | SkimmerBit | ReturnBit | UVlightBit;
// Ports toggled in Water Change Mode
ReefAngel.WaterChangePorts = HeaterBit | TopoffBit | ReactorBit | SkimmerBit | ReturnBit | WaveBit | UVlightBit;
// Ports toggled when Lights On / Off menu entry selected
ReefAngel.LightsOnPorts = FugelightBit;
// Ports turned off when Overheat temperature exceeded
ReefAngel.OverheatShutoffPorts = HeaterBit | TopoffBit | ReactorBit | SkimmerBit | ReturnBit | WaveBit | UVlightBit;
// Use T1 (SUMP) probe as temperature and overheat functions
ReefAngel.TempProbe = T1_PROBE;
ReefAngel.OverheatProbe = T1_PROBE;
// Ports that are always on
ReefAngel.Relay.On( Return );
ReefAngel.Relay.On( Reactor );
ReefAngel.Relay.On( Wave );
////// Place additional initialization code below here
////// Place additional initialization code above here
}
void loop()
{
ReefAngel.StandardHeater( Heater );
ReefAngel.StandardATO( Topoff );
ReefAngel.MoonLights( Fugelight );
////// Place your custom code below here
ReefAngel.LCD.DrawText(0,255,20,80,"Joe's Reef Tank");
ReefAngel.Relay.DelayedOn(Skimmer,2);
ReefAngel.Relay.DelayedOn(UVlight,1);
ReefAngel.DCPump.FeedingSpeed=30;
ReefAngel.DCPump.WaterChangeSpeed=0;
ReefAngel.DCPump.UseMemory = true;
ReefAngel.DCPump.DaylightChannel = AntiSync;
ReefAngel.DCPump.ActinicChannel = AntiSync;
ReefAngel.PWM.SetActinic(100);
// Set Wave Str
if (wpMode=1) wpWavStr=45;
if (wpMode=2) wpWavStr=50;
if (wpMode=3) wpWavStr=55;
//Set the Wave OffSet
wpWavOff=15;
// set the wpMode
if ( (hour() >= 5) && (hour() < 8) ) wpMode=1; // from 5am - 8am
if ( (hour() >= 8) && (hour() < 11) ) wpMode=2; // from 8am - 11am
if ( (hour() >= 11) && (hour() < 14) ) wpMode=3; // from 11a - 2pm
if ( (hour() >= 14) && (hour() < 17) ) wpMode=2; // from 2pm - 5pm
if ( (hour() >= 17) && (hour() < 20) ) wpMode=1; // from 5pm - 8pm
if ( (hour() >= 20) && (hour() < 23) ) wpMode=2; // from 8pm - 11p
if ( (hour() >= 23) && (hour() < 2) ) wpMode=3; // from 11pm - 2am
if ( (hour() >= 2) && (hour() < 5) ) wpMode=2; // from 2am - 5am
// if the portal is set to a custom wave speed
if (ReefAngel.DCPump.Mode==Custom) {
ReefAngel.DCPump.UseMemory=false;
ReefAngel.PWM.SetDaylight( ReefCrestMode(wpWavStr,wpWavOff,false) );
}
// Only turn on UV Sterilizer between 11pm and 5am
if ( (hour() >= 5) && (hour() < 23) ) // from 5a - 11p
ReefAngel.Relay.Off(UVlight);
else ReefAngel.Relay.On(UVlight);
////// Place your custom code above here
// This should always be the last line
ReefAngel.Portal( "Smotz" );
ReefAngel.ShowInterface();
}
void DrawCustomMain()
{
int x,y;
char text[10];
char buf[16];
if (ReefAngel.DCPump.Mode==Custom) sprintf(buf,"RC %d% +/-%d%",wpWavStr,wpWavOff);
else sprintf(buf,ReefAngel.DCPump.Mode);
x = 15;
y = 52;
//ReefAngel.LCD.DrawText(0,255,x,y,"RF:");
//ReefAngel.LCD.Clear(DefaultBGColor,x,y,128-x,y+8);
ReefAngel.LCD.DrawText(0,255,x,y,buf);
// Parameters
#if defined DisplayLEDPWM && ! defined RemoveAllLights
ReefAngel.LCD.DrawMonitor( 15, 20, ReefAngel.Params,
ReefAngel.PWM.GetDaylightValue(), ReefAngel.PWM.GetActinicValue() );
#else // defined DisplayLEDPWM && ! defined RemoveAllLights
ReefAngel.LCD.DrawMonitor( 15, 20, ReefAngel.Params );
#endif // defined DisplayLEDPWM && ! defined RemoveAllLights
pingSerial();
// Salinity
ReefAngel.LCD.DrawText( COLOR_DARKKHAKI,DefaultBGColor,15,66, "SAL:" );
ReefAngel.LCD.DrawText( COLOR_DARKKHAKI,DefaultBGColor,39,66, ReefAngel.Params.Salinity );
pingSerial();
// Main Relay Box
byte TempRelay = ReefAngel.Relay.RelayData;
TempRelay &= ReefAngel.Relay.RelayMaskOff;
TempRelay |= ReefAngel.Relay.RelayMaskOn;
ReefAngel.LCD.DrawOutletBox( 12, 93, TempRelay );
pingSerial();
// Date and Time
ReefAngel.LCD.DrawDate( 6, 122 );
pingSerial();
}
void DrawCustomGraph()
{
}
Re: JEBO WP-40
Posted: Thu Jun 20, 2013 10:49 am
by lnevo
sprintf (buf,"%d", ReefAngel.DCPump.Mode);
I don't see how your wpMode time settings are going to work. The DCPump is set to UseMemory and it will get the mode from the memory location. You'll need to use ReefAngel.DCPump.SetMode manually and disable UseMemory or its going to stay in the memory set mode.
Re: JEBO WP-40
Posted: Thu Jun 20, 2013 10:55 am
by Smotz
lnevo wrote:sprintf (buf,"%d", ReefAngel.DCPump.Mode);
I don't see how your wpMode time settings are going to work. The DCPump is set to UseMemory and it will get the mode from the memory location. You'll need to use ReefAngel.DCPump.SetMode manually and disable UseMemory or its going to stay in the memory set mode.
So my code would be this: ??
if (ReefAngel.DCPump.Mode==Custom) {
ReefAngel.DCPump.UseMemory=false;
ReefAngel.DCPump.SetMode( ReefCrest,wpWavStr,wpWavOff );
}
How do I specify which channel - Daylight vs. Actinic ?
Re: JEBO WP-40
Posted: Thu Jun 20, 2013 11:05 am
by lnevo
Yes. Exactly. The channels are defined here:
ReefAngel.DCPump.DaylightChannel = AntiSync;
ReefAngel.DCPump.ActinicChannel = AntiSync;
By, the way, is this what you want to do though? I think this will be ignored later on because the ReefAngel class will overwrite the speed for that port..
ReefAngel.PWM.SetActinic(100);
Re: JEBO WP-40
Posted: Thu Jun 20, 2013 11:12 am
by Smotz
lnevo wrote:Yes. Exactly. The channels are defined here:
ReefAngel.DCPump.DaylightChannel = AntiSync;
ReefAngel.DCPump.ActinicChannel = AntiSync;
By, the way, is this what you want to do though? I think this will be ignored later on because the ReefAngel class will overwrite the speed for that port..
ReefAngel.PWM.SetActinic(100);
I am / was unclear how the two classes worked with each other. I don't really use the Actinic channel except for troubleshooting. I would like to leave that on a constant speed. What do you recommend - just leave out the ReefAngel.DCPump.ActinicChannel = AntiSync; ?
Re: JEBO WP-40
Posted: Thu Jun 20, 2013 11:17 am
by lnevo
If you set it to None it won't be considered a DCPump and you can set it to whatever you need.
If you set it to Sync or AntiSync then it will get driven by the DCPump code...
The default is None so you can just remove the line. Also if you only have one Pump then i would set it to Sync not Anti.
Re: JEBO WP-40
Posted: Thu Jun 20, 2013 11:22 am
by Smotz
lnevo wrote:If you set it to None it won't be considered a DCPump and you can set it to whatever you need.
If you set it to Sync or AntiSync then it will get driven by the DCPump code...
The default is None so you can just remove the line. Also if you only have one Pump then i would set it to Sync not Anti.
Thanks dude. I've made those changes.
Re: JEBO WP-40
Posted: Thu Jun 20, 2013 7:23 pm
by daniella3d
cool, I will try it, thanks a lot!
oscarinw wrote:daniella3d wrote:
Hey you may want to take a look at what I did... i used the ReefCrestMode and made its time intervals random between 5 and 15 seconds and then at random power between the set values on a parabola for stronger during the day and slower at night...
http://forum.reefangel.com/viewtopic.php?p=28423#p28423
I like it so far...
BTW, not really me but 'lnevo' did all the logic behind it. I also don't know any programming...
Re: JEBO WP-40
Posted: Fri Jun 21, 2013 8:20 am
by bhazard
A few questions.
Now with "custom" in the DC Pump menu, how is this implemented in the code? How would my W1 like code be added for example?
Is it able to use my time based code I already have that switches between modes at different times of the day?
Re: JEBO WP-40
Posted: Fri Jun 21, 2013 8:31 am
by rimai
For the custom mode:
Code: Select all
if (ReefAngel.DCPump.Mode==Custom)
{
// Place your own custom mode here
}
If you want it to be time based, you won't be able to use the portal. You can only set one mode in the Portal.
This is what I do for my tank:
I set the Portal to Long Pulse, which is the mode my pumps stay on most of the time.
Then, between 3 and 5pm, I override the Portal settings with short pulse. At this time, any change I make in the portal mode settings are not effective until 5pm.
Then it goes back to portal settings after 5pm.
At 10pm, it switches to Reefcrest until 7am. At this period, any portal changes are not effective.
So, as you can see, you can only change modes using the portal if you are not overriding them within your code.