Everything is reading 0.
- Sacohen
- Posts: 1833
- Joined: Sun Apr 21, 2013 6:25 am
- Location: Davie, FL
Everything is reading 0.
I had something similar happen last week.
I checked everything I did last week and still no good.
All 3 temp probes read 0, pH reads 0, Salinity reads 0, and Water Level reads 0.
The relays are working and tuning on and off, when programmed, but I'm getting no parameter readings.
This started when I noticed my water level was not changing at all. It stayed at 36% no mater what.
At this point all my parameters looked fine. I had 3 temps, pH and salinity of 34.9.
I could turn off the pumps and let water back siphon into the sump and it was still 36%.
I tried re-calibrating and it still read 36% even when I had the tube still in the tank to 100%.
I reloaded the Water Level test code and it now read 0.
I reloaded my code and at this point all my parameters showed 0.
I did a hard reboot (pulled the power to the RA).
No change.
Double checked that everything is plugged in properly and it is, but I have no parameter readings.
Please Help
I checked everything I did last week and still no good.
All 3 temp probes read 0, pH reads 0, Salinity reads 0, and Water Level reads 0.
The relays are working and tuning on and off, when programmed, but I'm getting no parameter readings.
This started when I noticed my water level was not changing at all. It stayed at 36% no mater what.
At this point all my parameters looked fine. I had 3 temps, pH and salinity of 34.9.
I could turn off the pumps and let water back siphon into the sump and it was still 36%.
I tried re-calibrating and it still read 36% even when I had the tube still in the tank to 100%.
I reloaded the Water Level test code and it now read 0.
I reloaded my code and at this point all my parameters showed 0.
I did a hard reboot (pulled the power to the RA).
No change.
Double checked that everything is plugged in properly and it is, but I have no parameter readings.
Please Help
-
rimai
- Posts: 12857
- Joined: Fri Mar 18, 2011 6:47 pm
- Sacohen
- Posts: 1833
- Joined: Sun Apr 21, 2013 6:25 am
- Location: Davie, FL
Re: Everything is reading 0.
No the pH is fine with no probes or other modules plugged in.
Once I saw that I started plugging things back in 1 by one.
First the Temp and then rebooted.
Everything was 0 again.
Unplugged the temp probes. and plugged in the expansion hub, which had the Salinity, DC power module and Water Level.
Rebooted.
Everything was fine with everything plugged in except the temp probes.
Tried each temp probe 1 by one with a reboot in between and got 0 anytime any temp probe was plugged in.
Right now all 3 temp probes are unplugged and everything is reading fine.
What do you think Roberto?
Once I saw that I started plugging things back in 1 by one.
First the Temp and then rebooted.
Everything was 0 again.
Unplugged the temp probes. and plugged in the expansion hub, which had the Salinity, DC power module and Water Level.
Rebooted.
Everything was fine with everything plugged in except the temp probes.
Tried each temp probe 1 by one with a reboot in between and got 0 anytime any temp probe was plugged in.
Right now all 3 temp probes are unplugged and everything is reading fine.
What do you think Roberto?
-
rimai
- Posts: 12857
- Joined: Fri Mar 18, 2011 6:47 pm
Re: Everything is reading 0.
Could be the probe that gone bad, but all 3 at the same time doesn't seem like it.
The only other thing I can think of is the controller itself.
Any water damage?
The only other thing I can think of is the controller itself.
Any water damage?
Roberto.
- Sacohen
- Posts: 1833
- Joined: Sun Apr 21, 2013 6:25 am
- Location: Davie, FL
Re: Everything is reading 0.
No. It all seems dry.
I'll try them again, 1 at a time, but it will have to be tomorrow.
I got to get up early in the morning and pick up my parents from a returning cruise.
Thanks.
I'll let you know what happens.
I'll try them again, 1 at a time, but it will have to be tomorrow.
I got to get up early in the morning and pick up my parents from a returning cruise.
Thanks.
I'll let you know what happens.
- Sacohen
- Posts: 1833
- Joined: Sun Apr 21, 2013 6:25 am
- Location: Davie, FL
Re: Everything is reading 0.
I tried all three probes on each Temp port with a hard reboot in between and still no Temp reading.
All the other reading have been fine since I unplugged the Temp probes.
I'm guessing it's the head unit since none of the probes are working on any of the ports.
All the other reading have been fine since I unplugged the Temp probes.
I'm guessing it's the head unit since none of the probes are working on any of the ports.
-
rimai
- Posts: 12857
- Joined: Fri Mar 18, 2011 6:47 pm
- Sacohen
- Posts: 1833
- Joined: Sun Apr 21, 2013 6:25 am
- Location: Davie, FL
Re: Everything is reading 0.
Roberto;
I swapped out the head unit with the new one i got today and everything is working fine.
Reading all 3 Temps, pH, Salinity and water level.
The only thing that does not seem right are my dimming ports on the Relay.
The Daylight and Actinic, which are controlling my 2 Jebao pumps they have been at 20% since I re-loaded the code.
After testing somethings I noticed that it stays at whatever the last setting in the code was.
For example if I choose water change from the menu or the andriod app, it is set to 0%, when I exit the water change mode it stays at 0%. If I choose Feeding Mode it goes to 20% (as it should) and stays at 205 when I either exit feeding mode or it reaches the end of the feeding.
I looked at my code and noticed that there was a set of lines duplicated.
So I removed the repeated code and re-loaded it.
After doing that everything is reading 0 again.
After several minutes the pH, Salinity, and Water Level start showing again, but the temps are still out.
Also my portal is showing everything possible,even though I don't have it.
All 8 relays, a PWM Expansion Module, the RF Expansion Module, the Aqua Illumination, the I/O Expansion Water Level (that I do have, but it is reading 0% when my phone reads 40% and the custom fields.
I swapped out the head unit with the new one i got today and everything is working fine.
Reading all 3 Temps, pH, Salinity and water level.
The only thing that does not seem right are my dimming ports on the Relay.
The Daylight and Actinic, which are controlling my 2 Jebao pumps they have been at 20% since I re-loaded the code.
After testing somethings I noticed that it stays at whatever the last setting in the code was.
For example if I choose water change from the menu or the andriod app, it is set to 0%, when I exit the water change mode it stays at 0%. If I choose Feeding Mode it goes to 20% (as it should) and stays at 205 when I either exit feeding mode or it reaches the end of the feeding.
I looked at my code and noticed that there was a set of lines duplicated.
Code: Select all
if( ReefAngel.DisplayedMenu==FEEDING_MODE ) ReefAngel.PWM.SetActinic(20);
if( ReefAngel.DisplayedMenu==WATERCHANGE_MODE ) ReefAngel.PWM.SetActinic(0);
if (hour()<12 || hour()>=22) ReefAngel.PWM.SetActinic(30);
if( ReefAngel.DisplayedMenu==FEEDING_MODE ) ReefAngel.PWM.SetActinic(20);
if( ReefAngel.DisplayedMenu==WATERCHANGE_MODE ) ReefAngel.PWM.SetActinic(0);
if (hour()<12 || hour()>=22) ReefAngel.PWM.SetActinic(30);After doing that everything is reading 0 again.
After several minutes the pH, Salinity, and Water Level start showing again, but the temps are still out.
Also my portal is showing everything possible,even though I don't have it.
All 8 relays, a PWM Expansion Module, the RF Expansion Module, the Aqua Illumination, the I/O Expansion Water Level (that I do have, but it is reading 0% when my phone reads 40% and the custom fields.
-
rimai
- Posts: 12857
- Joined: Fri Mar 18, 2011 6:47 pm
Re: Everything is reading 0.
Your pumps are staying at the last mode because there is nothing else for them to do.
If they are not in feeding and not in wc mode, you have nothing to set them to anything else.
For the readings, you got something else in there causing it to fail.
If they are not in feeding and not in wc mode, you have nothing to set them to anything else.
For the readings, you got something else in there causing it to fail.
Roberto.
- Sacohen
- Posts: 1833
- Joined: Sun Apr 21, 2013 6:25 am
- Location: Davie, FL
Re: Everything is reading 0.
The pumps when not in feed or water change mode are supposed to be running cosmith's Else mode
See attached code....
Why is the Portal showing possible add on and module all of a sudden?
I did not send out the old head unit, I want to put is back in tonight and see if I at least go back to the way things were before I switched them out yesterday.
Thanks;
See attached code....
Code: Select all
#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 <Humidity.h>
#include <DCPump.h>
#include <ReefAngel.h>
// Define Relay Ports by Name
#define Actinic_Lights 1
#define Day_Lights 2
#define Unused 3
#define Pumps 4
#define Sump_Fan 5
#define DeNit_Pump 6
#define DeNit_Doser 7
#define Unused 8
#define ATO_Pump Box1_Port1
#define Moon_Lights Box1_Port2
#define Unused Box1_Port3
#define Unused Box1_Port4
#define Unused Box1_Port5
#define Unused Box1_Port6
#define Unused Box1_Port7
#define Unused Box1_Port8
////// Place global variable code below here
unsigned long ATOUpdate=0;
////// 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 = 0;
// Ports toggled in Water Change Mode
ReefAngel.WaterChangePorts = Port4Bit;
ReefAngel.WaterChangePortsE[0] = Port1Bit;
// Ports toggled when Lights On / Off menu entry selected
ReefAngel.LightsOnPorts = Port1Bit | Port2Bit;
// Ports turned off when Overheat temperature exceeded
ReefAngel.OverheatShutoffPorts = Port1Bit | Port2Bit;
// Use T2 probe as temperature and overheat functions
ReefAngel.TempProbe = T1_PROBE;
ReefAngel.OverheatProbe = T1_PROBE;
// Set the Overheat temperature setting
InternalMemory.OverheatTemp_write( 825 );
//Set Standard Menu
ReefAngel.AddStandardMenu();
// Feeeding and Water Change mode speed
ReefAngel.DCPump.FeedingSpeed=20;
ReefAngel.DCPump.WaterChangeSpeed=0;
// Ports that are always on
ReefAngel.Relay.On( Port4 );
////// Place additional initialization code below here
////// Place additional initialization code above here
}
void loop()
{
ReefAngel.StandardLights( Actinic_Lights,12,0,22,0 );
ReefAngel.StandardLights( Day_Lights,13,0,21,0 );
ReefAngel.Relay.Set( Moon_Lights, !ReefAngel.Relay.Status( Actinic_Lights ) );
ReefAngel.StandardLights( Sump_Fan,13,0,21,0 );
ReefAngel.Relay.Set(DeNit_Doser,(now()-3600)%21600<1200); // Runs for 1200s every 21600 seconds
ReefAngel.Relay.Set(DeNit_Pump,((now()-3600)-1200)%21600<1200); // Runs for 1200s every 21600 seconds with 1200s offset
ReefAngel.WaterLevelATO(ATO_Pump,720,32,32); // Enable ATO the ATO
if (ReefAngel.Relay.Status(DeNit_Pump)) // Check to see if DeNit Pump is on and update time is empty
{
ATOUpdate = now(); // If so, set the update time to now
}
if (now() - ATOUpdate < 120) // If it hasnt been 120 seconds turn off the port
{
ReefAngel.WaterLevelATO(ATO_Pump,720,0,1);
}
//Disable ATO if Salinity is below 33.5
if (ReefAngel.Params.Salinity<335) ReefAngel.Relay.Off(ATO_Pump);
if (ReefAngel.DCPump.Mode==Custom)
{
ReefAngel.PWM.SetActinic( ElseMode(40,20,true )); // ElseMode on sync mode, 40 +/- 20%
ReefAngel.PWM.SetDaylight( ElseMode(80,20,false )); // ElseMode on Anti-sync mode, 80 +/- 20%
}
if( ReefAngel.DisplayedMenu==FEEDING_MODE ) ReefAngel.PWM.SetActinic(20);
if( ReefAngel.DisplayedMenu==WATERCHANGE_MODE ) ReefAngel.PWM.SetActinic(0);
if (hour()<12 || hour()>=22) ReefAngel.PWM.SetActinic(30);
////// Place your custom code below here
////// Place your custom code above here
// This should always be the last line
ReefAngel.Portal( "Sacohen","Seth0310" );
ReefAngel.ShowInterface();
}
void DrawCustomMain()
{
int x,y;
char text[10];
// 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();
// Water Level
ReefAngel.LCD.DrawText( COLOR_DARKGOLDENROD,DefaultBGColor,75,66, "WL:" );
ReefAngel.LCD.DrawText( COLOR_DARKGOLDENROD,DefaultBGColor,99,66, ReefAngel.WaterLevel.GetLevel() );
ConvertNumToString(text, ReefAngel.Params.Salinity, 10);
strcat(text," ");
ReefAngel.LCD.DrawText(DefaultFGColor,DefaultBGColor,39,75,"Salinity:");
ReefAngel.LCD.DrawText(DefaultFGColor,DefaultBGColor,99,75,text);
pingSerial();
// Main Relay Box
byte TempRelay = ReefAngel.Relay.RelayData;
TempRelay &= ReefAngel.Relay.RelayMaskOff;
TempRelay |= ReefAngel.Relay.RelayMaskOn;
ReefAngel.LCD.DrawOutletBox( 12, 92, TempRelay );
pingSerial();
TempRelay = ReefAngel.Relay.RelayDataE[0];
TempRelay &= ReefAngel.Relay.RelayMaskOffE[0];
TempRelay |= ReefAngel.Relay.RelayMaskOnE[0];
ReefAngel.LCD.DrawOutletBox(12, 104, TempRelay);
// Date and Time
ReefAngel.LCD.DrawDate( 6, 122 );
pingSerial();
}
void DrawCustomGraph()
{
}
byte ElseMode( byte MidPoint, byte Offset, boolean WaveSync )
{
// Static's only initialize the first time they are called
static unsigned long LastChange=millis(); // Set the inital time that the last change occurred
static int Delay = random( 500, 3000); // Set the initial delay
static int NewSpeed = MidPoint; // Set the initial speed
static int AntiSpeed = MidPoint; // Set the initial anti sync speed
if ((millis()-LastChange) > Delay) // Check if the delay has elapsed
{
Delay=random(500,5000); // If so, come up with a new delay
int ChangeUp = random(Offset); // Amount to go up or down
if (random(100)<50) // 50/50 chance of speed going up or going down
{
NewSpeed = MidPoint - ChangeUp;
AntiSpeed = MidPoint + ChangeUp;
}
else
{
NewSpeed = MidPoint + ChangeUp;
AntiSpeed = MidPoint - ChangeUp;
}
LastChange=millis(); // Reset the time of the last change
}
if (WaveSync)
{
return NewSpeed;
}
else
{
return AntiSpeed;
}
}I did not send out the old head unit, I want to put is back in tonight and see if I at least go back to the way things were before I switched them out yesterday.
Thanks;
-
rimai
- Posts: 12857
- Joined: Fri Mar 18, 2011 6:47 pm
Re: Everything is reading 0.
Your mode only works when you set the internal memory to custom.
Did you do that?
Did you do that?
Roberto.
- Sacohen
- Posts: 1833
- Joined: Sun Apr 21, 2013 6:25 am
- Location: Davie, FL
Re: Everything is reading 0.
I'm not sure.
I used the same code that was on my old RA+ Head Unit.
The Internal Memory on the Portal is set to Custom with a speed and duration of 255.
I removed the line that said
So this code is now pointing to the Else Mode code that is at the bottom of the coding...
It is supposed to be at 30% until 12pm so I'll see what happens in about 40 min.
I used the same code that was on my old RA+ Head Unit.
The Internal Memory on the Portal is set to Custom with a speed and duration of 255.
I removed the line that said
Code: Select all
if (ReefAngel.DCPump.Mode==Custom)Code: Select all
{
ReefAngel.PWM.SetActinic( ElseMode(40,20,true )); // ElseMode on sync mode, 40 +/- 20%
ReefAngel.PWM.SetDaylight( ElseMode(80,20,false )); // ElseMode on Anti-sync mode, 80 +/- 20%
}
if( ReefAngel.DisplayedMenu==FEEDING_MODE ) ReefAngel.PWM.SetActinic(20);
if( ReefAngel.DisplayedMenu==WATERCHANGE_MODE ) ReefAngel.PWM.SetActinic(0);
if (hour()<12 || hour()>=22) ReefAngel.PWM.SetActinic(30);-
rimai
- Posts: 12857
- Joined: Fri Mar 18, 2011 6:47 pm
Re: Everything is reading 0.
The latest data from your controller shows dcd, dcm and dcs are all 255.
http://forum.reefangel.com/status/param ... id=sacohen
I think it is because you are missing this:
http://forum.reefangel.com/status/param ... id=sacohen
I think it is because you are missing this:
Code: Select all
ReefAngel.DCPump.UseMemory=true
Roberto.
- Sacohen
- Posts: 1833
- Joined: Sun Apr 21, 2013 6:25 am
- Location: Davie, FL
Re: Everything is reading 0.
I think I figured out what was wrong with the pumps at least.
I'll see what happens at 12pm when the Else mode is supposed to kick in.
The temp problem is still a mystery and is the fact that whenever I re-boot (either pull the power or re-boot after code upload I lose all my readings, but Salinity, pH and Water level eventually come back.
This time they haven't.
If you are saying the temp is due to something in my code, I'm going to try setting up a INO thru the wizard and see what happens.
With clean code from the wizard the Temp probes should work fine.
I'll see what happens at 12pm when the Else mode is supposed to kick in.
The temp problem is still a mystery and is the fact that whenever I re-boot (either pull the power or re-boot after code upload I lose all my readings, but Salinity, pH and Water level eventually come back.
This time they haven't.
If you are saying the temp is due to something in my code, I'm going to try setting up a INO thru the wizard and see what happens.
With clean code from the wizard the Temp probes should work fine.
-
rimai
- Posts: 12857
- Joined: Fri Mar 18, 2011 6:47 pm
Re: Everything is reading 0.
No, the something else is not code related.
I think it could be your probes that are causing this, since it did the same thing on the previous board.
I think it could be your probes that are causing this, since it did the same thing on the previous board.
Roberto.
- Sacohen
- Posts: 1833
- Joined: Sun Apr 21, 2013 6:25 am
- Location: Davie, FL
Re: Everything is reading 0.
All 3 probes at once? Strange.
The pumps are working correctly now.
The pH, Water level and Salinity have not come back yet, like they have in the past.
Any idea why the portal is showing everything in the world now?



The pumps are working correctly now.
The pH, Water level and Salinity have not come back yet, like they have in the past.
Any idea why the portal is showing everything in the world now?



-
rimai
- Posts: 12857
- Joined: Fri Mar 18, 2011 6:47 pm
Re: Everything is reading 0.
I just told you 3 posts above....
You must setup DCD,DCM and DCS or the portal will crap out.
It's set to 255 for all 3 right now and there is not such thing as mode 255, so the javascript fails to set the mode and it causes the portal to show everything.
You must setup DCD,DCM and DCS or the portal will crap out.
It's set to 255 for all 3 right now and there is not such thing as mode 255, so the javascript fails to set the mode and it causes the portal to show everything.
Roberto.
- Sacohen
- Posts: 1833
- Joined: Sun Apr 21, 2013 6:25 am
- Location: Davie, FL
Re: Everything is reading 0.
I'm not understanding this, sorry.
When you said
I'm not using the DCPump command or the internal memory for my pumps.
As I said...
If it is referring to the portal or temp issue where and how do I change them and what should they be?
I don't recall ever doing that before with my other board.
When you said
I thought you were talking about the pump speeds.rimai wrote:The latest data from your controller shows dcd, dcm and dcs are all 255.
http://forum.reefangel.com/status/param ... id=sacohen
I think it is because you are missing this:Code: Select all
ReefAngel.DCPump.UseMemory=true
I'm not using the DCPump command or the internal memory for my pumps.
As I said...
Is the dcd, dcm and dcs referring to the portal issue, the temp issue or the pump speed issue?Sacohen wrote: I removed the line that saidSo this code is now pointing to the Else Mode code that is at the bottom of the coding...Code: Select all
if (ReefAngel.DCPump.Mode==Custom)
Code: Select all
{ ReefAngel.PWM.SetActinic( ElseMode(40,20,true )); // ElseMode on sync mode, 40 +/- 20% ReefAngel.PWM.SetDaylight( ElseMode(80,20,false )); // ElseMode on Anti-sync mode, 80 +/- 20% } if( ReefAngel.DisplayedMenu==FEEDING_MODE ) ReefAngel.PWM.SetActinic(20); if( ReefAngel.DisplayedMenu==WATERCHANGE_MODE ) ReefAngel.PWM.SetActinic(0); if (hour()<12 || hour()>=22) ReefAngel.PWM.SetActinic(30);
If it is referring to the portal or temp issue where and how do I change them and what should they be?
I don't recall ever doing that before with my other board.
-
rimai
- Posts: 12857
- Joined: Fri Mar 18, 2011 6:47 pm
Re: Everything is reading 0.
If you are not going to use the DC pump class, you must remove the other references too or the feature will still be enabled.
When you compile, you should not see DC Pump feature in the list of features found.
When you compile, you should not see DC Pump feature in the list of features found.
Code: Select all
// Feeeding and Water Change mode speed
ReefAngel.DCPump.FeedingSpeed=20;
ReefAngel.DCPump.WaterChangeSpeed=0;
Roberto.
- Sacohen
- Posts: 1833
- Joined: Sun Apr 21, 2013 6:25 am
- Location: Davie, FL
Re: Everything is reading 0.
I currently have had the code that you show above commented out.
The only place DCPump still appeared in my code was the DCPump.h.
I have removed every reference to DCPump and uploaded my code again.
Is this supposed to fix the portal issue of everything showing up?
The only place DCPump still appeared in my code was the DCPump.h.
I have removed every reference to DCPump and uploaded my code again.
Is this supposed to fix the portal issue of everything showing up?
-
rimai
- Posts: 12857
- Joined: Fri Mar 18, 2011 6:47 pm
Re: Everything is reading 0.
The auto-selection of features does not discriminate between comments or not.
You should remove it from the code or the feature will be enabled anyway.
You should remove it from the code or the feature will be enabled anyway.
Roberto.
- Sacohen
- Posts: 1833
- Joined: Sun Apr 21, 2013 6:25 am
- Location: Davie, FL
Re: Everything is reading 0.
See post above.
Sacohen wrote:I have removed every reference to DCPump and uploaded my code again.
Is this supposed to fix the portal issue of everything showing up?
-
rimai
- Posts: 12857
- Joined: Fri Mar 18, 2011 6:47 pm
- Sacohen
- Posts: 1833
- Joined: Sun Apr 21, 2013 6:25 am
- Location: Davie, FL
Re: Everything is reading 0.
It is removed (not commented out).
Here is my code as of 12:30pm today.
Here is my code as of 12:30pm today.
Code: Select all
#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 <Humidity.h>
#include <ReefAngel.h>
// Define Relay Ports by Name
#define Actinic_Lights 1
#define Day_Lights 2
#define Unused 3
#define Pumps 4
#define Sump_Fan 5
#define DeNit_Pump 6
#define DeNit_Doser 7
#define Unused 8
#define ATO_Pump Box1_Port1
#define Moon_Lights Box1_Port2
#define Unused Box1_Port3
#define Unused Box1_Port4
#define Unused Box1_Port5
#define Unused Box1_Port6
#define Unused Box1_Port7
#define Unused Box1_Port8
////// Place global variable code below here
unsigned long ATOUpdate=0;
////// 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 = 0;
// Ports toggled in Water Change Mode
ReefAngel.WaterChangePorts = Port4Bit;
ReefAngel.WaterChangePortsE[0] = Port1Bit;
// Ports toggled when Lights On / Off menu entry selected
ReefAngel.LightsOnPorts = Port1Bit | Port2Bit;
// Ports turned off when Overheat temperature exceeded
ReefAngel.OverheatShutoffPorts = Port1Bit | Port2Bit;
// Use T2 probe as temperature and overheat functions
ReefAngel.TempProbe = T1_PROBE;
ReefAngel.OverheatProbe = T1_PROBE;
// Set the Overheat temperature setting
InternalMemory.OverheatTemp_write( 825 );
//Set Standard Menu
ReefAngel.AddStandardMenu();
// Ports that are always on
ReefAngel.Relay.On( Port4 );
////// Place additional initialization code below here
////// Place additional initialization code above here
}
void loop()
{
ReefAngel.StandardLights( Actinic_Lights,12,0,22,0 );
ReefAngel.StandardLights( Day_Lights,13,0,21,0 );
ReefAngel.Relay.Set( Moon_Lights, !ReefAngel.Relay.Status( Actinic_Lights ) );
ReefAngel.StandardLights( Sump_Fan,13,0,21,0 );
ReefAngel.Relay.Set(DeNit_Doser,(now()-3600)%21600<1200); // Runs for 1200s every 21600 seconds
ReefAngel.Relay.Set(DeNit_Pump,((now()-3600)-1200)%21600<1200); // Runs for 1200s every 21600 seconds with 1200s offset
ReefAngel.WaterLevelATO(ATO_Pump,720,32,32); // Enable ATO the ATO
if (ReefAngel.Relay.Status(DeNit_Pump)) // Check to see if DeNit Pump is on and update time is empty
{
ATOUpdate = now(); // If so, set the update time to now
}
if (now() - ATOUpdate < 120) // If it hasnt been 120 seconds turn off the port
{
ReefAngel.WaterLevelATO(ATO_Pump,720,0,1);
}
//Disable ATO if Salinity is below 33.5
if (ReefAngel.Params.Salinity<335) ReefAngel.Relay.Off(ATO_Pump);
{
ReefAngel.PWM.SetActinic( ElseMode(40,20,true )); // ElseMode on sync mode, 40 +/- 20%
ReefAngel.PWM.SetDaylight( ElseMode(80,20,false )); // ElseMode on Anti-sync mode, 80 +/- 20%
}
if( ReefAngel.DisplayedMenu==FEEDING_MODE ) ReefAngel.PWM.SetActinic(20);
if( ReefAngel.DisplayedMenu==WATERCHANGE_MODE ) ReefAngel.PWM.SetActinic(0);
if (hour()<12 || hour()>=22) ReefAngel.PWM.SetActinic(30);
if( ReefAngel.DisplayedMenu==FEEDING_MODE ) ReefAngel.PWM.SetDaylight(20);
if( ReefAngel.DisplayedMenu==WATERCHANGE_MODE ) ReefAngel.PWM.SetDaylight(0);
if (hour()<12 || hour()>=22) ReefAngel.PWM.SetDaylight(30);
////// Place your custom code below here
////// Place your custom code above here
// This should always be the last line
ReefAngel.Portal( "Sacohen","xxxxxxx" );
ReefAngel.ShowInterface();
}
void DrawCustomMain()
{
int x,y;
char text[10];
// 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();
// Water Level
ReefAngel.LCD.DrawText( COLOR_DARKGOLDENROD,DefaultBGColor,75,66, "WL:" );
ReefAngel.LCD.DrawText( COLOR_DARKGOLDENROD,DefaultBGColor,99,66, ReefAngel.WaterLevel.GetLevel() );
ConvertNumToString(text, ReefAngel.Params.Salinity, 10);
strcat(text," ");
ReefAngel.LCD.DrawText(DefaultFGColor,DefaultBGColor,39,75,"Salinity:");
ReefAngel.LCD.DrawText(DefaultFGColor,DefaultBGColor,99,75,text);
pingSerial();
// Main Relay Box
byte TempRelay = ReefAngel.Relay.RelayData;
TempRelay &= ReefAngel.Relay.RelayMaskOff;
TempRelay |= ReefAngel.Relay.RelayMaskOn;
ReefAngel.LCD.DrawOutletBox( 12, 92, TempRelay );
pingSerial();
TempRelay = ReefAngel.Relay.RelayDataE[0];
TempRelay &= ReefAngel.Relay.RelayMaskOffE[0];
TempRelay |= ReefAngel.Relay.RelayMaskOnE[0];
ReefAngel.LCD.DrawOutletBox(12, 104, TempRelay);
// Date and Time
ReefAngel.LCD.DrawDate( 6, 122 );
pingSerial();
}
void DrawCustomGraph()
{
}
byte ElseMode( byte MidPoint, byte Offset, boolean WaveSync )
{
// Static's only initialize the first time they are called
static unsigned long LastChange=millis(); // Set the inital time that the last change occurred
static int Delay = random( 500, 3000); // Set the initial delay
static int NewSpeed = MidPoint; // Set the initial speed
static int AntiSpeed = MidPoint; // Set the initial anti sync speed
if ((millis()-LastChange) > Delay) // Check if the delay has elapsed
{
Delay=random(500,5000); // If so, come up with a new delay
int ChangeUp = random(Offset); // Amount to go up or down
if (random(100)<50) // 50/50 chance of speed going up or going down
{
NewSpeed = MidPoint - ChangeUp;
AntiSpeed = MidPoint + ChangeUp;
}
else
{
NewSpeed = MidPoint + ChangeUp;
AntiSpeed = MidPoint - ChangeUp;
}
LastChange=millis(); // Reset the time of the last change
}
if (WaveSync)
{
return NewSpeed;
}
else
{
return AntiSpeed;
}
}-
rimai
- Posts: 12857
- Joined: Fri Mar 18, 2011 6:47 pm
- Sacohen
- Posts: 1833
- Joined: Sun Apr 21, 2013 6:25 am
- Location: Davie, FL
Re: Everything is reading 0.
Great.
Thanks.
Sorry for being so thickheaded.
Now back to the original problem, the temp probes.
You think it's an issue with the 3 probes?
Do you want me to send them back with the RA board and you'll send me replacement probes or what?
Do you care if I send you the original board or the replacement back. It doesn't matter to me if you have a preference.
Thanks.
Sorry for being so thickheaded.
Now back to the original problem, the temp probes.
You think it's an issue with the 3 probes?
Do you want me to send them back with the RA board and you'll send me replacement probes or what?
Do you care if I send you the original board or the replacement back. It doesn't matter to me if you have a preference.
-
rimai
- Posts: 12857
- Joined: Fri Mar 18, 2011 6:47 pm
Re: Everything is reading 0.
Yes, just send me either board with the probes and I'll look at them.
Roberto.
- Sacohen
- Posts: 1833
- Joined: Sun Apr 21, 2013 6:25 am
- Location: Davie, FL
- lnevo
- Posts: 5422
- Joined: Fri Jul 20, 2012 9:42 am
Everything is reading 0.
The problem you had was on the new board you never set the speed/duration and mode for the dcpumps...just go to the portal and do that and your original code should be fine. You basically were not in Custom mode...
When i fix your code i'll program it to use the new dcpump stuff but you'll still need to set those from the portal.
When i fix your code i'll program it to use the new dcpump stuff but you'll still need to set those from the portal.
- Sacohen
- Posts: 1833
- Joined: Sun Apr 21, 2013 6:25 am
- Location: Davie, FL
Re: Everything is reading 0.
Thanks to both of you.
Lee when you work on my code could you add the random DC wave like you did for PaulTurner911 (if it's not too much trouble)?
Lee when you work on my code could you add the random DC wave like you did for PaulTurner911 (if it's not too much trouble)?