Page 1 of 1
ORP calibration with 220mV fluid
Posted: Tue Jun 11, 2013 4:51 am
by Graham2212
Hi All
Can anyone help me with the code that I would need to calibrate my ORP if I have 220mV fluid?
Thanks!
Re: ORP calibration with 220mV fluid
Posted: Tue Jun 11, 2013 8:59 am
by rimai
You need to update the libraries, but the problem with updating the libraries is that everytime there is an update, it will overwrite the changes you've made.
But, if you want to give it a shot, you must change the lines:
https://github.com/reefangel/Libraries/ ... l.cpp#L886
https://github.com/reefangel/Libraries/ ... .cpp#L5513
Look for the 470 and change it to 220 or whatever standard that you have.
Re: ORP calibration with 220mV fluid
Posted: Wed Jun 12, 2013 3:12 am
by Graham2212
Thanks Roberto
To be honest, I am not a code person at all... I tried to take the relevant lines from your links and put them into my code, but I got the error "'Params' was not declared in the scope" or "'ORP' was not declared in this script. Here is my code at the moment:
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 <LCD_Timer.h>
#include <WaterLevel.h>
#include <ReefAngel.h>
////// Place global variable code below here
////// Place global variable code above here
void setup()
{
// This must be the first line
ReefAngel.Init(); //Initialize controller
ReefAngel.Timer[LCD_TIMER].SetInterval(84600);
ReefAngel.PHMin=523;
ReefAngel.PHMax=828;
ReefAngel.UseFlexiblePhCalibration();
ReefAngel.SetTemperatureUnit( Celsius ); // set to Celsius Temperature
// Ports toggled in Feeding Mode
ReefAngel.FeedingModePorts = Port5Bit | Port6Bit;
// Ports toggled in Water Change Mode
ReefAngel.WaterChangePorts = Port1Bit | Port5Bit | Port6Bit;
// Ports toggled when Lights On / Off menu entry selected
ReefAngel.LightsOnPorts = 0;
// Ports turned off when Overheat temperature exceeded
ReefAngel.OverheatShutoffPorts = 0;
// Use T1 probe as temperature and overheat functions
ReefAngel.TempProbe = T1_PROBE;
ReefAngel.TempProbe = T2_PROBE;
ReefAngel.OverheatProbe = T1_PROBE;
// Set the Overheat temperature setting
InternalMemory.OverheatTemp_write( 290 );
// Ports that are always on
ReefAngel.Relay.On( Port7 );
ReefAngel.Relay.On( Port8 );
////// Place additional initialization code below here
////// Place additional initialization code above here
}
void loop()
{
ReefAngel.StandardATO( Port1,1000 );
ReefAngel.WavemakerRandom1( Port5,15,60 );
ReefAngel.WavemakerRandom2( Port6,15,60 );
////// Place your custom code below here
#if defined ORPEXPANSION
unsigned long temporp=0;
for (int a=0;a<20;a++)
{
temporp+=ORP.Read();
}
Params.ORP=temporp/20;
if (Params.ORP!=0)
{
Params.ORP=map(Params.ORP, ORPMin, ORPMax, 0, 470); // apply the calibration to the sensor reading
Params.ORP=constrain(Params.ORP,0,550);
}
RefreshScreen();
#endif // defined ORPEXPANSION
////// Place your custom code above here
// This should always be the last line
ReefAngel.Portal( "Graham2212" );
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();
// Salinity
ReefAngel.LCD.DrawText( COLOR_DARKKHAKI,DefaultBGColor,15,66, "SAL:" );
ReefAngel.LCD.DrawText( COLOR_DARKKHAKI,DefaultBGColor,39,66, ReefAngel.Params.Salinity );
pingSerial();
// ORP
ReefAngel.LCD.DrawText( COLOR_PALEVIOLETRED,DefaultBGColor,75,54, "ORP:" );
ReefAngel.LCD.DrawText( COLOR_PALEVIOLETRED,DefaultBGColor,99,54, ReefAngel.Params.ORP );
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()
{
}
Is there anyway to say maybe "UseFlexibleORPCalibration()" under the setup section, so that I can define in reef angel, that I am using 220mV?
Thank you
Re: ORP calibration with 220mV fluid
Posted: Wed Jun 12, 2013 10:07 am
by rimai
Oh, it won't work if you use in your code.
It needs to be changed in the libraries itself. That's why I said is not a good practice to do that.
Nobody created a "UseFlexibleORPCalibration()" yet.
Maybe if you bug phrusher long enough, he may be able to do that for us
He was the one that created the "UseFlexiblePHCalibration()" function.
Re: ORP calibration with 220mV fluid
Posted: Wed Jun 12, 2013 10:10 am
by lnevo
I can take a look, but I would have no way to test
Re: ORP calibration with 220mV fluid
Posted: Wed Jun 12, 2013 1:04 pm
by Graham2212
I'm very happy to test!! I would really appreciate your help!!
Re: ORP calibration with 220mV fluid
Posted: Sat Jun 29, 2013 4:41 pm
by coolbird
Hi
I would be really interested in this as well, I have found it impossible to get the 470mv calibration fluid in the uk, some say they can get it but 2 months on nothing.
Re: ORP calibration with 220mV fluid
Posted: Sat Jun 29, 2013 4:45 pm
by lnevo
Sorry i have not had any time to put something together for this..
Re: ORP calibration with 220mV fluid
Posted: Sat Jun 29, 2013 4:51 pm
by coolbird
lnevo wrote:Sorry i have not had any time to put something together for this..
Sorry no pressure just wanted to register interest
I raised this a while ago and didn't like the idea of messing with the libraries, especially after reading so many posts that said it wasnt wise.
Thanks for the reply though
Re: ORP calibration with 220mV fluid
Posted: Sat Jun 29, 2013 4:56 pm
by lnevo
Sorry i have not had any time to put something together for this..
Re: ORP calibration with 220mV fluid
Posted: Sun Jun 30, 2013 12:38 pm
by lnevo
Ok, I started a branch and added in all the framework to do the flexible orp calibration... now the function just needs to be written.
I have to back out a little bit because it's quite a large function with lots of drawing, etc. Maybe phrusher wants to get involved
or if anyone else wants to give it a try, you can checkout the flexOrp branch on my repo
https://github.com/lnevo/Libraries/tree/flexOrp
Re: ORP calibration with 220mV fluid
Posted: Mon Jul 01, 2013 6:46 am
by coolbird
lnevo wrote:Ok, I started a branch and added in all the framework to do the flexible orp calibration... now the function just needs to be written.
I have to back out a little bit because it's quite a large function with lots of drawing, etc. Maybe phrusher wants to get involved
or if anyone else wants to give it a try, you can checkout the flexOrp branch on my repo
https://github.com/lnevo/Libraries/tree/flexOrp
Thank you for your assistance
Re: ORP calibration with 220mV fluid
Posted: Tue Nov 26, 2013 9:25 am
by Graham2212
Any luck with an update on this?
Re: ORP calibration with 220mV fluid
Posted: Tue Nov 26, 2013 6:14 pm
by lnevo
Not really. I think if roberto can answer its easy enough to manually modify. Its a lot of work i dont have time for to create the screens for flex orp calibration. Sorry
maybe someone else can pitch in and pick it up but not sure how close the framework is since i did it a few versions ago..
Re: ORP calibration with 220mV fluid
Posted: Tue Nov 26, 2013 6:32 pm
by rimai
For manual edit, there files that need to be modified is a different one.
In the new libraries, you actually need to update the file ReefAngel_1.5_LCD.h located in \Documents\Arduino\Libraries\ReefAngel
Look for the line 3786 and change this:
To this:
Then open ReefAngel.cpp located in the same folder and look for line 583 and change this:
Code: Select all
Params.ORP=map(Params.ORP, ORPMin, ORPMax, 0, 470); // apply the calibration to the sensor reading
To this:
Code: Select all
Params.ORP=map(Params.ORP, ORPMin, ORPMax, 0, 220); // apply the calibration to the sensor reading
Re: ORP calibration with 220mV fluid
Posted: Mon Jan 15, 2018 9:41 am
by rrodriguess
Roberto
Any loss (precision or somethong else) calibrating with a 220mv instead of 470mv? What about 400mv?
Just to understand our options here.
Best regards
Rafa
Re: ORP calibration with 220mV fluid
Posted: Mon Jan 15, 2018 10:42 am
by rimai
Yes, you will get twice less resolution.
Re: ORP calibration with 220mV fluid
Posted: Mon Jan 15, 2018 1:02 pm
by rrodriguess
Simple as that..
tks Roberto
Re: ORP calibration with 220mV fluid
Posted: Mon Jan 15, 2018 1:43 pm
by rimai
Actually, no. You should be fine as long as you know the readings would be about half of what RA is showing.